Search code examples
sipvoipwebrtc

Incoming calls with SIP and WebRTC


I'm looking into implementing a browser-based VOIP solution that uses SIP and WebRTC and that connects to the PTSN. Basically, users give me their SIP credentials and I use WebRTC to acccess their microphone and speakers. On the page, I plan to run an SIP client.

How do I implement the incoming calls coming from the PTSN? Do I need some sort of listener that connects to the SIP server of the user?

I know this is a broad question but after doing some research online, I'm still somewhat confused about the SIP implementation of incoming calls.


Solution

  • You need a server that implements a SIP-WebRTC gateway. The gateway will be able to receive incoming calls from a SIP provider (which itself will be acting as a SIP-PSTN gateway by converting ISDN-SIP, SS7-SIP etc) via SIP and then forward the call to your browser based clients using WebRTC.

    Put another way your server needs to be a combination of a SIP server and a HTTP server and the HTTP server needs to support web sockets and the WebRTC API.

    If you haven't already take a look at the Phono SDK it's a good starting point.

    Update:

    Things have moved on a little bit since I last looked at WebRTC. There now do seem to be some SIP in javascript implementations around that leverage the new WebRTC APIs for the media side of things. A browser application using a SIP-javascript stack would not need any additional servers and could connect directly to an existing SIP server. One example I found is sip-js but I believe there are others around as well.