[Asterisk-code-review] res pjsip outbound registration: Check request URI for line. (asterisk[13])
Matt Jordan
asteriskteam at digium.com
Fri May 22 10:38:26 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: res_pjsip_outbound_registration: Check request URI for line.
......................................................................
res_pjsip_outbound_registration: Check request URI for line.
When an inbound call is received the To header is checked
for the "line" option. Some remote servers will place this
in the request URI instead. This adds an additional check for
the option in the request URI.
ASTERISK-25072 #close
Reported by: Dmitriy Serov
Change-Id: Id4e44debbb80baad623b914a88574371575353c8
---
M res/res_pjsip_outbound_registration.c
1 file changed, 15 insertions(+), 10 deletions(-)
Approvals:
Matt Jordan: Looks good to me, approved; Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 6af8b86..c910c94 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -383,24 +383,29 @@
return !pj_strcmp2(&line->value, state->client_state->line) ? CMP_MATCH | CMP_STOP : 0;
}
+static struct pjsip_param *get_uri_option_line(const void *uri)
+{
+ pjsip_sip_uri *pjuri;
+ static const pj_str_t LINE_STR = { "line", 4 };
+
+ if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) {
+ return NULL;
+ }
+ pjuri = pjsip_uri_get_uri(uri);
+ return pjsip_param_find(&pjuri->other_param, &LINE_STR);
+}
+
/*! \brief Endpoint identifier which uses the 'line' parameter to establish a relationship to an outgoing registration */
static struct ast_sip_endpoint *line_identify(pjsip_rx_data *rdata)
{
- pjsip_sip_uri *uri;
- static const pj_str_t LINE_STR = { "line", 4 };
pjsip_param *line;
RAII_VAR(struct ao2_container *, states, NULL, ao2_cleanup);
RAII_VAR(struct sip_outbound_registration_state *, state, NULL, ao2_cleanup);
- if (!PJSIP_URI_SCHEME_IS_SIP(rdata->msg_info.to->uri) && !PJSIP_URI_SCHEME_IS_SIPS(rdata->msg_info.to->uri)) {
+ if (!(line = get_uri_option_line(rdata->msg_info.to->uri))
+ && !(line = get_uri_option_line(rdata->msg_info.msg->line.req.uri))) {
return NULL;
- }
- uri = pjsip_uri_get_uri(rdata->msg_info.to->uri);
-
- line = pjsip_param_find(&uri->other_param, &LINE_STR);
- if (!line) {
- return NULL;
- }
+ }
states = ao2_global_obj_ref(current_states);
if (!states) {
--
To view, visit https://gerrit.asterisk.org/482
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id4e44debbb80baad623b914a88574371575353c8
Gerrit-PatchSet: 6
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Dmitriy Serov <serov.d.p at gmail.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Rusty Newton <rnewton at digium.com>
More information about the asterisk-code-review
mailing list