Posts Tagged ‘sip’

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 😀

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.