[sr-dev] git:master: rr: use internal msg flags to mark a request with record route added

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 29 00:13:00 CEST 2014


Module: sip-router
Branch: master
Commit: cc84b46d473236d162a852c3604eacfc88e56ba2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cc84b46d473236d162a852c3604eacfc88e56ba2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Apr 29 00:01:53 2014 +0200

rr: use internal msg flags to mark a request with record route added

---

 modules/rr/rr_mod.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/rr/rr_mod.c b/modules/rr/rr_mod.c
index 1628f3b..8a7311d 100644
--- a/modules/rr/rr_mod.c
+++ b/modules/rr/rr_mod.c
@@ -61,7 +61,6 @@ int enable_socket_mismatch_warning = 1; /*!< enable socket mismatch warning */
 static str custom_user_spec = {NULL, 0};
 pv_spec_t custom_user_avp;
 
-static unsigned int last_rr_msg;
 ob_api_t rr_obb;
 
 MODULE_VERSION
@@ -268,7 +267,7 @@ static int w_record_route(struct sip_msg *msg, char *key, char *bar)
 {
 	str s;
 
-	if (msg->id == last_rr_msg) {
+	if (msg->msg_flags & FL_RR_ADDED) {
 		LM_ERR("Double attempt to record-route\n");
 		return -1;
 	}
@@ -280,7 +279,7 @@ static int w_record_route(struct sip_msg *msg, char *key, char *bar)
 	if ( record_route( msg, key?&s:0 )<0 )
 		return -1;
 
-	last_rr_msg = msg->id;
+	msg->msg_flags |= FL_RR_ADDED;
 	return 1;
 }
 
@@ -289,7 +288,7 @@ static int w_record_route_preset(struct sip_msg *msg, char *key, char *key2)
 {
 	str s;
 
-	if (msg->id == last_rr_msg) {
+	if (msg->msg_flags & FL_RR_ADDED) {
 		LM_ERR("Duble attempt to record-route\n");
 		return -1;
 	}
@@ -316,7 +315,7 @@ static int w_record_route_preset(struct sip_msg *msg, char *key, char *key2)
 		return -1;
 
 done:
-	last_rr_msg = msg->id;
+	msg->msg_flags |= FL_RR_ADDED;
 	return 1;
 }
 
@@ -328,7 +327,7 @@ static int w_record_route_advertised_address(struct sip_msg *msg, char *addr, ch
 {
 	str s;
 
-	if (msg->id == last_rr_msg) {
+	if (msg->msg_flags & FL_RR_ADDED) {
 		LM_ERR("Double attempt to record-route\n");
 		return -1;
 	}
@@ -340,7 +339,7 @@ static int w_record_route_advertised_address(struct sip_msg *msg, char *addr, ch
 	if ( record_route_advertised_address( msg, &s ) < 0)
 		return -1;
 
-	last_rr_msg = msg->id;
+	msg->msg_flags |= FL_RR_ADDED;
 	return 1;
 }
 




More information about the sr-dev mailing list