[sr-dev] git:master:179bfcd7: sca: sca_handle_subscribe() get actual ruri

Victor Seva linuxmaniac at torreviejawireless.org
Thu Sep 15 08:39:49 CEST 2016


Module: kamailio
Branch: master
Commit: 179bfcd7eabde187b70e7deceb93c576b17ecc75
URL: https://github.com/kamailio/kamailio/commit/179bfcd7eabde187b70e7deceb93c576b17ecc75

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2016-09-14T18:22:51+02:00

sca: sca_handle_subscribe() get actual ruri

Fix #777

---

Modified: modules/sca/sca_subscribe.c

---

Diff:  https://github.com/kamailio/kamailio/commit/179bfcd7eabde187b70e7deceb93c576b17ecc75.diff
Patch: https://github.com/kamailio/kamailio/commit/179bfcd7eabde187b70e7deceb93c576b17ecc75.patch

---

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;




More information about the sr-dev mailing list