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

Asterisk Team (JIRA) noreply at issues.asterisk.org
Tue May 3 04:10:40 CDT 2022


    [ https://issues.asterisk.org/jira/browse/ASTERISK-30042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=259072#comment-259072 ] 

Asterisk Team commented on ASTERISK-30042:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

> 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
>
> When registering over WebSocket using SIP.js, res_pjsip_transport_websocket rewrites the {{random.invalid}} contact that is sent in the REGISTER request. The original {{random.invalid}} host is replaced by the apparent ip:port from where the requests came from. This is then stored as the contact uri.
> {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.25.12;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:5247;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/5555a9811f33df1f1461c9094a59b82307b25405/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.
> 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