Incoming calls with SIP and WebRTC [closed]
Asked Answered
S

4

9

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.

Supposition answered 15/12, 2012 at 21:5 Comment(0)
P
5

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.

Phonics answered 15/12, 2012 at 23:49 Comment(4)
I've seen phono and I might go with that as the client-side implementation. I want my users go to google, type "voip SIP provider", and get an account from one of these provider. Once they get such an account, do these providers offer what you're talking about? Is is possible to avoid having my server involved in all this?Supposition
You may also want to look at sipML5.Denham
This tutorial for the WebRTC DataChannel also just popped up updates.html5rocks.com/tag/webrtc. Note that WebRTC doesn't mandat SIP at all, you can negotiate how you want to set up the data channels any way you want, SIP is just one option.Phonics
you can provide me a complete example or any tutorial. and how to work with WebRTC. How to add in eclipse, and how to acces in java class etcScopophilia
S
8

Maybe a refresh for this is worth the effort.

WebRTC is implemented now in Firefox and Chrome (and missing from IE, Edge and Safari).

For legacy SIP to WebRTC some conversions are needed. With WebRTC you can use anything for signaling usually over WebSocket. You can implement your proprietary protocol, however if you are looking for SIP compatibility then the most natural fit is the WebSocket to SIP protocol.

WebRTC encodes media in DTLS/SRTP so you will have to decode that also in clear RTP. This means that on the server side either you will use a softswitch with WebRTC support built-in or a WebRTC to SIP gateway. Make sure to select a softswitch/gateway with full media transcoding support. WebRTC currently supports G.711, G.722 and Opus. For legacy SIP network your server usually just selects G.711 and everything is perfect. In some circumstances you might have to convert the media to the other popular codec's such as G.729, G.723 or GSM.

Usually you have the following protocol coversions:

  • Signaling (this is simple): SIP over WebSocket in TLS -> clear SIP over UDP/TCP
  • Media (this is more complicated): DTLS/SRTP encoded RTP with PCMU -> clear RTP with PCMU

Softswitch with WebRTC support:

WebRTC to SIP gateways:

SIP (RFC 7118) capable WebRTC clients:

Also you should deploy and use your own STUN and TURN servers (some of the server/gateways have these built-in, otherwise use coturn rfc5766-turn-server).

Once the server side is up and running, you can easily create your custom client side solution based on the above webrtc clients since each of them has a simple to use JavaScript API.

Schumacher answered 13/3, 2016 at 19:57 Comment(0)
C
6

In theory, you can deploy a SIP server using an open source softswitch (FreeSWITCH, Asterisk) project and purchase "SIP trunking" service to obtain phone numbers and route calls to/from the PSTN. Then, you can configure a WebRTC SIP client to use your server. There are open source JavaScript libraries (SIP.js, JsSIP, sipML5).

That may be your best choice if you are working in small scale and quite used to running telecom infrastructure & purchasing trunking. In practice, running PSTN to WebRTC calls can be tough— lots of quality concerns. I also don't know at what scale you are looking to build your app, but over 100 simultaneous connections to your SIP server, and you'll need to deal with scaling. If you want a hosted solution to cut out the telecom hassle, you can use SIP.js and sign up for OnSIP (company supporting SIP.js), which is a pay-as-you-go service that will allow you to purchase phone numbers and just get coding your client. SIP.js user agent construction looks like this:

var userAgent = new SIP.UA({
  uri: '[email protected]',
  wsServers: ['wss://sip-ws.example.com'],
  authorizationUser: sipUsername,
  password: sipPassword
});

If you chose OnSIP (hosted), those credentials are provided by the service and register with OnSIP. If you choose to deploy your own SIP servers, you would change out accordingly.

Cullum answered 24/6, 2014 at 20:53 Comment(0)
P
5

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.

Phonics answered 15/12, 2012 at 23:49 Comment(4)
I've seen phono and I might go with that as the client-side implementation. I want my users go to google, type "voip SIP provider", and get an account from one of these provider. Once they get such an account, do these providers offer what you're talking about? Is is possible to avoid having my server involved in all this?Supposition
You may also want to look at sipML5.Denham
This tutorial for the WebRTC DataChannel also just popped up updates.html5rocks.com/tag/webrtc. Note that WebRTC doesn't mandat SIP at all, you can negotiate how you want to set up the data channels any way you want, SIP is just one option.Phonics
you can provide me a complete example or any tutorial. and how to work with WebRTC. How to add in eclipse, and how to acces in java class etcScopophilia
C
0

solution for your problem is:

  • Webrtc its self work as rtpengine.so using sip credential you can register your self with wss or ws to sip server.then you can make call to other sip user or outbound.
  • call will hit the sip server from there sip server decide weather its inbound call or outbound
Comeback answered 14/3, 2016 at 12:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.