Monday, September 7, 2015

Async SIP Routing with Kamailio and Node.js

One of the interesting modules added in Kamailio v4.3 is rtjson – in short, it defines a JSON document format that can be used to specify and push destination addresses when routing a SIP request. It is very handy when the attributes for routing are decided by an external application.
A tutorial about using a Node.js application to decide the routing for a SIP request has been published at:
The next diagram shows the relation between SIP, Kamailio and Node.js application.
kamailio-evapi-rtjson-nodejs
The relevant components used inside Kamailio are:
  • evapi module – to asynchronously send/receive data to/from Node.js (i.e., don’t block Kamailio, allow to handle other traffic meanwhile)
  • rtjson module – to fill in the internal fields corresponding to the routing attributes returned by the Node.js application
  • jansson module – to access the rtjson document in kamailio.cfg for additional processing
Using this architecture, one can built external SIP routing decision engines for Kamailio that suits better various contexts. For example, do least cost routing or load balancing selection, access control policy, fraud protection, etc. inside the external application, instead of using the existing modules.
Depending on the needs, using such architecture could fit better, especially when dealing with lots of SIP server nodes. Of course, Node.js platform can be replaced by any other application, standalone or on top of a framework.
Read the content of the tutorial at:
Enjoy!

No comments:

Post a Comment