Jelajahi Sumber

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

- could be related to GH #663
Daniel-Constantin Mierla 9 tahun lalu
induk
melakukan
8f4ec60795
1 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 7 2
      modules/rr/loose.c

+ 7 - 2
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 */