VoIP News OnSIP News Announcements

SIP.js: Open Source, JavaScript SIP Stack for WebRTC Developers

by OnSIP

SIP.js is OnSIP's answer to developers who want to harness the power of SIP signaling in real time communications applications.

Published: April 7, 2014

OnSIP is happy to introduce SIP.js, our fork of the JsSIP JavaScript library. Why did we ultimately decide to fork off from JsSIP? We wanted a stack that would support more SIP standards— in particular, call forking. This allows WebRTC clients to initiate forked SIP calls. This also helped to minimize disruptions that occur during DTLS key exchanges, ICE, and STUN negotiations between WebRTC and legacy devices. Such disruptions include post-dial delays and ghost calls. The objective here was to speed up the negotiation process to minimize disruptions.

By employing pre-answering, FreeSWITCH can assign a provisional audio set up and then start DTLS and ICE negotiations before a person even answers the phone. Unfortunately, JsSIP does not natively support a pre-answering mechanism. So, our engineers forked JsSIP to add this functionality. This is how SIP.js was born. From there, we continued to expand the fork with projects such as InstaCall and GetOnSIP.

WebRTC demo phone with SIP.js
FreeSwitch SIP.js FlowRoute WebRTC Demo

FreeSWITCH recently released a FlowRoute WebRTC Demo powered by SIP.js. FreeSWITCH has always been a crucial component of OnSIP's core architecture. Our signaling, user location, and routing all happen on our distributed SIP proxies, and we use FreeSWITCH as dedicated application servers to enable this complex process. This allows us to distribute applications such as conferencing and call parking across many FreeSWITCH instances for scaling and redundancy purposes. The unique ability of FreeSWITCH, coupled with our robust SIP.js stack, has allowed us to successfully innovate many WebRTC products.

The odyssey of crafting SIP.js began this summer while the OnSIP team was working on GetOnSIP, our WebRTC-based videophone. After discovering that the JsSIP library could not fulfill our ambitions, our development team decided to modify the open source project to suit our own needs. The result, after months of tweaking, was a more robust JavaScript library with more SIP compliance. The SIP.js library helped us successfully launch GetOnSIP and InstaCall, the customizable button below that offers voice and video calls in a single mouse click.

"SIP.js is more SIP-centered than other JavaScript libraries," said OnSIP Software Engineer James Criscuolo. "By changing both the code structure and the coding terminology of the prior library, we were able to make SIP.js more SIP-compliant. We were also able to separate the original code between client and server, and simplify event emissions, which streamlined the process of incorporating projects such as GetOnSIP and InstaCall into our mature SIP platform."

Now we hope that our excursions into the wilderness of JavaScript and WebRTC development will be profitable for the community as a whole. We invite everyone to join us in this new open source phase of SIP.js's development, and we look forward to seeing what contributions its new users will make.