« Previous - Version 33/56 (diff) - Next » - Current version
Adrian Georgescu, 12/16/2008 09:58 pm


Image(CallControl.png, align=right)

Call Control is a prepaid application that can be used together with
OpenSIPS call_control module and CDRTool rating engine to limit the duration
of SIP sessions based on a prepaid balance. It can also be used to limit the
duration of any session to a predefined maximum value without debiting a

Call Control achieves this by maintaining a timer for each session and
sending BYE messages to both SIP end-points, if the session exceeds its
maximum session limit or if the Call Control receives a command to
forcefully close the call from outside. Features:

  • Parallel sessions using one balance per subscriber
  • Support for sessions that have timeout without BYE
  • Support for sessions that have timeout for media (using [http://mediaproxy-ng.org MediaProxy])
  • Manual session stop from server terminal
  • Overview of ongoing sessions in the web page or server terminal
  • Graceful restart without loosing track of sessions
  • Detailed logging of all performed actions using syslog
  • Web page provisioning for prepaid accounts (using [http://cdrtool.ag-projects.com CDRTool])

The software is available as a tar archive at:

[http://download.ag-projects.com/CallControl/ http://download.ag-projects.com/CallControl/]

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

  1. 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:

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

After that, run:

apt-get update
apt-get install callcontrol


This software is licensed according to the GNU General Public License version 2.


You need to setup the following components:

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

=== OpenSIPS configuration === {{{
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");
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]

; how to detect sessions that have media timeout without BYE

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

; 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",
"allow" => array('10.')

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

=== Prepaid engine API ===


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

=== Monitoring active sessions and terminating a session ===

/etc/init.d/callcontrol sessions
/etc/init.d/callcontrol session id
/etc/init.d/callcontrol terminate id

=== Support ===

Call Control is developed and supported by [http://ag-projects.com AG Projects]. AG Projects offers
best-effort free support. "best-effort" means that we try to solve the bugs
you report or help fix your problems as soon as we can, subject to available
resources. You may report bugs or feature request to:

A mailing list archive is available at:

CallControl.png (46.8 kB) Adrian Georgescu, 01/09/2009 11:40 am