diff options
author | Mark Michelson <mmichelson@digium.com> | 2015-05-22 10:38:19 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-05-22 10:38:20 -0500 |
commit | 242306ade31d037b35e613b925b69b23cb015b87 (patch) | |
tree | 288d2401cddf833130b8a1a306dd521f452ad7b4 /res/res_pjsip_outbound_registration.c | |
parent | f2cc766d817191c79b97668a67a203fe7cf1c588 (diff) | |
parent | 9e2a582d2d9386c173566aa8b4e948bdba349fc4 (diff) |
Merge "res_pjsip_outbound_registration: Check request URI for line."
Diffstat (limited to 'res/res_pjsip_outbound_registration.c')
-rw-r--r-- | res/res_pjsip_outbound_registration.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index a43fca2ec..7f60acdb3 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -383,22 +383,27 @@ static int line_identify_relationship(void *obj, void *arg, int flags) 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)) { - return NULL; - } - uri = pjsip_uri_get_uri(rdata->msg_info.to->uri); - - line = pjsip_param_find(&uri->other_param, &LINE_STR); - if (!line) { + 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; } |