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 CentOS.

1) Install the Dependencies

– Update the source repository and package indexes to install the latest available packages
# yum update– Install the required packages for opensips
# yum install gcc-c++ bison lynx subversion flex git curl-devel libxslt libxml2-devel wget ncurses-devel libxml2-dev libmemcached libexpat1-devel unixODBC unixODBC-devel postgresql-devel

2) 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
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
# 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.

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