]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_endpoint_identifier_ip.c: Added regex support to match_header
authorRichard Mudgett <rmudgett@digium.com>
Tue, 24 Jul 2018 18:44:41 +0000 (13:44 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 27 Jul 2018 15:58:30 +0000 (10:58 -0500)
commit32ce8e5cf3c940d3ca4d02ea36d13b80df684c25
tree45119ce99918645ba67653d529ace9910b989655
parenta31e877502901e05b7cd667108945dbb8c577f81
res_pjsip_endpoint_identifier_ip.c: Added regex support to match_header

This patch adds regular expression support to make the identify section's
match_header option more useful when attempting to match complex headers
like the 'To' or 'From' headers.  The 'From' header has variable
components such as the tag parameter that you cannot predict.  To specify
a regular expression put slashes around the regular expression in place of
the header value.

[identify-alice]
type=identify
endpoint=alice
match_header=From: /<sip:alice@127\\.0\\.0\\.1>/

* Added regex support to match_header so you could match a 'To' header
among other complex headers.

Fixed reported crashes when trying to match special headers like 'Contact'.
The identify section's match_header method used code that assumed you were
matching a generic header.  Any other type of header could cause a crash
if the header structure variant did not match the generic header enough.

* Made use code that will work for any header type instead of code
specific to generic headers.

Other fixes while in the area:

* Made check all headers of the requested name.
* Added some more sanity checks to the configured identify matching
options when applying the configuration.

ASTERISK-27548

Change-Id: I27dfd4ff5e2259b906640e3c330681b76b4ed1f1
CHANGES
res/res_pjsip_endpoint_identifier_ip.c