Module: kamailio Branch: master Commit: 791b288448db7aa71100b719dca4b2c10f19e910 URL: https://github.com/kamailio/kamailio/commit/791b288448db7aa71100b719dca4b2c1...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: GitHub noreply@github.com Date: 2016-09-15T08:39:44+02:00
Merge pull request #778 from linuxmaniac/vseva/2387
sca: sca_handle_subscribe() get actual ruri
---
Modified: modules/sca/sca_subscribe.c
---
Diff: https://github.com/kamailio/kamailio/commit/791b288448db7aa71100b719dca4b2c1... Patch: https://github.com/kamailio/kamailio/commit/791b288448db7aa71100b719dca4b2c1...
---
diff --git a/modules/sca/sca_subscribe.c b/modules/sca/sca_subscribe.c index 046442b..b0a9d27 100644 --- a/modules/sca/sca_subscribe.c +++ b/modules/sca/sca_subscribe.c @@ -952,6 +952,7 @@ int sca_subscription_from_request(sca_mod *scam, sip_msg_t *msg, int event_type, unsigned int expires = 0, max_expires; unsigned int cseq; + str *ruri = NULL;
assert(req_sub != NULL);
@@ -1032,6 +1033,12 @@ int sca_subscription_from_request(sca_mod *scam, sip_msg_t *msg, int event_type, to = &tmp_to; }
+ if (parse_sip_msg_uri(msg) < 0) { + LM_ERR("Error while parsing the Request-URI\n"); + goto error; + } + ruri = GET_RURI(msg); + to_tag = to->tag_value; if (to_tag.s == NULL) { // XXX need hook to detect when we have a subscription and the @@ -1039,7 +1046,7 @@ int sca_subscription_from_request(sca_mod *scam, sip_msg_t *msg, int event_type, // old subscription should be dumped & appropriate NOTIFYs sent. if (scam->sl_api->get_reply_totag(msg, &to_tag) < 0) { LM_ERR("Failed to generate to-tag for reply to SUBSCRIBE %.*s\n", - STR_FMT(&REQ_LINE(msg).uri)); + STR_FMT(ruri)); goto error; }
@@ -1048,7 +1055,7 @@ int sca_subscription_from_request(sca_mod *scam, sip_msg_t *msg, int event_type, LM_ERR("Failed to parse Record-Route header %.*s in " "SUBSCRIBE %.*s from %.*s\n", STR_FMT(&msg->record_route->body), - STR_FMT(&REQ_LINE(msg).uri), + STR_FMT(ruri), STR_FMT(&contact_uri)); goto error; } @@ -1056,9 +1063,9 @@ int sca_subscription_from_request(sca_mod *scam, sip_msg_t *msg, int event_type, }
req_sub->subscriber = contact_uri; - if (sca_uri_extract_aor(&REQ_LINE(msg).uri, &req_sub->target_aor) < 0) { + if (sca_uri_extract_aor(ruri, &req_sub->target_aor) < 0) { LM_ERR("Failed to extract AoR from RURI %.*s\n", - STR_FMT(&REQ_LINE(msg).uri)); + STR_FMT(ruri)); goto error; } req_sub->event = event_type;