[Home]

Summary:ASTERISK-28876: Wrong next hop for INVITEs with PJSIP and PATH
Reporter:Serge (zeusca)Labels:
Date Opened:2020-05-07 10:37:29Date Closed:2020-05-07 11:02:01
Priority:MinorRegression?
Status:Closed/CompleteComponents:pjproject/pjsip
Versions:13.18.3 Frequency of
Occurrence
Constant
Related
Issues:
duplicatesASTERISK-28211 chan_pjsip: Path header is not used with PJSIP_DIAL_CONTACTS
Environment:Linux 2.6.32-39-pve x86_64 x86_64 x86_64 GNU/LinuxAttachments:
Description:When endpoints register via an edge proxy in front of Asterisk running PJSIP, the edge proxy adds a PATH header (https://www.rfc-editor.org/rfc/rfc3327.txt) so that Asterisk knows how to route out-of-dialog requests back to the proxy.

When calling that endpoint, it appears though that INVITEs are sent to the Contact URI directly instead of being sent to the proxy with a preset Route header. Strangely, this happens only to INVITEs. Other requests such as the OPTIONS qualify initiated by Asterisk are sent correctly to the proxy with the proper Route header.

When using chan_sip this problem does not occur.

Asterisk certified/13.18-cert3
PJ_VERSION : 2.7.2
AOR/support_path : true
Endpoint/rewrite_contact : false
Endpoint/force_rport : false
Comments:By: Asterisk Team (asteriskteam) 2020-05-07 10:37:29.513-0500

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.

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.

By: Serge (zeusca) 2020-05-07 10:39:56.578-0500

PJSIP has a outbound_proxy parameter for AoRs. When I add it such as:
outbound_proxy=sip:proxy.somedomain.net;lr
my phone starts ringing, routing of INVITEs works!

However, Asterisk’s quality OPTIONS and other request methods now have two Route headers, one from the set outbound_proxy and the other from the PATH header.

Route: sip:proxy.somedomain.net;lr
Supported: path
Route: sip:proxy.somedomain.net;lr;received=sip:107.xx.xx.xx:59209

Why is it that with PJSIP an outbound_proxy needs to be set at all, considering that a PATH header has been added during Registration and according to RFC3327 (https://www.rfc-editor.org/rfc/rfc3327.txt) should be used for all type of requests when trying to communicate with the registered Contact?

Thanks.

By: Serge (zeusca) 2020-05-07 10:58:44.382-0500

The OPTIONS (asterisk qualifies) have the right Route header and are sent to the right next hop (edge proxy):

U 2020/05/07 11:49:06.242868 PBXIP:5060 -> PROXYIP:5060
OPTIONS sip:777@192.168.2.100:56859;rinstance=0ea0111d4d7fe2b9 SIP/2.0
Via: SIP/2.0/UDP PBXIP:5060;rport;branch=z9hG4bKPj7964a211-2840-4ec5-a4b4-b7818d329727
From: <sip:777@PBXIP>;tag=e129bd14-9bf1-4532-a7c5-a9ee5f7fae97
To: <sip:777@192.168.2.100;rinstance=0ea0111d4d7fe2b9>
Contact: <sip:777@PBXIP:5060>
Call-ID: c4f41755-4394-48fb-9e6b-26f3191331b3
CSeq: 19787 OPTIONS
Supported: path
Route: <sip:proxy.mydomain.net:5060;lr;received=sip:173.XX.XX.XX:56859>
Max-Forwards: 70.
User-Agent: Asterisk
Content-Length:  0

The INVITE is sent incorrectly to the Contact URI directly, no Route header present:

U 2020/05/07 11:54:36.139189 PBXIP:5060 -> 192.168.2.100:56859
INVITE sip:777@192.168.2.100:56859;rinstance=0ea0111d4d7fe2b9 SIP/2.0
Via: SIP/2.0/UDP PBXIP:5060;rport;branch=z9hG4bKPj95dc5492-818d-484d-bde3-e44815fda513
From: "MYID" <sip:3051111111@PBXIP>;tag=516f16a6-a417-4ea5-8592-46978dfd0372
To: <sip:777@192.168.2.100;rinstance=0ea0111d4d7fe2b9>
Contact: <sip:asterisk@PBXIP:5060>
Call-ID: 20e29359-4b51-46bf-9f34-86337773f0a1
CSeq: 20715 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub, path
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk
Content-Type: application/sdp
Content-Length:   417