Installation Guide

You can install Callcontrol as Debian Package or from the source.

Binary packages are available for Debian on i386 and amd64 architectures.

Install as Debian Package

Add these lines to /etc/apt/sources.list (substitute unstable with your release name, like stretch, if you're not running unstable):

# AG Projects software
deb unstable main
deb-src unstable main

Install the AG Projects debian software signing key:

sudo wget -O /etc/apt/trusted.gpg.d/agp-debian-key.gpg

After that, run:

sudo apt-get update

Install Callcontrol:

sudo apt-get install callcontrol

Installing from source

Download and install dependencies

On non Debian installations you can install it from the source.

You will need the following dependencies:

  • python-application (>= 1.2.8)

  • python-twisted-core

  • python-sqlobject

Download and install Call control

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

The software is available as a tar archive at:

Extract it using tar xzvf callcontrol-version.tar.gz and change directory to the newly created callcontrol directory.

The source code is also managed using darcs version control tool. The darcs repository can be fetched with:

darcs get

To obtain the incremental changes after the initial get:

cd callcontrol
darcs pull -a

After fetching install the software:

cd callcontrol
sudo python install

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 ""
loadmodule ""
loadmodule ""
loadmodule ""
loadmodule ""
loadmodule ""

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");
            # 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 the 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

Make sure the following code is in /etc/cdrtool/


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

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

Starting 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