How to use a JS SIP library using a non-websockets transport?
Asked Answered
J

2

6

This question was asked by somebody on Quora here but there was no answer. Is there any work around solution for this, other than changing the source code of jsSip?

The issue is that most JS SIP libraries that work with webRTC do so through websockets (RFC 7118). ALso, Chrome now requires getUserMedia interface to be run on a https which imposes additional requirements on the SIP server side. The SIP server must also support websockets, SRTP, DTLS, etc.

All this makes sense if the SIP calls are made through a browser, either as a signalling mechanism for webRTC or non-webRTC telephony calls through a web page.

However, when the SIP server is on the local network and the SIP call has to be initiated from an app server, all these requirements are no longer applicable. It should be possible to make JS SIP calls over plain UDP without the need to run a http server with the SIP server as the http server in my case is integrated with the application server itself.

Scenario 1 as supported bymost JS SIP libraries:
JSSIP (in HTML page <------>websockets<---->[http-builtin with SIP server]<---->PSTN

Scenario 2 which applies to the question:
JSSIP (in HTML page <--https---->app-server with https-server<----local net--->[SIP server] <-----> PSTN  
Jeffreys answered 18/4, 2016 at 20:42 Comment(4)
Please check the update...Jeffreys
The reason the question was put on hold was because it was "unclear what you're asking", not because it was considered "off-topic". I'd recommend editing again and removing that last sentence to increase your chances of getting more reopen votes (you have 2/5 so far).Adrianeadrianna
@AmosM.Carpenter. Done.Jeffreys
What did you use in the end ?Icsh
R
1

It looks like you have built your own already, but I was looking for a similar thing and found this: https://github.com/davehorton/drachtio

I haven't tried it yet, but it is designed to be middleware on a nodejs server and it looks like it supports the older non websockets model.

Ruelu answered 19/5, 2017 at 2:5 Comment(1)
No I have not built one and this looks like THE solution. I will try it... Its the closest thing to what I was looking for, albeit a bit more than I wanted... I am accepting your answer.Jeffreys
O
-1

I would recommend to get a WebRTC to SIP gateway for this as this would solve all your issues. Using websocket or other protocol for signaling has nothing to do with media processing. You will still need DTLS/SRTP. Plain UDP/RTP will not work with WebRTC.

Othella answered 21/4, 2016 at 8:36 Comment(3)
I am looking for a JS library and not a gateway.Jeffreys
You will not find any JS library which will fullfill your "JS SIP calls over plain UDP" requirement. This is simply not possible. Browsers don't give you any API for plain UDP.Othella
I never asked for this API to be used in a browser! I want it to be used in my middleware app-server to talk to Asterisk over plain UDP. Anyhow, I finally decided to write one myself! I need support for only a subset of SIP methods and functionality. After researching thoroughly, I found multiple indirect solutions. For example, one can write a JS wrapper on top of the Nokia Sofia C API which I believe is transport agnostic or transport is easy to change.Jeffreys

© 2022 - 2024 — McMap. All rights reserved.