[asterisk-bugs] [JIRA] (ASTERISK-30042) res_pjsip_transport_websocket: Registration over websocket returns a rewritten contact

Asterisk Team (JIRA) noreply at issues.asterisk.org
Thu Jun 16 15:01:54 CDT 2022


     [ https://issues.asterisk.org/jira/browse/ASTERISK-30042?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asterisk Team updated ASTERISK-30042:
-------------------------------------

    Target Release Version/s: 18.13.0

> res_pjsip_transport_websocket: Registration over websocket returns a rewritten contact
> --------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-30042
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30042
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_registrar, Resources/res_pjsip_transport_websocket
>    Affects Versions: 18.7.1
>            Reporter: Thomas Guebels
>            Assignee: Thomas Guebels
>      Target Release: 16.27.0, 18.13.0
>
>
> When registering over WebSocket using SIP.js, res_pjsip_transport_websocket rewrites the {{k2km30gagse1.invalid}} host in the contact that is sent in the REGISTER request. The original host is replaced by the apparent ip:port from where the request came from. This is then stored as the contact uri in res_pjsip.
> {code}
> REGISTER sip:dev.elan.escaux.com SIP/2.0
> Via: SIP/2.0/WSS k2km30gagse1.invalid;branch=z9hG4bK6030502
> To: <sip:identity at localhost>
> From: <sip:identity at localhost>;tag=31mhoq79ir
> CSeq: 3 REGISTER
> Call-ID: o5n3ln3aog19bdpt5bv6
> Contact: <sip:bhe74v8j at k2km30gagse1.invalid;transport=ws>;expires=600
> User-Agent: SIP.js/0.20.0
> {code}
> In the REGISTER response, this rewritten contact is sent back to SIP.js, triggering the following error, as SIP.js can't find back the contact it tried to register.
> {code}
> SIP/2.0 200 OK
> Via: SIP/2.0/WSS k2km30gagse1.invalid;rport=42956;received=172.16.123.123;branch=z9hG4bK4399238
> To: <sip:identity at localhost>;tag=z9hG4bK4399238
> From: <sip:identity at localhost>;tag=31mhoq79ir
> Call-ID: o5n3ln3aog19bdpt5bv6
> CSeq: 3 REGISTER
> Contact: <sip:bhe74v8j at 172.16.123.123:42956;transport=ws>;expires=599
> Server: Asterisk PBX 18.7.1
> {code}
> bq. No Contact header pointing to us, dropping response
> from https://github.com/onsip/SIP.js/blob/master/src/api/registerer.ts#L421
> It is worth noting that this doesn't happen with the default SIP.js config in which it is more lenient and only verifies the user part of the contact. However, when you specify a custom contact user in the its configuration, it does the full check user at ip:port as per the RFC. This probably explains why one doesn't encounter that bug right away when trying SIP.js + asterisk. See https://github.com/onsip/SIP.js/blob/master/src/api/registerer.ts#L401
> I tested a fix which is to save the original contact host in an x-ast-orig-host contact parameter, pretty much like it is done in res_pjsip_nat. It fixes my problem. If you think it is the right way to solve this I can provide a patch.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list