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 http://ag-projects.com/debian unstable main
deb-src http://ag-projects.com/debian unstable main

Install the AG Projects debian software signing key:

sudo wget -O /etc/apt/trusted.gpg.d/agp-debian-key.gpg http://download.ag-projects.com/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: 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 also 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

After fetching install the software:

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

Configuration

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 call id\n");
            acc_rad_request("400");
            sl_send_reply("400", "Duplicated callid");
            exit;
            break;
        case -4:
            # Call limit reached
            xlog("L_INFO", "Call control: Call limit reached\n");
            acc_rad_request("503");
            sl_send_reply("503", "Too many concurrent calls");
            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;
         }
    }
...
}

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:

[CallControl]
; how to detect sessions that have media timeout without BYE
timeout_detection=dialog

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

[OpenSIPS]
; 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/global.inc:

<?php

$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