« Previous - Version 17/19 (diff) - Next » - Current version
Adrian Georgescu, 09/09/2011 05:38 pm


Binary packages are available for Debian on i386 and amd64 architectures. To install add the following lines to /etc/apt/sources.list:

deb http://ag-projects.com/debian unstable main
deb-src http://ag-projects.com/debian unstable main

Install AG Projects debian repository signing key:

wget http://download.ag-projects.com/agp-debian-gpg.key
sudo apt-key add agp-debian-gpg.key

To install the software:

sudo apt-get update
sudo apt-get install callcontrol

For non Debian installations you must perform the following steps:
For non Debian installations, you must install the following dependencies:

  • python-application (>= 1.2.8)
  • python-twisted-core
  • python-sqlobject

You may run the software from its own directory or install it in a directory
anywhere in the system.

The software can be downloaded as a tar archive from:


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
sudo python setup.py install

Configure the software

You need to setup the following components:

  • OpenSIPS callcontrol module, version >=1.5
  • Call Control application (this software)
  • CDRTool rating engine, version >=6.7.0

=== 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
switch ($retcode) {
case 2: # Call with no limit
case 1: # Call with a limit under callcontrol management (either prepaid or postpaid)
case -1: # Not enough credit (prepaid call)
xlog("L_INFO", "Call control: not enough credit for prepaid call\n");
sl_send_reply("402", "Not enough credit");
case -2: # Locked by call in progress (prepaid call)
xlog("L_INFO", "Call control: prepaid call locked by another call in progress\n");
sl_send_reply("403", "Call locked by another call in progress");
case -3: # Duplicated callid
xlog("L_INFO", "Call control: Duplicated call id\n");
sl_send_reply("400", "Duplicated callid");
case -4: # Call limit reached
xlog("L_INFO", "Call control: Call limit reached\n");
sl_send_reply("503", "Too many concurrent calls");
default: # Internal error (message parsing, communication, ...)
xlog("L_INFO", "Call control: internal server error\n");
sl_send_reply("500", "Internal server error");

=== Call Control configuration ===

For all configuration options and their description see [source:config.ini.sample config.ini.sample]

The application is searching for its configuration file config.ini in its current directory and in /etc/callcontrol/config.ini

Copy config.ini.sample to /etc/callcontrol/config.ini and edit the file to suit your environment:

; how to detect sessions that have media timeout without BYE

; connection to cdrtool rating engine for MaxSessionTime() and DebitBalance()
address = cdrtool.hostname

; connection to OpenSIPS call_control module
; socket_path = /var/run/opensips/socket
max_connections = 10

=== CDRTool rating engine configuration ===

$RatingEngine=array( "socketIP" => "0",
"socketPort" => "9024",
"cdr_source" => "opensips_radius"


See the documentation of CDRTool project for how to setup the rating tables.

Start the server

/etc/init.d/callcontrol start

The server logs its messages to syslog.

=== Monitoring active sessions ===

/etc/init.d/callcontrol sessions

Overview of the ongoing sessions, generation of prepaid cards and prepaid accounts can be managed from CDRTool rating tables web interface.

=== Display details about an active session === {{{
/etc/init.d/callcontrol session id

=== Terminating a session === {{{
/etc/init.d/callcontrol terminate id