-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathINSTALL
175 lines (123 loc) · 4.25 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
Installation
------------
For Debian testing or unstable there is an official public repository
provided by AG Projects. Install the AG Projects debian software signing
key:
wget http://download.ag-projects.com/agp-debian-gpg.key apt-key add
agp-debian-gpg.key
Add these lines in etc/apt/sources.list
# AG Projects software
deb http://ag-projects.com/debian unstable main
deb-src http://ag-projects.com/debian unstable main
After that, run:
apt-get update
apt-get install callcontrol
For non Debian installations, you must install the following dependencies:
python-application (>= 1.2.8)
python-twisted-core
python-sqlobject
Call Control software is available as a tar archive at:
http://download.ag-projects.com/CallControl/
Extract it using tar xzvf callcontrol-version.tar.gz and change directory to
the newly created callcontrol directory.
The source code is managed using darcs version control tool. The darcs
repository can be fetched with:
darcs get http://devel.ag-projects.com/repositories/callcontrol
To obtain the incremental changes after the initial get:
cd callcontrol
darcs pull -a
Install the software:
cd callcontrol
python setup.py install
You may run the software from its own directory or install it in a directory
anywhere in the system.
Configuration
-------------
You must setup the following components:
1. OpenSIPS configuration
2. Call Control (this application)
3. CDRTool rating engine
1. OpenSIPS configuration
loadmodule "mi_fifo.so"
loadmodule "mi_datagram.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "dialog.so"
loadmodule "call_control.so"
modparam("call_control", "disable", 0)
route {
...
if ((method=="INVITE" && !has_totag())) {
# you need to call this function at the first INVITE
call_control();
switch ($retcode) {
case 2:
# Call with no limit
case 1:
# Call with a limit under callcontrol management (either prepaid
# or postpaid)
break;
case -1:
# Not enough credit (prepaid call)
xlog("L_INFO", "Call control: not enough credit for prepaid call\n");
acc_rad_request("402");
sl_send_reply("402", "Not enough credit");
exit;
break;
case -2:
# Locked by call in progress (prepaid call)
xlog("L_INFO", "Call control: prepaid call locked by another call in progress\n");
acc_rad_request("403");
sl_send_reply("403", "Call locked by another call in progress");
exit;
break;
case -3:
# Duplicated CallID
xlog("L_INFO", "Call control: duplicated CallID\n");
acc_rad_request("400");
sl_send_reply("400", "Duplicated CallID");
exit;
break;
default:
# Internal error (message parsing, communication, ...)
xlog("L_INFO", "Call control: internal server error\n");
acc_rad_request("500");
sl_send_reply("500", "Internal server error");
exit;
}
}
...
}
For more information see the documentation that comes with the OpenSIPS
callcontrol module.
2. Call Control configuration (this application)
The application is searching for its configuration file config.ini in its current
directory and in /etc/callcontrol/config.ini
[CDRTool]
; connection to cdrtool rating engine for MaxSessionTime() and DebitBalance()
address = cdrtool.hostname:9024
[RadiusDatabase]
; user = radius
; password = password
; host = db
; database = radius
; table = radacct%%Y%%m
[OpenSIPS]
; Connection to OpenSIPS' MI
; socket_path = /run/opensips/socket
A more detailed sample configuration file is available in config.ini.sample.
3. CDRTool rating engine
Please see the documentation of CDRTool project to setup the rating engine.
Logging
-------
Call Control logs all activity to syslog. You may grep for call-control in
syslog. The requests can be correlated by call-id with the syslog entries
generated by CDRTool rating engine.
Control commands
----------------
Monitoring active sessions:
/etc/init.d/callcontrol sessions
Displaying information about an active session:
/etc/init.d/callcontrol session id
Terminating a session:
/etc/init.d/callcontrol terminate id