Saturday 29 September 2012

Kamailio: SIP over WebSockets

There are a lot of really interesting things happening in the world of telecoms today.  One of the coolest is the work the IETF is doing on RTCWeb - that is media (audio and video) sessions between web-browsers without needing plugins.

RTCWeb is going to be a great enabler for all sorts of new types of web application (many of which haven't even been imagined yet) - but RTCWeb only focusses on the media part of communication.  In a lot of cases (particularly if telephony features or integration are required) the media alone isn't enough.  To this end Inaki Baz Castillo, Jose Luis Millan Villegas, and Victor Pascual have been working on an IETF draft, "The WebSocket Protocol as a Transport for the Session Initiation Protocol (SIP)" (draft-ietf-sipcore-sip-websocket-03).

There are now a number of implementations of SIP over WebSockets.  Servers include Asterisk, Kamailio, Mobicents SIP Servlets, OverSIP, and Repro/webrtc2sip.  Clients include jsSIP and sipML5.  This is not bad for a draft.

The Kamailio implementation of SIP over WebSockets (supporting both WebSockets (ws) and Secure WebSockets (wss)) has been available in the master branch of the SIP Router Git repository since early July 2012.  A number of people have tried using this and, aside from some configuration related issues, it appears to be working well.  I have tested (and seen others test) the Kamailio implementation with both the jsSIP and sipML5 clients.

If you want to try SIP over WebSockets, and you want to use it with a SIP server that supports lots of rich features (including scripting in Lua/Mono/Perl/Python, presence server, offline instant message handling, load-balancing, least-cost-routing, and far too many other things to list), Kamailio is an excellent place to start - there is even an example configuration file for SIP over WebSockets that is ready to go.