onsip / SIP.js

A simple, intuitive, and powerful JavaScript signaling library
https://sipjs.com
MIT License
1.84k stars 693 forks source link

Support UDP and TCP transport for SIP communication #1042

Closed haricane8133 closed 1 year ago

haricane8133 commented 1 year ago

Is your feature request related to a problem? Please describe. I have a very old SIP server and that doesn't seem to support WebRTC and WebSockets.

Describe the solution you'd like I would very much love to use the SoftPhone I built with SIP.js to work with this old SIP server too. So SIP.js must have an option to support plain SIP over UDP or TCP.

Describe alternatives you've considered I have looked through the internet for a solution and haven't found any. I am having doubts whether this is something that JavaScript sitting in the browser can do.

Additional context I have built a SoftPhone using SIP.js and I have successfully used it with my Raspberry PI running Asterisk. It works flawlessly. I would love to have a softphone work with the old SIP server that doesn't support WebRTC and WebSockets.

Answer: TCP/UDP transport-based SIP isn't possible from the browser directly. Instead, we need to use a UDP/TCP to WebRTC convertor to be the medium.

tarxvftech commented 1 year ago

You may find #984 interesting, along with #169

haricane8133 commented 1 year ago

@tarxvftech, I think both of the solutions would require NodeJS and wouldn't work directly from the browser...

Are you aware of any solutions that would work from the browser?

seanbright commented 1 year ago

Direct access to UDP/TCP sockets is not provided by any browser that I am aware of. Obviously you get indirect access to TCP via WebSocket.

You could set up a SIP proxy (like Kamailio) that can accept WebSocket connections and proxy them to UDP/TCP but you’re not going to have any browser-native solutions for this.

haricane8133 commented 1 year ago

@seanbright, thanks for the answer. So, I think for my situation (described in the first comment), the only possible solution (and a fun project) would be to use a raspberry pi to "upgrade old PBX systems to support WebRTC", thereby making them work with SIP.js based softphones that run on the browser...