OpenSIPs installation with PostgreSQL on Debian

OpenSIPs installation with PostgreSQL on Debian

OpenSIPs Installation with PostgreSQL on Debian
March 31, 2016

What is OpenSIPS?

As you are reading this blog post, you must already know what OpenSIPs is, but still, it is good to take a look at this powerful VoIP development technology before we jump into an installation guide.

OpenSIPs is an acronym for Open Session Initiation Protocol Server. It is very popular among open source VoIP community members and top VoIP development companies as a multipurpose and multifunctional SIP server. It can also operate as a signaling server and it can be used in multiple applications with custom OpenSIPs development such as:

  • SIP Registrar
  • SIP Router/Switch
  • SIP Switch
  • SIP Frontend
  • Back-to-Back User Agent
  • IP Gateway (SMS, XMPP)
  • Redirect Server
  • Presence Server
  • Application Server
  • IM Server
  • NAT traversal Server
  • Load Balancer
  • Session Border Controller

Our OpenSIPs expertise helps telephony businesses harness its real power

We are a leading OpenSIPs development company that has a team of highly experienced and skilled OpenSIPs developers. We let companies and VoIP service providers hire OpenSIPs developers for their telephony projects. We also provide various services in this VoIP development technology such as:

  • Consultation
  • Custom developer
  • SIP server setup
  • Load balancer development and deployment
  • Custom OpenSIPs software development
  • Customization to an existing OpenSIPs solution
  • Support and maintenance services
  • And more

Along with the expert OpenSIPs services, we also offer installation and deployment services for this platform and other solutions developed using this VoIP development technology.

– 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-perl

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:

– 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:

– 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
localhost:5432:opensips:postgres:password
# 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
RUN_OPENSIPS=yes
# cp opensips.init /etc/init.d/opensips
– Edit init script and change below variables:
# vim /etc/init.d/opensips
DAEMON=/usr/local/sbin/opensips
CFGFILE=/usr/local/etc/opensips/opensips.cfg

6) DB Credentials Configurations
– Go to /usr/local/etc/opensips directory ,open the file opensipsctlrc and set below database parameters.

7) 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 192.168.1.88:5060    0.0.0.0:*    3359/opensips
udp      0     0 192.168.1.88:5060    0.0.0.0:*    3305/opensips

Do you need expert help for the installation of the latest release of OpenSIPs with PostgreSQL on Debian or do you need any help with OpenSIPs telephony projects, we can help. To initiate a conversation, contact us.

Related Post