Posts Tagged ‘opensips’

OpenSER/OpenSIPS is well known as a robust, powerful SIP server. But one big lack of OpenSER/OpenSIPS is that it doesn’t have a gateway interface to PSTN network. In this case, you’ll have some options. You can use a router with an FXS/FXO card or using Asterisk with Digium cards as a gateway server.

If you’re choosing to use Asterisk with Digium cards as a gateway server, you’ll need to route certain calls destination (such as to PSTN) to this server to be forwarded to PSTN network later. To add a route in OpenSER/OpenSIPS, you can edit openser.cfg or opensips.cfg.

Don’t be afraid editing these files, but don’t forget to always make a backup 😀

Openser.cfg or opensips.cfg consists of four main parts:

Global parameter

This section is used to set common configuration such as logging, debugging, fork

Module loading

OpenSER/OpenSIPS modules will be loaded here

Module parameter

Each module have parameters which will be configured here


Routing section is used to configure routing of incoming SIP messages

Route certain calls will be added in routing section. Because SIP uses INVITE to initiate a call, you’ll need to find this line:

# account only INVITEs

if (is_method(“INVITE”)) {

setflag(1); # do accounting


We will use prefix based routing to difference calls. For example, if you use destination number with prefix of 8 to be routed to Asterisk with IP address, the routing script will be like this:

if (is_method(“INVITE”)) {

if(uri=~”^sip:[8] @*”) {




setflag(1); # do accounting


The function rewritehostport is used to replace the destination host and port of an SIP message header. The uri=~”^sip:[8] @*” will be match to any calls to destination number with prefix of 8 and any SIP server host.

Better try to know more 😀

This is long time draft before being published,,,,

You may known that OpenSIPS is the project continuation of OpenSER, tough Kamailio is said to be closer to OpenSER. But after all, it’s all about taste,,lol 😀

OpenSIPS will be best deployed on Sun machine running Solaris OS to obtain it’s best performance. But installing on Debian or Ubuntu machine will much easier. OpenSIPS modules depend on various package which is hard to get for Solaris. Debian or Ubuntu will be the best OS for installing practice. To get familiar with OpenSIPS, you’ll may need to practice installing too :D.

OpenSIPS is recommended to install with DNS. So that you wouldn’t have a lot of changes to move the system from a machine to another. These steps I’ve used to build a presence system server with TLS enabled. If you don’t need any presence enabled, you may leave mi_xmlrpc, xcap_client, presence, presence_xml, presence_mwi, presence_dialoginfo, pua, pua_bla, pua_mi, pua_usrloc, pua_xmpp,  pua_dialoginfo, and TLS=1 commented.
It’s hard to find a good OpenSIPS installation tutorial, so I try to write these steps which is work for me. Hopefully these steps will help you much 😀

1. sudo apt-get install bison bison++ bisonc++
2. sudo apt-get install flex
3. sudo apt-get install libsctp1
4. sudo apt-get install mysql-server
5. sudo apt-get install libmysqlclient-dev
6. sudo apt-get install libxml2-dev
7. sudo apt-get install libexpat1-dev
8. sudo apt-get install libradius-ng2 libradius-ng-dev
9. sudo apt-get install libcurl3-dev
10. sudo apt-get install libxmlrpc-c3 libxmlrpc-c3-dev
11. sudo apt-get install libperl-dev
12. sudo apt-get install libsnmp-dev
13. sudo apt-get install libconfuse0 libconfuse-dev
14. sudo apt-get install build-essential
15. sudo tar xvfz opensips-1.5.0-tls_src.tar.gz
16. edit opensips-1.5.0-tls/Makefile/
change : #TLS=1
to : TLS=1
remove : – jabber
– cpl-c
– xmpp
– rls
– mi_xmlrpc
– xcap_client
– db_mysql
– presence
– presence_xml
– presence_mwi
– presence_dialoginfo
– pua
– pua_bla
– pua_mi
– pua_usrloc
– pua_xmpp
– pua_dialoginfo
– perl
– snmpstats
– peering
– carrierroute
from : exclude_modules=
17. sudo make
18. sudo make install
19. sudo cp opensips-1.5.0-tls/packaging/debian-etch/opensips.default /etc/default/opensips
sudo cp opensips-1.5.0-tls/packaging/debian-etch/opensips.init /etc/init.d/opensips
20. sudo nano /etc/default/opensips
change : RUN_OPENSIPS=no
21. sudo nano /etc/init.d/opensips
change : DAEMON=/usr/sbin/opensips
to : DAEMON=/usr/local/sbin/opensips
22. sudo chmod +x /etc/init.d/opensips
23. sudo groupadd opensips
sudo useradd -g opensips opensips
24. sudo mkdir /var/run/opensips
sudo chmod 777 /var/run/opensips
25. sudo chmod 777 /usr/local/etc/opensips/
26. sudo apt-get install bind9
27. sudo nano /etc/bind9/named.conf
add : zone “” {
type master;
file “/etc/bind/db.opensips”;

zone “” {
type master;
file “/etc/bind/db.18.14.10″;
28. Create new RR file

sudo nano /etc/bind9/db.opensips
write :

; BIND data file for
$TTL 604800
@ IN SOA (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
29.  Create new RR file

sudo nano /etc/bind9/db.18.14.10
add :

; BIND data file for
$TTL 604800
@ IN SOA (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
30. sudo nano /etc/bind9/named.conf.option
add : recursion no;
in : option { }
31. sudo /etc/init.d/bind9 restart
32. sudo nano /usr/local/etc/opensips/opensipsctlrc
uncomment : #
# DBHOST=localhost
# DBNAME=opensips
# DBRWUSER=opensips
# DBRWPW=”opensipsrw”
# DBROUSER=opensipsro
# DBROPW=opensipsro
# USERCOL=”username”
uncomment and change :
# PID_FILE=/var/run/
to : PID_FILE=/var/run/opensips/
33. sudo mysqladmin -u root password ‘root’
34. sudo opensipsdbctl create
35. sudo nano /usr/local/etc/opensips/opensips.cfg
uncomment : #loadmodule “”
#loadmodule “”
#loadmodule “”

#modparam(“usrloc”, “db_mode”, 2)
#modparam(“usrloc”, “db_url”,
# “mysql://opensips:opensipsrw@localhost/opensips”)

#modparam(“auth_db”, “calculate_ha1”, yes)
#modparam(“auth_db”, “password_column”, “password”)
#modparam(“auth_db”, “db_url”,
# “mysql://opensips:opensipsrw@localhost/opensips”)

comment : modparam(“usrloc”, “db_mode”, 0)
36. sudo nano mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO opensips@localhost IDENTIFIED BY ‘opensipsrw’;
mysql> GRANT ALL PRIVILEGES ON *.* TO opensips@ IDENTIFIED BY ‘opensipsrw’;
37. start opensips, choose one of these method:
1. sudo opensipsctl start
2. sudo /etc/init.d/opensips start
38. sudo opensipsctl add 1001 1001

You can use any kind of SIP client you have. These install will be default enable your SIP chat.

Comment me if you have any error on installation. Feel free to try 😀

OpenSIPS is implementation of SIP server based on RFC 3261. OpenSIPS is a robust SIP server which has powerful-customized routing engine. OpenSIPS components implemented as modular element which are not depends each other. OpenSIPS is formerly the Openser -Open SIP Express Router. The Openser project stops and continue into two branches: OpenSIPS (Open SIP Server) and Kamailio. Both new projects are mainly has the same components as Openser.

We will discuss Opensips this time -Kamailio next time maybe 😀 .

Opensips will be fits in these scenarios:

  • VoIP service providers (residential)
  • SIP trunking
  • SIP load-balancing
  • SIP front-end (for SIP termination)
  • white-label solutions
  • enterprise services
  • SIP router (LCR for multi GWs)

Opensips can play many roles in VoIP network:

  • SIP registrar server
  • SIP router / proxy (lcr, dynamic routing, dialplan features)
  • SIP redirect server
  • SIP presence agent
  • SIP IM server (chat and end-2-end IM)
  • SIP to SMS gateway (bidirectional)
  • SIP to XMPP gateway for presence and IM (bidirectional)
  • SIP load-balancer or dispatcher
  • SIP front end for gateways/asterisk
  • SIP NAT traversal unit
  • SIP application server

OpenSIPS has much more features compared with another SIP server. Full documentation about OpenSIPS features can be found here. Mainly, these are the OpenSIPS features

  • robust and performant SIP (RFC3261) Registrar server, Location server, Proxy server and Redirect server
  • support for UDP/TCP/TLS/SCTP transport layers
  • IPv4 and IPv6
  • IP Blacklists
  • flexible and powerful scripting language for routing logic
  • management interface via FIFO file and unix sockets
  • authentication, authorization and accounting (AAA) via database (MySQL, Postgress, text files), RADIUS and DIAMETER
  • digest and IP authentication
  • Presence Agent support (many additional integration features)
  • XCAP support for Presence Agent
  • SNMP – interface to Simple Network Management Protocol
  • management interface (for external integration) via FIFO file, XMLRPC or Datagram (UDP or unixsockets)
  • NAT traversal support for SIP and RTP traffic
  • ENUM support
  • PERL Programming Interface – embed your extensions written in Perl
  • Java SIP Servlet Application Interface – write Java SIP Servlets to extent your VoIP services and integrate with web services
  • load balancing with failover
  • modular architecture – plug-and-play module interface to extend the server’s functionality
  • gateway to sms (AT based)
  • multiple database backends – MySQL, PostgreSQL, Oracle, Berkeley, flat files and other database types which have unixodbc drivers
  • XMPP gateway-ing ( transparent server-to-server translation)
  • OpenSIPS can run on embedded systems, with limited resources – the performances can be up to hundreds of call setups per second
  • used a load balancer in stateless mode, OpenSIPS can handle over 5000 call setups per second
  • on systems with 4GB memory, OpenSIPS can serve a population over 300 000 online subscribers

OpenSIPS deal with low resource usage, but still hampered in interconnection to PSTN network. Unlike Digium which give full support to Asterisks as PSTN gateway with Digium cards, OpenSIPS doesn’t have that support yet. But OpenSIPS developer still working hard to make interconnection to PSTN network possible with OpenSIPS.

Let’s hope their work finish soon…  😀

Sign up for PayPal and start accepting credit card payments instantly.