[sr-dev] git:5.1:75f2199a: core: skip to-tag when computing via branch for invite, ack and cancel

Henning Westerholt hw at skalatan.de
Fri Aug 2 12:08:20 CEST 2019


Module: kamailio
Branch: 5.1
Commit: 75f2199aa63647e84d0ae966638d51a360455242
URL: https://github.com/kamailio/kamailio/commit/75f2199aa63647e84d0ae966638d51a360455242

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-08-02T12:06:04+02:00

core: skip to-tag when computing via branch for invite, ack and cancel

- proper functionality for stateless proxy in case of negative ACK (in
  this case the INVITE has no To-tag, but ACK has it and resulted in
  different via branch, making downstream proxy to not match transaction)
- backport of git master commit b4e11cb25d848651406e

---

Modified: src/core/char_msg_val.h

---

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

---

diff --git a/src/core/char_msg_val.h b/src/core/char_msg_val.h
index 4d6887d713..021b1b67a1 100644
--- a/src/core/char_msg_val.h
+++ b/src/core/char_msg_val.h
@@ -46,6 +46,7 @@
 inline static int char_msg_val( struct sip_msg *msg, char *cv )
 {
 	str src[8];
+	str sempty = str_init("");
 
 	if (unlikely(!check_transaction_quadruple(msg))) {
 		LM_ERR("can't calculate char_value due to a parsing error\n");
@@ -77,7 +78,12 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
 	}
 	/* use only the from & to tags */
 	src[0]=get_from(msg)->tag_value;
-	src[1]=get_to(msg)->tag_value;
+	if(msg->first_line.u.request.method_value
+			& (METHOD_INVITE|METHOD_ACK|METHOD_CANCEL)) {
+		src[1]=sempty;
+	} else {
+		src[1]=get_to(msg)->tag_value;
+	}
 #endif /* BRANCH_INCLUDE_FROMTO_BODY */
 	src[2]= msg->callid->body;
 	src[3]= msg->first_line.u.request.uri;




More information about the sr-dev mailing list