[PATCH] core: append_branch(): avoid identical branches

Andrei Pelinescu-Onciul andrei at iptel.org
Sat Sep 11 08:24:23 CEST 2010


If append_branch() is used from the script, try to avoid having 2
identical branches (one for the main ruri and one because of the
append_branch()). In this case the ruri will be marked as consumed.

Reported-by: Daniel-Constantin Mierla <miconda at gmail.com>
---
 action.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/action.c b/action.c
index 8349ff9..fd53d5e 100644
--- a/action.c
+++ b/action.c
@@ -549,6 +549,11 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 			ret=append_branch(msg, &a->val[0].u.str, &msg->dst_uri,
 								&msg->path_vec, a->val[1].u.number,
 								(flag_t)flags, msg->force_send_socket);
+			/* if the uri is the ruri and q was also not changes, mark
+			   ruri as consumed, to avoid having an identical branch */
+			if ((a->val[0].u.str.s == 0 || a->val[0].u.str.len == 0) &&
+					a->val[1].u.number == Q_UNSPECIFIED)
+				ruri_mark_consumed();
 			break;
 
 		/* jku begin: is_length_greater_than */
-- 
1.7.2.1


--huq684BweRXVnRxX--



More information about the sr-dev mailing list