OpenSIPS as a WSS gateway, seeing contact as sip:b3f4tprk@avffu40d9e7f.invalid;transport=ws

1,045 views
Skip to first unread message

jhu...@voxboxcoms.co.uk

unread,
Apr 5, 2017, 8:11:54 AM4/5/17
to SIP.js
Hi Guys,

I have been using SIP.js with oversip and it works great, however now Im looking to use it with openSIPS version 2.2 over WSS.

I can get the SIP.js client (version 0.7.7) to register fine, however even if I define the SIP uri for it, it still registers with .invalid in the domain;

sip:b3f4...@avffu40d9e7f.invalid

And OpenSIPs can resolve this, I have tried the hackIpInContact, but as you guys know that populates a random IP.

Is this down to configuration? As Ideally I want it to use a valid domain for the contact, be it the IP address it originates from etc.

Is this possible?

Many thanks

Jon

Eric Tamme

unread,
Apr 5, 2017, 9:32:15 AM4/5/17
to SIP.js, jhu...@voxboxcoms.co.uk
Hey Jon,

You need to do some work on the OpenSIPS side to save, or forward, the appropriate contact.  WSS/WS need similar fixes as user agents behind a NAT because they are not presenting the actual socket in the contact URI.  If you are using OpenSIPS as both your WSS/WS server and registrar, you need to call fix_nated_register() on the REGISTER requests coming from WS clients.  If you are using OpenSIPS as a non-adjacent registrar, then you need to add add a path header to REGISTER requests, as well as calling fix_nated_contact for ALL requests and responses coming from your WS UA traversing OpenSIPS.  

I have put together a reference implementation config of OpenSIPS on github called "federated-sip" that may provide further guidance for you. 


It is worth noting that this implementation is a direct WSS server and registrar, NOT a non adjacent registrar.

-Eric


On Wednesday, April 5, 2017 at 6:11:54 AM UTC-6, jhu...@voxboxcoms.co.uk wrote:
Hi Guys,

I have been using SIP.js with oversip and it works great, however now Im looking to use it with openSIPS version 2.2 over WSS.

I can get the SIP.js client (version 0.7.7) to register fine, however even if I define the SIP uri for it, it still registers with .invalid in the domain;

 sip:b3f4tprk@avffu40d9e7f.invalid

Jonathan Hunter

unread,
Apr 5, 2017, 10:18:15 AM4/5/17
to Eric Tamme, SIP.js
Hi Eric,

Thanks for the response! And yes I am using OpenSIPs as the direct WSS server and registrar and was calling fix_nated_contact for the registration but not all requests and responses!

That would appear to be my issue, I will look at your reference configuration and see how I go.

Thank you very much for the response.

Jon

On Wed, Apr 5, 2017 at 2:32 PM, Eric Tamme <eric....@onsip.com> wrote:
Hey Jon,

You need to do some work on the OpenSIPS side to save, or forward, the appropriate contact.  WSS/WS need similar fixes as user agents behind a NAT because they are not presenting the actual socket in the contact URI.  If you are using OpenSIPS as both your WSS/WS server and registrar, you need to call fix_nated_register() on the REGISTER requests coming from WS clients.  If you are using OpenSIPS as a non-adjacent registrar, then you need to add add a path header to REGISTER requests, as well as calling fix_nated_contact for ALL requests and responses coming from your WS UA traversing OpenSIPS.  

I have put together a reference implementation config of OpenSIPS on github called "federated-sip" that may provide further guidance for you. 


It is worth noting that this implementation is a direct WSS server and registrar, NOT a non adjacent registrar.

-Eric


On Wednesday, April 5, 2017 at 6:11:54 AM UTC-6, jhu...@voxboxcoms.co.uk wrote:
Hi Guys,

I have been using SIP.js with oversip and it works great, however now Im looking to use it with openSIPS version 2.2 over WSS.

I can get the SIP.js client (version 0.7.7) to register fine, however even if I define the SIP uri for it, it still registers with .invalid in the domain;

 sip:b3f4...@avffu40d9e7f.invalid

And OpenSIPs can resolve this, I have tried the hackIpInContact, but as you guys know that populates a random IP.

Is this down to configuration? As Ideally I want it to use a valid domain for the contact, be it the IP address it originates from etc.

Is this possible?

Many thanks

Jon




--
Jonathan Hunter
Technical Director /Telephony Developer

Eric Tamme

unread,
Apr 5, 2017, 10:19:56 AM4/5/17
to Jonathan Hunter, SIP.js
For registrations you need to do fix_nated_register.  See this section of federated sip for more details: https://github.com/etamme/federated-sip/blob/ansible/templates/opensips.cfg.j2#L260

-Eric

Jonathan Hunter

unread,
Apr 5, 2017, 1:26:34 PM4/5/17
to Eric Tamme, SIP.js
Hey Eric,

Just to let you know your configuration recommendations fixed, I just need to trouble shoot no audio on inbound calls now, outbound work with 2 way audio so I am getting closer.

There also appears to be a delay when answering on the client, but again Im troubleshooting.

Thanks again!

Jon

Eric Tamme

unread,
Apr 5, 2017, 1:32:48 PM4/5/17
to Jonathan Hunter, SIP.js
Hey Jon,

My reference implementation also makes use of RTPEngine as a turn relay or host candidate (depending on the situation) as well as doing DTLS-SRTP interop with endpoints that are not capable of DTLS-SRTP.  The delay you are experiencing is likely due to ICE negotiation, and STUN binding occurring after the far end answers, this can be caused by a lot of candidates (many IP's on your local, or the remote machine) but SIP.js does provide some timeout mechanisms for ICE/STUN.  Check the branch_route and reply route for relevant RTPEngine information, as well as the tutorial I wrote on the OpenSIPS website  http://www.opensips.org/Documentation/Tutorials-WebSocket-2-2

-Eric

Jonathan Hunter

unread,
Apr 5, 2017, 3:52:29 PM4/5/17
to Eric Tamme, SIP.js
hey Eric,

Thanks again for the documentation, really good guides.

I am using rtpengine and still having audio issues, I just wondered what arguments I should be adding when running the RTP engine, as I am currently just running with;

rtpengine --interface=PublicIP --listen-ng=PublicIP:12221 -m 40000 -M 50000 --tos=184

I get no audio in either direction when using google chrome,  and in rtpengine logs Im seeing;

Unknown STUN attribute: 0xc057
 SRTP output wanted, but no crypto suite was negotiated

opensips configuration appears to be as your guide, do you have any final tips for sorting out no audio issues?

Im sorry to ask a further question, this will be the last as appreciate your prompt responses.

Jon

Eric Tamme

unread,
Apr 5, 2017, 4:02:16 PM4/5/17
to Jonathan Hunter, SIP.js
You need to understand the offer answer model and supply the appropriate flags to RTPEngine depending on the capabilities of the UAC and UAS involved.  There is no single answer as to the flags that should be specified in the branch route, and reply route, as you can see they are quite conditional in my federated-sip reference implementation, and they should generally cover interop between two browsers, a browser and a legacy voip phone, and two legacy voip phones.  

The command line arguments to start rtpengine are completely unrelated to how rtpengine will handle offer/answers etc.  If it starts, and opensips can contact it when it starts ... then you are probably good.

I can't really say much about your error except that it sounds like you tried to pass a flag indicating RTP-SAVPF (DTLS-SRTP), however there was no crypto suite offered by either party ... not exactly sure how that happened frankly (assuming you are using two browsers).

-Eric

Jonathan Hunter

unread,
Apr 7, 2017, 6:05:36 AM4/7/17
to Eric Tamme, SIP.js
Hi Eric,

Thanks for the help, was an issue with the server I had rtpengine running on.

All works great now, thanks for the help!

Jon
Reply all
Reply to author
Forward
0 new messages