What is Opensips?

– OpenSIPS is an opensource software implementation of the Session Initiation Protocol for Voice over IP that can be used to handle voice, text and video communication.

– OpenSIPS is a multi-functional, multi-purpose signaling SIP server that can act as SIP Router/Switch, SIP Registrar, Application Server, Redirect Server, Load Balancer, Back- to-Back User Agent, Presence Server, IM Server, Session Border Controller, SIP Front- End, NAT traversal Server, IP Gateway (SMS, XMPP) and others.

– OpenSIPS is highly flexible, has an application interface and modules for effective application building, and high scalability.

– This blog will describe the steps to install current stable release Opensips-2.1 with PostgreSQL on Debian.

1) Install the Dependencies

– Update the source repository and package indexes to install the latest available pakcages
# apt-get update– Install the required packages for opensips
# apt-get install g++ bison lynx subversion flex git libxml2-dev ncurses-dev libcurl4-gnutls-dev libcurl4-penssl-dev libcurl4-nss-dev libxml2-dev libxslt1-dev python-dev libxml2-devlibxml2-dev libexpat1-dev perl libdbi-perl unixODBC unixODBC-dev libterm-readline-gnu-perl libncurses5-dev libdbd-pg-perl libfrontier-rpc-perl libberkeleydb-perl2) Download Opensips-2.1
# cd /usr/local/src
# git clone https://github.com/OpenSIPS/opensips.git -b 2.1 opensips_2_1
# cd opensips_2_1/

3) Compile Opensips
# make all– Open the configuration interface:
# make menuconfig– The text-based user interface will look like this:


– Press Right arrow key on the first option and goto the following sub menu:opensips_blog_2

– Pressing right arrow key will display list of modules where we need to select the modules along with module ‘db_postgres’ which we want to install:opensips_blog_3

– Once the modules’ selection is done, press left arrow key to go back to previous menu Select “Save Changes” and press enter. A list of suggested libraries and packages will show up at the bottom of the screen for help.

– Press left arrow key again to go back to main menu. Select “Compile And Install OpenSIPS” and press Enter. If everything goes well opensips will be installed successfully.

– Now install Opensips:
# make install[/vc_column_text][vc_column_text disable_pattern=”true” align=”left” margin_bottom=”0″]4) Create .pgpass file for PostgreSQL authentication

# cd /root
# touch ~/.pgpass
# vim .pgpass
# chmod 0600 /root/.pgpass
[/vc_column_text][vc_column_text disable_pattern=”true” align=”left” margin_bottom=”0″]5) Copy default and the int.d startup scripts to relevant directories
# cd /usr/src/opensips_2_1/packaging/debian/
# cp opensips.default /etc/default/opensips
– Edit the default file:
# vim /etc/default/opensips
# cp opensips.init /etc/init.d/opensips
– Edit init script and change below variables:
# vim /etc/init.d/opensips

6) DB Credentials Configurations
– Go to /usr/local/etc/opensips directory ,open the file opensipsctlrc and set below database parameters.
rutu_opensips7) Creating the Database
# /usr/local/sbin/opensipsdbctl create

– If you want to create a different database other than defined in DBNAME, you can run

# /usr/local/sbin/opensipsdbctl create your_custom_db_name

PGSQL password for root:
INFO: test server charset
INFO: creating database opensips …
INFO: Core OpenSIPS tables succesfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into opensips …
INFO: Presence tables succesfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist? (y/n): y
INFO: creating extra tables into opensips …
INFO: Extra tables succesfully created.
[/vc_column_text][vc_column_text disable_pattern=”true” align=”left” margin_bottom=”0″]8) Start/Stop Opensips service
# /etc/init.d/opensips start
# /etc/init.d/opensips stop
– We can check Opensips is running or not by the command
# netstat -pan |grep opensips

udp      0     0*    3359/opensips
udp      0     0*    3305/opensips

Related Post