Node.js – Asterisk + Node.js + Browser Streaming

asterisknode.jsstreamingvoip

I would like to build a service that allows a user to listen to a call live from their browser.

I have some experience with Asterisk and this seems to be flexible enough to do what I have described.

Node.js sounds good because it is purported to handle concurrency well, and, I like JavaScript.

In the browser I figure that the HTML5 audio tag, since it handles playing from a streaming source, would be fine to play the sound.

A colleague of mine worked together a demo of this concept using Icecast, but was not able to finish it. There were also significant latency isssues.

My question is this:

How should I go about getting started on this?

Any help is appreciated!

Update:

I found a presentation discussing implementing SIP on top of WebSockets via a SIP proxy on the backend:

http://sip-on-the-web.aliax.net/

Once I have this up and running, the next step would be implementing the streaming. It seems like I should be able to proxy the audio output that would normally go to the sip client, through a secondary server that then streams it to the browser. I wonder why this couldn't be done all in memory? Then there is no need to write and read the file as the call proceeds.

Best Answer

If you're willing to wait for Asterisk 11, we're currently working on implementing support for WebSockets directly in Asterisk. More on it here:

Asterisk 11 WebRTC/RTCWeb Support

I'll just quote Kevin here, since he summarizes it better then I can:

"Today, the in-progress development branches have support for the WebSocket transport protocol (used for communicating signaling messages between the browser and Asterisk), SIP over WebSocket (currently being standardized by the IETF) and ICE/STUN/TURN (media handling mechanisms for NAT traversal and connection setup security). In addition, there’s a new Jingle/Google Talk/Google Voice channel driver, and we plan to support Jingle over WebSocket as well. At this point, we don’t have a quite complete solution (a new Canary build of the Google Chrome browser is needed with a few small changes), but each of the pieces has been tested and we’re anxious to see it all work together. We’d like to thank Iñaki and José from the SIP-on-the-Web project for providing us their JavaScript SIP stack to use during our testing, and we’ll probably be testing with the PhonoSDK as well for Jingle support."