[sr-dev] git:master:26c94b32: topos: per contact and rr specific processing for receiving PRACK

Daniel-Constantin Mierla miconda at gmail.com
Fri Aug 11 09:15:06 CEST 2017


Module: kamailio
Branch: master
Commit: 26c94b32baec05a064beca7064e2f44eff9ca3ef
URL: https://github.com/kamailio/kamailio/commit/26c94b32baec05a064beca7064e2f44eff9ca3ef

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-08-11T09:14:27+02:00

topos: per contact and rr specific processing for receiving PRACK

- records are taken from INVITE branch record

---

Modified: src/modules/topos/tps_msg.c

---

Diff:  https://github.com/kamailio/kamailio/commit/26c94b32baec05a064beca7064e2f44eff9ca3ef.diff
Patch: https://github.com/kamailio/kamailio/commit/26c94b32baec05a064beca7064e2f44eff9ca3ef.patch

---

diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c
index ca360a975c..228996960e 100644
--- a/src/modules/topos/tps_msg.c
+++ b/src/modules/topos/tps_msg.c
@@ -774,20 +774,24 @@ int tps_request_received(sip_msg_t *msg, int dialog)
 		if(tps_storage_load_dialog(msg, &mtsd, &stsd)<0) {
 			goto error;
 		}
+		/* detect direction - via from-tag */
+		if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
+			goto error;
+		}
 	}
 
-	/* detect direction - via from-tag */
-	if(tps_dlg_detect_direction(msg, &stsd, &direction)<0) {
-		goto error;
-	}
 	mtsd.direction = direction;
 
 	tps_storage_lock_release(&lkey);
 
-	if(direction == TPS_DIR_UPSTREAM) {
-		nuri = stsd.a_contact;
-	} else {
+	if(use_branch) {
 		nuri = stsd.b_contact;
+	} else {
+		if(direction == TPS_DIR_UPSTREAM) {
+			nuri = stsd.a_contact;
+		} else {
+			nuri = stsd.b_contact;
+		}
 	}
 	if(nuri.len>0) {
 		if(rewrite_uri(msg, &nuri)<0) {
@@ -796,31 +800,28 @@ int tps_request_received(sip_msg_t *msg, int dialog)
 		}
 	}
 
-	if(tps_reappend_route(msg, &stsd, &stsd.s_rr,
-				(direction==TPS_DIR_UPSTREAM)?0:1)<0) {
-		LM_ERR("failed to reappend s-route\n");
-		return -1;
-	}
-	if(direction == TPS_DIR_UPSTREAM) {
-		if(use_branch) {
-			if(tps_reappend_route(msg, &stsd, &stsd.x_rr, 0)<0) {
-				LM_ERR("failed to reappend x-route\n");
-				return -1;
-			}
-		} else {
-			if(tps_reappend_route(msg, &stsd, &stsd.a_rr, 0)<0) {
-				LM_ERR("failed to reappend a-route\n");
-				return -1;
-			}
+	if(use_branch) {
+		if(tps_reappend_route(msg, &stsd, &stsd.s_rr, 1) < 0) {
+			LM_ERR("failed to reappend s-route\n");
+			return -1;
+		}
+		if(tps_reappend_route(msg, &stsd, &stsd.y_rr, 1) < 0) {
+			LM_ERR("failed to reappend b-route\n");
+			return -1;
 		}
 	} else {
-		if(use_branch) {
-			if(tps_reappend_route(msg, &stsd, &stsd.y_rr, 1)<0) {
-				LM_ERR("failed to reappend b-route\n");
+		if(tps_reappend_route(msg, &stsd, &stsd.s_rr,
+					(direction == TPS_DIR_UPSTREAM) ? 0 : 1) < 0) {
+			LM_ERR("failed to reappend s-route\n");
+			return -1;
+		}
+		if(direction == TPS_DIR_UPSTREAM) {
+			if(tps_reappend_route(msg, &stsd, &stsd.a_rr, 0) < 0) {
+				LM_ERR("failed to reappend a-route\n");
 				return -1;
 			}
 		} else {
-			if(tps_reappend_route(msg, &stsd, &stsd.b_rr, 1)<0) {
+			if(tps_reappend_route(msg, &stsd, &stsd.b_rr, 1) < 0) {
 				LM_ERR("failed to reappend b-route\n");
 				return -1;
 			}




More information about the sr-dev mailing list