[sr-dev] git:master:fcf1d3d7: topos: keep original contact in 3xx responses sent out

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 24 16:11:38 CEST 2018


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-07-24T16:10:16+02:00

topos: keep original contact in 3xx responses sent out

- reported by Andrew Pogrebennyk

---

Modified: src/modules/topos/tps_msg.c

---

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

---

diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c
index 41cb7ef416..b349865262 100644
--- a/src/modules/topos/tps_msg.c
+++ b/src/modules/topos/tps_msg.c
@@ -1074,12 +1074,17 @@ int tps_response_sent(sip_msg_t *msg)
 	mtsd.direction = direction;
 
 	tps_remove_headers(msg, HDR_RECORDROUTE_T);
-	tps_remove_headers(msg, HDR_CONTACT_T);
 
-	if(direction==TPS_DIR_DOWNSTREAM) {
-		tps_reinsert_contact(msg, &stsd, &stsd.as_contact);
-	} else {
-		tps_reinsert_contact(msg, &stsd, &stsd.bs_contact);
+	/* keep contact without updates for redirect responses sent out */
+	if(msg->first_line.u.reply.statuscode<300
+			|| msg->first_line.u.reply.statuscode>=400) {
+		tps_remove_headers(msg, HDR_CONTACT_T);
+
+		if(direction==TPS_DIR_DOWNSTREAM) {
+			tps_reinsert_contact(msg, &stsd, &stsd.as_contact);
+		} else {
+			tps_reinsert_contact(msg, &stsd, &stsd.bs_contact);
+		}
 	}
 
 	tps_reappend_rr(msg, &btsd, &btsd.x_rr);




More information about the sr-dev mailing list