[sr-dev] git:4.2:0dd462b3: rr: fix detecting next strict router

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 29 12:45:34 CEST 2015


Module: kamailio
Branch: 4.2
Commit: 0dd462b3e4ca6637b1d4fdb5cda3df97f215e3e8
URL: https://github.com/kamailio/kamailio/commit/0dd462b3e4ca6637b1d4fdb5cda3df97f215e3e8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-07-29T12:41:41+02:00

rr: fix detecting next strict router

- a regression after adding support for sip-outbound
- more verbose debug messages
- reported by Antonio Real, GH #267

(cherry picked from commit 0c42a848258d475f57ea25458bc75e55dcee948d)
(cherry picked from commit cb4f55b26f51a929b2db08373c1b97a95b8ad6a6)

---

Modified: modules/rr/loose.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0dd462b3e4ca6637b1d4fdb5cda3df97f215e3e8.diff
Patch: https://github.com/kamailio/kamailio/commit/0dd462b3e4ca6637b1d4fdb5cda3df97f215e3e8.patch

---

diff --git a/modules/rr/loose.c b/modules/rr/loose.c
index f537a8d..87065e6 100644
--- a/modules/rr/loose.c
+++ b/modules/rr/loose.c
@@ -759,7 +759,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 	int status = RR_DRIVEN;
 	str uri;
 	struct socket_info *si;
-	int uri_is_myself, next_is_strict;
+	int uri_is_myself;
 	int use_ob = 0;
 
 	hdr = _m->route;
@@ -770,11 +770,11 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 	routed_msg_id = 0;
 
 	if (parse_uri(uri.s, uri.len, &puri) < 0) {
-		LM_ERR("failed to parse the first route URI\n");
+		LM_ERR("failed to parse the first route URI (%.*s)\n",
+				uri.len, ZSW(uri.s));
 		return RR_ERROR;
 	}
 
-	next_is_strict = is_strict(&puri.params);
 	routed_params = puri.params;
 	uri_is_myself = is_myself(&puri);
 
@@ -817,7 +817,8 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 			/* double route may occure due different IP and port, so force as
 			 * send interface the one advertise in second Route */
 			if (parse_uri(rt->nameaddr.uri.s,rt->nameaddr.uri.len,&puri)<0) {
-				LM_ERR("failed to parse the double route URI\n");
+				LM_ERR("failed to parse the double route URI (%.*s)\n",
+						rt->nameaddr.uri.len, ZSW(rt->nameaddr.uri.s));
 				return RR_ERROR;
 			}
 
@@ -854,7 +855,8 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 		
 		uri = rt->nameaddr.uri;
 		if (parse_uri(uri.s, uri.len, &puri) < 0) {
-			LM_ERR("failed to parse the first route URI\n");
+			LM_ERR("failed to parse the next route URI (%.*s)\n",
+					uri.len, ZSW(uri.s));
 			return RR_ERROR;
 		}
 	} else {
@@ -869,7 +871,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 	}
 
 	LM_DBG("URI to be processed: '%.*s'\n", uri.len, ZSW(uri.s));
-	if (next_is_strict) {
+	if (is_strict(&puri.params)) {
 		LM_DBG("Next URI is a strict router\n");
 		if (handle_sr(_m, hdr, rt) < 0) {
 			LM_ERR("failed to handle strict router\n");




More information about the sr-dev mailing list