Showing posts with label nodejs. Show all posts
Showing posts with label nodejs. Show all posts

Wednesday, October 28, 2015

Kamailio Dispatcher Discovery Service with NodeJS and Etcd

An interesting resource for those relying on NodeJS for various needs and using Kamailio as load balancer in front of Asterisk or eventually other SIP systems (Freswitch, media servers, PSTN gateways, etc…):
Practically, this tool can be run along side with Kamailio and each SIP system (e.g., Asterisk), usingEtcd as communication channel to publish what SIP systems are available. Based on this information, the tool instance next to Kamailio is generating the dispatcher.list and instructs Kamailio to reload that file.
Etcd is a highly-available key value store for shared configuration and service discovery developed as part of CoreOS project.

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!