[Home]

Summary:ASTERISK-27996: PJSIP: match_header endpoint matching does not support inbound registration
Reporter:Edvin Vidmar (edvinv)Labels:pjsip webrtc
Date Opened:2018-07-30 06:50:22Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Resources/res_pjsip Resources/res_pjsip_endpoint_identifier_ip Resources/res_pjsip_registrar
Versions:13.21.1 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-27548 res_pjsip_endpoint_identifier_ip only matches against "generic string" headers
Environment:Attachments:( 0) output.txt
( 1) pjsip.conf
Description:Hi,
I try to register webrtc client with identify set to header but it doesn’t work. I have attached pjsip.conf and asterisk cli output.

From configuration you can see that {{match_header}} is set to {{From-WebRTC: 2000}} and from sip log you can see {{From-WebRTC}} header is set correctly, but I always get following error:
{noformat}
res_pjsip_registrar.c:967 find_registrar_aor: AOR ‘’ not found for endpoint ‘2000-webrtc’
{noformat}

Error says that AOR ‘’ is not found, but from config you can see that AOR is set and also if I check in asterisk cli it all looks OK.

Also if I change the endpoint's {{identify_by=header}} to {{identify_by=username}} it works ok. So it looks like problem with header identification.

br
edvin

https://community.asterisk.org/t/aor-not-found-for-endpoint-2000-webrtc/75366
Comments:By: Asterisk Team (asteriskteam) 2018-07-30 06:50:24.480-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].

By: Richard Mudgett (rmudgett) 2018-07-30 07:36:29.984-0500

There are two things currently wrong with how you are using the match_header option:
# It is documented that the value needs to match the received header value \[1].  This is implying that it *must* be the whole value of the header and the header contents cannot *change*.  The From and To headers do not have this characteristic.
# The option only matches generic headers which are not used by SIP for its operation ASTERISK-27548.  The option was originally added to identify endpoints that add their own custom header for identification purposes.   E.g., match_header=X-my-custom-header: This is my identifying string

The patch up for review for ASTERISK-27548 addresses both of these so you could do what you want.
# It adds regular expression support so you don't have to know beforehand the entire contents of the header value.
# It allows specifying any type of header.

\[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Configuration_res_pjsip_endpoint_identifier_ip

By: Joshua C. Colp (jcolp) 2018-07-30 08:31:33.778-0500

I've put this back into triage as it is not a duplicate. The registrar does not have code in the header match case to get the AOR being registered against, so it doesn't work.

By: Richard Mudgett (rmudgett) 2018-07-31 15:39:54.222-0500

Ok.  So the reporter needs the fix for ASTERISK-27548 in addition to a fix to make the match_header work with inbound registrations.

Although, I'm not sure what we should be using to look up the AOR with when match_header identifies the endpoint.

By: Richard Mudgett (rmudgett) 2018-07-31 16:36:50.874-0500

Sigh.  I finally realized that the reporter was specifying a custom header named {{From-WebRTC}} with a fixed value and not trying to match the {{From}} header with a partial value which would require the ASTERISK-27548 patch to match and possibly not crash.

So my current question remains:  What should we be using to look up the AOR with when match_header identifies the endpoint for REGISTER messages?

By: Dmitry Sytchev (kbdfck) 2022-06-24 07:29:31.019-0500

Is there any solution yet?
We also need this feature. This is needed because we want to forward registrations from our SBC.
We send invites with custom header (X-SBC-User) to identify correct endpoint on Asterisk side, but in case with register messages this approach fails.

We just need the same functionality to identify by custom header as in case with INVITE inbound endpoint matching with custom header.

By: Joshua C. Colp (jcolp) 2022-06-24 07:31:24.399-0500

The issue remains open, so there has been no change that has gone in mentioning it.

By: Dmitry Sytchev (kbdfck) 2022-06-24 07:47:52.427-0500

Can we use existing header endpoint matching code in INVITES for matching REGISTERs?  Or there are some restrictions for that?
For me seems somewhat strange that it is separated.

I'd like to experiment with source code myself, but don't have much experience in Asterisk patching...

By: Joshua C. Colp (jcolp) 2022-06-24 07:50:32.822-0500

I don't remember the specifics of this issue since it is so old.