[sr-dev] git:master:8f4ec607: rr: use msg->pid to match cached route params

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 9 13:07:11 CEST 2016


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-06-09T13:07:15+02:00

rr: use msg->pid to match cached route params

- could be related to GH #663

---

Modified: modules/rr/loose.c

---

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

---

diff --git a/modules/rr/loose.c b/modules/rr/loose.c
index 76204c9..1785d8c 100644
--- a/modules/rr/loose.c
+++ b/modules/rr/loose.c
@@ -56,7 +56,8 @@
 #define ROUTE_SUFFIX_LEN (sizeof(ROUTE_SUFFIX)-1)
 
 /*! variables used to hook the param part of the local route */
-static unsigned int routed_msg_id;
+static unsigned int routed_msg_id = 0;
+static int routed_msg_pid = 0;
 static str routed_params = {0,0};
 
 
@@ -583,6 +584,7 @@ static inline int after_strict(struct sip_msg* _m)
 
 	/* reset rr handling static vars for safety in error case */
 	routed_msg_id = 0;
+	routed_msg_pid = 0;
 	routed_params.s = NULL;
 	routed_params.len = 0;
 
@@ -634,6 +636,7 @@ static inline int after_strict(struct sip_msg* _m)
 	 * important note: RURI is already parsed by the above function, so 
 	 * we just used it without any checking */
 	routed_msg_id = _m->id;
+	routed_msg_pid = _m->pid;
 	routed_params = _m->parsed_uri.params;
 
 	if (is_strict(&puri.params)) {
@@ -766,6 +769,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 
 	/* reset rr handling static vars for safety in error case */
 	routed_msg_id = 0;
+	routed_msg_pid = 0;
 
 	if (parse_uri(uri.s, uri.len, &puri) < 0) {
 		LM_ERR("failed to parse the first route URI (%.*s)\n",
@@ -783,6 +787,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 			uri.len, ZSW(uri.s));
 		/* set the hooks for the params */
 		routed_msg_id = _m->id;
+		routed_msg_pid = _m->pid;
 
 		if ((use_ob = process_outbound(_m, puri.user)) < 0) {
 			LM_INFO("failed to process outbound flow-token\n");
@@ -969,7 +974,7 @@ int check_route_param(struct sip_msg * msg, regex_t* re)
 	str params;
 
 	/* check if the hooked params belong to the same message */
-	if (routed_msg_id != msg->id)
+	if (routed_msg_id != msg->id || routed_msg_pid != msg->pid)
 		return -1;
 
 	/* check if params are present */




More information about the sr-dev mailing list