SIP.js with Outbound Proxy using WebRTC

625 views
Skip to first unread message

Peter Manley

unread,
Apr 6, 2021, 6:16:10 PM4/6/21
to SIP.js
Hello,

We have an application where we want our WebRTC softphone to interact with a SIP server (in this case a VICI dialer based on Asterisk), but have SIP traffic routed through an outbound proxy. Can you provide guidance on how we would set this up using SIP.js?

Thanks and regards,

Peter Manley

Slavik Bialik

unread,
Apr 7, 2021, 2:52:02 PM4/7/21
to SIP.js
You cannot send SIP directly with SIP.js, you must have a Web socket server and SIP.js will connect to this web socket and send the SIP over WSS.
I would recommend using Kamailio / OpenSIPS, good open source SIP proxies which also have web socket modules that you can enable.

Peter Manley

unread,
Apr 7, 2021, 3:11:56 PM4/7/21
to SIP.js
Thanks - we are connecting to a Kamailio Proxy using SIP over WSS. My question is more like how do you set this up in SIP.js? Do you specify the Outbound Proxy to be the server in the transportOptions when configuring the userAgentOptions? Or is there another way to specify the intermediate Outbound Proxy?

Regards,

Peter Manley

Slavik Bialik

unread,
Apr 7, 2021, 3:58:23 PM4/7/21
to SIP.js
Ahhh, so yes, you are correct regarding passing the web socket URL in transportOptions when configuring the UserAgentOptions, like this:

const transportOptions: TransportOptions = {
server: "wss://sip.domain.com:8443"
};

const userAgentOptions: UserAgentOptions = {
authorizationPassword: pass,
authorizationUsername: username,
contactName: username,
viaHost: userDomain,
transportOptions,
uri
};

But the above is not enough.
When you're making a SIP request (like an INVITE) towards your SIP server itself, you just create the target URI with your SIP domain / IP address and port and pass it to the Inviter object (for example), and Kamailio must know how to relay the request according to your request URI.
Because the WSS URL is not related to the SIP domain / IP of your server that you want to contact to make a REGISTER or place an INVITE.
Hope I explained better now.

Peter Manley

unread,
Apr 7, 2021, 4:53:13 PM4/7/21
to SIP.js
Yes - Perfectly. Thank you!

Regards,

Peter Manley

Peter Manley

unread,
Apr 7, 2021, 5:15:28 PM4/7/21
to SIP.js
Is there a way to piggy back the WSS URL of the target Registrar server into the SIP REGISTER/INVITE messages so that the Outbound Proxy can be agnostic? Or does it have to have the target WSS URL hard coded (or through a Look Up Table) based on the target Request URI?

Regards,

Peter M.

Reply all
Reply to author
Forward
0 new messages