Installing opensips server and opensips admin portal from source

1. Get stable release of version 1.8 from svn directly with following command


  • svn co

2. Install prerequisites for menu config on opensips

  • apt-get install flex bison libncurses-dev =>  for parsing config file and for menu config

3.Run menu config command

  • make menuconfig 
  • If Mysql database is selected to install make sure libmysqlclient-dev is installed
  • select Comple and Install Opensips

4. Creating a opensips database

  • On opensips intallation folder e.g :/usr/local/opensips
  • cd etc/opensips
    • vim opensipsctlrc
      • DBHOST=localhost
      • DBNAME=opensips
      • DBRWUSER=opensips
      • DBRWPW=”opensipsrw”
      • DBROOTUSER=”root”
  • cd /usr/local/opensips/sbin
    • ./opensipsdbctl create
      • Enter root password and select y/n depending upon requirement of tables e.g I used Install presence related tables? to yes and Install tables for imc cpl siptrace domainpolicy carrierroute user blacklist? to yes.

5. Generating configuration life

  • Make sure m4 application is installed
  • cd /usr/local/opensips/sbin
    • ./osipsconfig
  • choose the service and select Generate Load_Balancer Script
  • File in /usr/local/opensips//etc/opensips/ will be created automatically with unix time stamp on it e.g opensips_loadbalancer_2012-6-20_11:55:44.cfg  
  • Open /usr/local/opensips//etc/opensips/opensips_loadbalancer_2012-6-20_11:55:44.cfg and atleast configure following parameters
    • listen=udp:   # FOR UDP
    • disable_tcp=no    # FOR TCP
    • listen=tcp:   # FOR TCP
    • mpath=”/usr/local/opensips/lib64/opensips/modules/”
    • modparam(“acc”, “db_url”,”mysql://opensips:opensipsrw@localhost/opensips”)
    • modparam(“dispatcher”, “db_url”,”mysql://opensips:opensipsrw@localhost/opensips”) 

6 Configuring INIT script

  •  Goto src folder and cd to packaging/debian  e.g    /usr/src/1.8/packaging/debian (if you are in debain system)
  • cp opensips.init /etc/init.d/opensips   (copy opensips.init to /etc/init.d/opensips)
  • chmod +x /etc/init.d/opensips (Give execution permission to the script)
  • Open /etc/init.d/opensips and change the following variables
    • DAEMON=/usr/local/opensips/sbin/opensips
    • if [ “$1” != “debug” ]; then
      fi (Delete this block if you want to use it in production level, its a debug information)
    • Locate OPTIONS=”-P $PIDFILE -m $S_MEMORY -M $P_MEMORY -u $USER -g $GROUP ” and append following parameter -f /usr/local/opensips/etc/opensips/opensips_loadbalancer_2012-6-20_11:55:44.cfg . e.g
      OPTIONS=”-P $PIDFILE -m $S_MEMORY -M $P_MEMORY -u $USER -g $GROUP -f /usr/local/opensips/etc/opensips/opensips_loadbalancer_2012-6-20_11:55:44.cfg”
    • Configure DEFAULTS=/etc/default/opensips
      • cp /usr/src/1.8/packaging/debian/opensips.default /etc/default/opensips
      • change the following files
        • RUN_OPENSIPS=yes

7 Logging Opensips

  • open confiuration file e.g  /usr/local/opensips/etc/opensips/opensips_loadbalancer_2012-6-20_11\:55\:44.cfg
  • added log_facility=LOG_LOCAL0
  • vim /etc/rsyslog.conf and add following line
    local0.*                        -/var/log/opensips.log
  • /etc/init.d/rsyslog restart

8 Installing web Interface for opensips (Opensips Control Panel)

  • cd /var/www/
  • svn co opensips-cp
  • Install dependencies
    • apt-get install libapache2-mod-php5 php5 php5-cli php5-gd php5-mysql php-pear
  • pear install mdb2
  • pear install mdb2#mysql
  • cd /var/www/opensips-cp/config
  • vim
    •  $config->db_user = “opensips”;
      $config->db_pass = “opensipsrw”
  • vim
  • disable $boxes[$box_id][‘mi’][‘conn’]=”″;
  • enable $boxes[$box_id][‘mi’][‘conn’]=”/tmp/opensips_fifo”;
  • Create a admin username
    • execute followin in sql cmd line
      CREATE TABLE `ocp_admin_privileges` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `first_name` varchar(64) NOT NULL default ”,
      `last_name` varchar(64) NOT NULL default ”,
      `username` varchar(64) NOT NULL default ”,
      `password` varchar(64) NOT NULL default ”,
      `ha1` varchar(256) default ”,
      `available_tools` varchar(512) NOT NULL default ”,
      `permissions` varchar(512) default NULL,
      PRIMARY KEY  (`id`)
    • also
      INSERT INTO ocp_admin_privileges (username,password,ha1,available_tools,permissions) values (‘admin’,’admin’,md5(‘admin:admin’),’all’,’all’);
    • Now we have username admin with password admin to access opensips control panel

TroubleShooting :

If errors occured like for module dispatcher 
Array ( [0] => Cannot connect to OpenSIPS Server via Management Interface (/tmp/opensips_proxy_fifo))
  • Goto /var/www/opensips-cp/config/tools/system/dispatcher
  • vim
  • change  $box[1][‘mi’][‘conn’]=”/tmp/opensips_proxy_fifo”; to  $box[1][‘mi’][‘conn’]=”/tmp/opensips_fifo”;

Comments are closed.