Module: sip-router
Branch: master
Commit: 4cd7a346ad6dd2542c318ad371416105b60654be
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cd7a34…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Sat Sep 11 08:24:23 2010 +0200
core: append_branch(): avoid identical branches
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(a)gmail.com>
Reported-and-tested-by: Miklos Tirpak <miklos(a)iptel.org>
---
action.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/action.c b/action.c
index 1716c34..67c6026 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 changed, 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 */