Installation of OpenSIPS 1.6

So, we won't use any shortcuts in the installation. I strongly advise you to install OpenSIPS using Debian.

If you choose to install on another platform, you will have to deal with init scripts and fix the installation of the other packages.

Hardware requirements

There are no minimum hardware requirements for OpenSIPS. It will run on an ordinary PC. The best bets we have are from performance tests realized on the 1.2 version. A PC with the following specifications was capable of 28 million complete calls per hour. The testing server was an ordinary desktop—Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz, 1 GB of memory, and 100 MBps Ethernet card. Unfortunately, there are currently no formulas for OpenSIPS dimensioning. The correct hardware, CPU, and memory shall be obtained empirically.

Software requirements

The OpenSIPS software runs on a variety of platforms such as Linux, BSD, and Solaris. Some generic packages are available to certain versions of Linux and Solaris. These packages can be downloaded from The following packages are required to compile OpenSIPS.

  • gcc (or any other C compiler as suncc or icc)
  • bison or yacc (Berkley yacc)
  • flex
  • GNU make
  • GNU tar
  • GNU install
  • libxml2-dev (if you want to use the presence modules)
  • libxml-rpc (for mi_xmlrpc)

Some modules such as MySQL, POSTGRES, RADIUS, and others will require additional packages for compilation.

Books from Packt

Beginning OpenVPN 2.0.9
Beginning OpenVPN 2.0.9

Asterisk 1.4 – the Professional’s Guide
Asterisk 1.4 – the Professional’s Guide

Cacti 0.8 Network Monitoring
Cacti 0.8 Network Monitoring

FreePBX 2.5 Powerful Telephony Solutions
FreePBX 2.5 Powerful Telephony Solutions

Funambol Mobile Open Source
Funambol Mobile Open Source

Zabbix 1.8 Network Monitoring [RAW]
Zabbix 1.8 Network Monitoring [RAW]

Asterisk 1.6
Asterisk 1.6

Building Enterprise Ready Telephony Systems with sipXecs 4.0
Building Enterprise Ready Telephony Systems with sipXecs 4.0


Lab—installing Linux for OpenSIPS

All of these labs were prepared using a VMware virtual machine with Debian installed. You may download it from

The instructions for this lab formats the computer. Back up all the data on your PC before proceeding or follow these instructions in a virtual environment such as VMware or XEN.

The steps for installing Linux are as follows:

Step 1: Insert the CD and boot the computer using Debian. Press Enter to start the installation.

OpenSIPS 1.6

Here, you can also select boot and installation options. Sometimes you may need to choose some hardware-specific parameters for your installation. Press F1 for help, if needed.

Step 2:Choose a language of your preference for use in the installation process.

OpenSIPS 1.6

Downloading and installing OpenSIPS v1.6.

Step 3: Choose the keyboard layout.

OpenSIPS 1.6

It is very common to have to choose a keyboard layout, especially in European and Asian countries.

Step 4: Choose the Hostname.

OpenSIPS 1.6

It is important to choose the name of the server because later you will use this name to access the server.

Step 5: Choose the Domain name.

OpenSIPS 1.6

The domain name is obvious but important because OpenSIPS use domains to distinguish users, so be sure to enter the domain name correctly.

Step 6: Choose a Partitioning method.

OpenSIPS 1.6

Linux geeks, certainly, will use the manual option. For the purpose of learning, you can simply use the entire disk. Consult a Linux specialist for the best partitioning scheme for your server.

Step 7: Select disk to partition.

OpenSIPS 1.6

Now select the disk being used to install Linux.

Step 8 : Select All files in one partition (recommended for new users).

OpenSIPS 1.6

Again, you can choose how to partition the system. Let's stick with the default installation again. Some advanced users may want to change it.

Step 9: Now Finish the partitioning and write changes to disk.

OpenSIPS 1.6

Now finish the partitioning step and write changes to the disk. However, never do it if you want to preserve your disk. After the partitioning, all the pre-existing content of the disk will be erased. So think carefully before doing this. I use VMware to test OpenSIPS; it is free and creates a virtual machine where I can work safely

Step 10: Write changes to the disk.

OpenSIPS 1.6

Here comes the scary part. Confirm that you want to erase all the content of the disk. Well, think twice or even thrice before saying Yes.

All data on the disk will be destroyed!

Step 11: Now Configure time zone.

OpenSIPS 1.6

Select the time zone. It is important to have the correct time zone, mainly for reports. If you don't see it correctly, you will end up with voicemail messages having the wrong time.

Step 12: Set the Root password to OpenSIPs.

OpenSIPS 1.6

Choose a password for your root user. This is the most important password on the system.

Step 13: Re-enter password to verify.

OpenSIPS 1.6

Please re-enter the password for confirmation purpose. Try to use a password that is hard to crack (a password having minimum eight characters comprising of letters, numbers, and some special characters such as "*" or "#").

Step 14: Enter the Full name for the new user as opensips

OpenSIPS 1.6

Some systems require you to create at least one user. Let's do it, starting with the full username.

Step 15: Enter the name for the user account as opensips.

OpenSIPS 1.6

Step 16: Enter the password for the user account as opensips and re-enter to confirm.

OpenSIPS 1.6

Enter the password and confirm it. Again, try to use a password that is hard to crack.

Step 17: Configure the package manager. Select Yes to use a mirror.

OpenSIPS 1.6

During the process of installation, we will use several packages distributed by Debian.

Step 18: Select a mirror country.

OpenSIPS 1.6

This screen will allow you to select the place from where you will download the packages.

Step 19: Select or your preferred mirror. Select the one nearest to your network to speed up the download of the packages.

OpenSIPS 1.6

Step 20: Leave the Http proxy information blank or enter the appropriate parameters.

OpenSIPS 1.6

If you use an HTTP proxy such as Squid or Microsoft SA Server, please enter the appropriate parameters to allow Internet access for downloads.

Step 21: Select No to package popularity survey.

OpenSIPS 1.6

The popularity package survey generates statistics about the most downloaded packages.

Step 22: Select Standard system.

OpenSIPS 1.6

Debian comes in several predefined installations such as desktop, server, and standard system. The desktop installation, as an example, installs a GUI for Linux such as GNOME or KDE. We don't need this for our installation. Therefore, choose Standard system. Later, we will manually install components such as the Web server, Mail server, and SQL database.

Step 23: Select Yes to install the GRUB boot loader.

OpenSIPS 1.6

GRUB is a boot load manager for your server. It allows you to dual boot systems and do some tricks during the boot process.

Step 24: Finish the Installation.

OpenSIPS 1.6

Finish the installation and boot the system. The system will now reboot automatically.

Step 25: Just after the reboot, install SSH as follows:

apt-get install ssh

Downloading and installing OpenSIPS v1.6.x

Although it is easier to install OpenSIPS using the Debian packages, we will go through the compilation process. It is more flexible and we may need to recompile OpenSIPS a few times in this material to include other modules. The step-by-step installation process is as follows:

Step 1: Install the dependencies.

apt-get install gcc bison flex make openssl libmysqlclient-dev
libradiusclient-ng2 libradiusclient-ng-dev mysql-server libxmlrpc-c3-dev

The MySQL server is not really a dependency, but we will install it at this moment to make things easier.

Step 2: Download the source pack ages and decompress them. (Replace x with the current version.) There are two packages—tls and no-tls. The tls package contains the tls directory and some changes in the core to support encryption for the signaling.

cd /usr/src

tar -xzvf opensips-1.6.x-tls_src.tar.gz

Step 3: Compile and install the core and the modules. Include the db_mysql and aaa_radius modules.

cd opensips-1.6.x.tls
make prefix=/ all include_modules="db_mysql aaa_radius"
make prefix=/ install include_modules="db_mysql aaa_radius"

Step 4: Make the required adjustments

mkdir /var/run/opensips

The detailed instructions change often. Please check the OpenSIPS website for updates.

OpenSIPS console

OpenSIPS comes with a new administration utility called osipsconsole. This utility is written in the PERL language and uses some additional libraries. To install, carry out the following instructions:

Step 1: Download the dependencies.

apt-get install libdbi-perl libdbd-mysql-perl libfrontier-rpc-perl

Step 2: Try running the console


In the console prompt, try using the help and quit commands.

Lab—running OpenSIPS at the Linux boot

In order to run OpenSIPS at the Linux boot, perform the following steps:

Step 1: Include OpenSIPS in the Linux boot

cd /usr/src/opensips-1.6.x-tls/packaging/debian
cp opensips.default /etc/default/opensips
cp opensips.init /etc/init.d/opensips
update-rc.d opensips defaults 99

Step 2: Edit the /etc/opensips/opensips.cfg and remove the fork=no line (even if it was with C-style remarks). The init script looks for the instruction fork=no, even if commented.

Step 3: Make sure that the opensips.init script has the necessary permissions.

cd /etc/init.d
chmod 755 opensips

Step 4: Edit /etc/default/opensips, and change the memory parameter to 128 MB and RUN_OPENSIPS to yes.

Step 5: Edit the init script to make sure that the daemon is pointing to the correct directory.

vi /etc/init.d/opensips

The file before making changes:


The file before after changes:


Step 6: Restart the computer to see if OpenSIPS starts. Confirm this using:

ps-ef |grep opensips

It is highly recommended that you change the username and password used to run OpenSIPS in the /etc/init.d/opensips file.

OpenSIPS v1.6.x directory structure

After the installation, OpenSIPS will create a file structure. It is important to understand the file structure in order to locate the main folders where the system is stored. You will need this information to update or remove the software.

Configuration files (etc/opensips)

These are the files copied to this directory. The files include the RADIUS dictionary to be used for OpenSIPS, the main configuration file opensips.cfg, the opensipsctl resource file, opensipsctlrc, and the osipsconsole resource file, osipconsolerc.

opensips-1:/etc/opensips # ls -l
total 20
-rw-r--r-- 1 root staff 1559 2009-10-09 16:59 dictionary.opensips
-rw-r--r-- 1 root staff 1559 2009-10-09 17:04 dictionary.opensips.
-rw------- 1 root staff 12437 2009-10-09 18:34 opensips.cfg
-rw-r--r-- 1 root staff 3661 2009-08-24 11:27 opensipsctlrc
-rw-r--r-- 1 root staff 2878 2009-05-19 14:02 osipsconsolerc

Modules (/lib/opensips/modules)

This directory contains all the modules compiled for OpenSIPS. It is where you should look for missing modules.

opensips-1:/lib/opensips/modules# ls

Binaries (/sbin)

This is where the binary files are found. It is useful to know where these directories are, in case you want to uninstall OpenSIPS.

openip s-1:/sbin# ls -l o p*
total 2832
-rwxr-xr-x 1 root staff 2594007 2009-10-09 17:04 opensips
-rwxr-xr-x 1 root staff 52695 2009-10-09 17:04 opensipsctl
-rwxr-xr-x 1 root staff 6270 2009-10-09 17:04 opensipsdbctl
-rwxr-xr-x 1 root staff 13442 2009-10-09 17:04 opensipsunix
-rwxr-xr-x 1 root staff 212692 2009-10-09 17:04 osipsconsole

Log files

The initialization log can be seen at syslog (/var/log) as follows:

Sep 10 14:25:56 Opensips-1 Opensips: init_tcp: using epoll_lt as the io watch
method (auto detected)
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: INFO: statistics manager
successfully initialized
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: StateLess module -
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: TM - initializing...
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: Maxfwd module- initializing
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: INFO:ul_init_locks: locks
array size 512
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: TextOPS - initializing
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: INFO: udp_init: SO_RCVBUF is
initially 109568
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: INFO: udp_init: SO_RCVBUF is
finally 262142
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: INFO: udp_init: SO_RCVBUF is
initially 109568
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7791]: INFO: udp_init: SO_RCVBUF is
finally 262142
Sep 10 14:25:56 Opensips-1 /sbin/Opensips[7792]: INFO:mi_fifo:mi_child_
init(1): extra fifo listener processes created

Redirecting OpenSIPS log files

By default, the log files are sent to the syslog and are shown at /var/log/syslog. Sometimes this is not good, because you have OpenSIPS logs mixed with other system's logs. You may redirect the logs to a specific file by changing the syslog configuration file.

Step 1: Redirecting log files to local 0 facility.

Change the opensips.cfg file and include the following command:


Step 2: Create the log file in the /var/log directory

cd /var/log
touch opensips.log

Step 3: Change the file /etc/syslog.conf and include the highlighted command.

lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
local0.* -/var/log/opensips.log

Step 4: Restart the syslog server and OpenSIPS and check the file /var/log/opensips.log.

/etc/init.d/sysklogd restart
/etc/init.d/opensips restart
cat /var/log/syslog

Startup options

OpenSIPS can be started using the init scripts or using the opensipsctl utility. If you start OpenSIPS using init scripts, you can stop OpenSIPS using init scripts only. The same is valid if you start using opensipsctl utility.

Starting, stopping, and restarting OpenSIPS using the init scripts:

/etc/init.d/opensips start|stop|restart

Starting, stopping, and restarting OpenSIPS using the opensipsctl utility:

opensipsctl start|stop|restart

The OpenSIPS executable has several startup options. The following options allow you to change the configuration of the DAEMON. Some of the most useful options are:

  • -c to check the configuration file
  • -D –E dddddd to check module loading (don't use for production, it binds only the first interface)

There are many other options that allow you to fine-tune your configuration. For each option, there is a related core parameter that you can put in the configuration file.

debian:/sbin# opensips -h
version: opensips 1.6.0-notls (i386/linux)
Usage: opensips -l address [-l address ...] [options]


-f     file                  Configuration file (default //etc/opensips/opensips.cfg)

-c                           Check configuration file for errors

-C                          Similar to '-c' but in addition checks the flags of exported

                              functions from included route blocks

-l                            address Listen on the specified address/interface (multiple -l  mean

                              listening on more addresses). The address format is

                              [proto:]addr[:port], where proto=udp|tcp

                              and  addr= host|ip_address|interface_name. E.g: -l locahost,

                               -l udp:, -l eth0:5062. The default behavior

                              is to listen on all the interfaces.

-n    processes      Number of child processes to fork per interface

                             (default: 8)

-r                          Use dns to check if is necessary to add a "received=" 

                             field to a via

-R                         Same as '-r' but use reverse dns;

                             (to use both use '-rR')

-v                         Turn on "via:" host checking when forwarding replies

-d                         Debugging mode (multiple -d increase the level)

-D                         Do not fork into daemon mode

-E                         Log to stderr

-T                         Disable tcp

-N    processes    Number of tcp child processes (default: equal to '-n')

-W                       method poll method

-V                        Version number

-h                         This help message

-b    nr                 Maximum receive buffer size which will not be exceeded by  auto-probing procedure even if OS allows

-m    nr                Size of shared memory allocated in Megabytes

-w    dir               Change the working directory to "dir" (default "/")

-t    dir                 Chroot to "dir" 

-u    uid                Change uid.

-g    gid                Change gid

-P    file                Create a pid file

-G   file                Create a pgid file.


In this article, you have learned how to install and prepare Linux for the OpenSIPS installation. We have downloaded and compiled OpenSIPS with the Radius and MySQL modules. After the installation, we included the OpenSIPS init file to start OpenSIPS at boot time.


If you have read this article you may be interested to view :


You've been reading an excerpt of:

Building Telephony Systems with OpenSIPS 1.6

Explore Title