WikiStart

Version 33 (Adrian Georgescu, 12/16/2008 09:58 pm)

1 14 Redmine Admin
== Description ==
2 1
3 2 Redmine Admin
[[Image(CallControl.png, align=right)]]
4 1
5 18 Adrian Georgescu
Call Control is a prepaid application that can be used together with
6 18 Adrian Georgescu
OpenSIPS call_control module and CDRTool rating engine to limit the duration
7 18 Adrian Georgescu
of SIP sessions based on a prepaid balance. It can also be used to limit the
8 18 Adrian Georgescu
duration of any session to a predefined maximum value without debiting a
9 18 Adrian Georgescu
balance.
10 1
11 18 Adrian Georgescu
Call Control achieves this by maintaining a timer for each session and
12 18 Adrian Georgescu
sending BYE messages to both SIP end-points, if the session exceeds its
13 18 Adrian Georgescu
maximum session limit or if the Call Control receives a command to
14 19 Adrian Georgescu
forcefully close the call from outside. Features:
15 18 Adrian Georgescu
16 1
 * Parallel sessions using one balance per subscriber
17 1
 * Support for sessions that have timeout without BYE
18 21 Adrian Georgescu
 * Support for sessions that have timeout for media (using [http://mediaproxy-ng.org MediaProxy])
19 25 Adrian Georgescu
 * Manual session stop from server terminal           
20 25 Adrian Georgescu
 * Overview of ongoing sessions in the web page or server terminal
21 19 Adrian Georgescu
 * Graceful restart without loosing track of sessions 
22 1
 * Detailed logging of all performed actions using syslog
23 25 Adrian Georgescu
 * Web page provisioning for prepaid accounts  (using [http://cdrtool.ag-projects.com CDRTool])
24 18 Adrian Georgescu
25 12 Redmine Admin
== Download ==
26 12 Redmine Admin
27 13 Redmine Admin
The software is available as a tar archive at:
28 12 Redmine Admin
29 12 Redmine Admin
[http://download.ag-projects.com/CallControl/ http://download.ag-projects.com/CallControl/]
30 12 Redmine Admin
31 12 Redmine Admin
For people running Debian testing or unstable there is an official public repository provided by AG Projects. To use it, add these lines in /etc/apt/sources.list
32 12 Redmine Admin
33 12 Redmine Admin
{{{
34 12 Redmine Admin
# AG Projects software
35 12 Redmine Admin
deb	http://ag-projects.com/debian unstable main
36 12 Redmine Admin
deb-src http://ag-projects.com/debian unstable main
37 12 Redmine Admin
}}}
38 12 Redmine Admin
39 12 Redmine Admin
Install the AG Projects debian software signing key:
40 12 Redmine Admin
41 12 Redmine Admin
{{{
42 12 Redmine Admin
wget http://download.ag-projects.com/agp-debian-gpg.key
43 12 Redmine Admin
apt-key add agp-debian-gpg.key
44 12 Redmine Admin
}}}
45 12 Redmine Admin
46 12 Redmine Admin
After that, run:
47 12 Redmine Admin
48 12 Redmine Admin
{{{
49 12 Redmine Admin
apt-get update
50 12 Redmine Admin
apt-get install callcontrol
51 12 Redmine Admin
}}}
52 12 Redmine Admin
53 12 Redmine Admin
== License ==
54 12 Redmine Admin
55 16 Adrian Georgescu
This software is licensed according to the GNU General Public License version 2.
56 1
57 12 Redmine Admin
58 14 Redmine Admin
== Configuration ==
59 4 Redmine Admin
60 6 Redmine Admin
You need to setup the following components:
61 5 Redmine Admin
62 6 Redmine Admin
 * OpenSIPS callcontrol module, version >=1.5
63 6 Redmine Admin
 * Call Control application (this project)
64 6 Redmine Admin
 * CDRTool rating engine, version >=6.7.0
65 4 Redmine Admin
66 7 Redmine Admin
=== OpenSIPS configuration ===
67 7 Redmine Admin
{{{
68 7 Redmine Admin
loadmodule "call_control.so"
69 7 Redmine Admin
modparam("call_control", "disable",      0)
70 1
71 7 Redmine Admin
route {
72 8 Redmine Admin
...
73 7 Redmine Admin
    if ((method=="INVITE" && !has_totag())) {
74 33 Adrian Georgescu
       # you need to call this function at the first INVITE
75 1
        call_control();
76 33 Adrian Georgescu
        switch ($retcode) {
77 33 Adrian Georgescu
        case 2:
78 33 Adrian Georgescu
            # Call with no limit
79 33 Adrian Georgescu
        case 1:
80 33 Adrian Georgescu
            # Call with a limit under callcontrol management (either prepaid or postpaid)
81 33 Adrian Georgescu
            break;
82 33 Adrian Georgescu
        case -1:
83 33 Adrian Georgescu
            # Not enough credit (prepaid call)
84 33 Adrian Georgescu
            xlog("L_INFO", "Call control: not enough credit for prepaid call\n");
85 33 Adrian Georgescu
            acc_rad_request("402");
86 33 Adrian Georgescu
            sl_send_reply("402", "Not enough credit");
87 33 Adrian Georgescu
            exit;
88 33 Adrian Georgescu
            break;
89 33 Adrian Georgescu
        case -2:
90 33 Adrian Georgescu
            # Locked by call in progress (prepaid call)
91 33 Adrian Georgescu
            xlog("L_INFO", "Call control: prepaid call locked by another call in progress\n");
92 33 Adrian Georgescu
            acc_rad_request("403");
93 33 Adrian Georgescu
            sl_send_reply("403", "Call locked by another call in progress");
94 33 Adrian Georgescu
            exit;
95 33 Adrian Georgescu
            break;
96 33 Adrian Georgescu
        default:
97 33 Adrian Georgescu
            # Internal error (message parsing, communication, ...)
98 33 Adrian Georgescu
            xlog("L_INFO", "Call control: internal server error\n");
99 33 Adrian Georgescu
            acc_rad_request("500");
100 33 Adrian Georgescu
            sl_send_reply("500", "Internal server error");
101 33 Adrian Georgescu
            exit;
102 33 Adrian Georgescu
        }
103 8 Redmine Admin
    }
104 8 Redmine Admin
...
105 8 Redmine Admin
}
106 7 Redmine Admin
}}}
107 7 Redmine Admin
108 8 Redmine Admin
=== Call Control configuration ===
109 8 Redmine Admin
110 8 Redmine Admin
For all configuration options and their description see [source:config.ini.sample config.ini.sample]
111 8 Redmine Admin
112 1
{{{
113 27 Adrian Georgescu
[CallControl]
114 26 Adrian Georgescu
; how to detect sessions that have media timeout without BYE
115 15 Redmine Admin
timeout_detection=dialog
116 15 Redmine Admin
117 8 Redmine Admin
[CDRTool]
118 9 Redmine Admin
; connection to cdrtool rating engine for MaxSessionTime() and DebitBalance()
119 11 Redmine Admin
address = cdrtool.hostname:9024
120 8 Redmine Admin
121 8 Redmine Admin
[OpenSIPS]
122 9 Redmine Admin
; connection to OpenSIPS call_control module
123 11 Redmine Admin
; socket_path = /var/run/opensips/socket
124 1
; max_connections = 10
125 1
}}}
126 8 Redmine Admin
127 23 Adrian Georgescu
=== CDRTool rating engine configuration ===
128 1
129 22 Adrian Georgescu
{{{
130 22 Adrian Georgescu
$RatingEngine=array( "socketIP"           => "0",
131 22 Adrian Georgescu
                     "socketPort"         => "9024",
132 22 Adrian Georgescu
                     "cdr_source"         => "opensips_radius",
133 22 Adrian Georgescu
                     "allow"              => array('10.')
134 22 Adrian Georgescu
                     );
135 22 Adrian Georgescu
}}}
136 1
137 29 Adrian Georgescu
See the documentation of CDRTool project for how to setup the rating tables.
138 14 Redmine Admin
139 10 Redmine Admin
=== Prepaid engine API ===
140 14 Redmine Admin
141 14 Redmine Admin
http://download.ag-projects.com/CDRTool/doc/PREPAID.txt
142 18 Adrian Georgescu
143 18 Adrian Georgescu
Overview of ongoing sessions, generation of prepaid cards and prepaid       
144 18 Adrian Georgescu
accounts can be managed from CDRTool rating tables web interface.
145 18 Adrian Georgescu
146 32 Adrian Georgescu
=== Monitoring active sessions and terminating a session ===
147 30 Adrian Georgescu
148 30 Adrian Georgescu
{{{
149 31 Adrian Georgescu
/etc/init.d/callcontrol sessions
150 31 Adrian Georgescu
/etc/init.d/callcontrol session id
151 31 Adrian Georgescu
/etc/init.d/callcontrol terminate id
152 30 Adrian Georgescu
}}}
153 17 Adrian Georgescu
154 17 Adrian Georgescu
 === Support ===
155 17 Adrian Georgescu
156 24 Adrian Georgescu
Call Control is developed and supported by [http://ag-projects.com AG Projects]. AG Projects offers
157 17 Adrian Georgescu
best-effort free support. "best-effort" means that we try to solve the bugs
158 17 Adrian Georgescu
you report or help fix your problems as soon as we can, subject to available
159 17 Adrian Georgescu
resources. You may report bugs or feature request to:
160 17 Adrian Georgescu
161 17 Adrian Georgescu
users@lists.opensips.org
162 17 Adrian Georgescu
163 17 Adrian Georgescu
A mailing list archive is available at:
164 17 Adrian Georgescu
http://lists.opensips.org/cgi-bin/mailman/listinfo/users