[sr-dev] git:sr_3.0: core: append_branch() sets also the send_socket, path & flags

Andrei Pelinescu-Onciul andrei at iptel.org
Sat Oct 31 10:24:24 CET 2009


Module: sip-router
Branch: sr_3.0
Commit: 394e061f8c582a4e146603934ef101f3bcd479db
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=394e061f8c582a4e146603934ef101f3bcd479db

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Sat Oct 31 10:27:43 2009 +0100

core: append_branch() sets also the send_socket, path & flags

- the script append_branch() sets also the new branch send_socket
 (if forced), path vector and branch flags, making it more
 compatible with the kamailio version.

Reported-by: Juha Heinanen  jh at tutpro com

---

 action.c |    9 +++++----
 route.c  |   11 +++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/action.c b/action.c
index 1694419..b8256a7 100644
--- a/action.c
+++ b/action.c
@@ -339,15 +339,16 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 
 		/* jku -- introduce a new branch */
 		case APPEND_BRANCH_T:
-			if ((a->val[0].type!=STRING_ST)) {
+			if (unlikely(a->val[0].type!=STR_ST)) {
 				LOG(L_CRIT, "BUG: do_action: bad append_branch_t %d\n",
 					a->val[0].type );
 				ret=E_BUG;
 				goto error;
 			}
-			ret=ser_append_branch( msg, a->val[0].u.string,
-					   a->val[0].u.string ? strlen(a->val[0].u.string):0,
-					   0, 0, a->val[1].u.number, 0);
+			getbflagsval(0, (flag_t*)&flags);
+			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);
 			break;
 
 		/* jku begin: is_length_greater_than */
diff --git a/route.c b/route.c
index fc25c64..8d6f2c6 100644
--- a/route.c
+++ b/route.c
@@ -976,6 +976,17 @@ int fix_actions(struct action* a)
 									(unsigned int)t->val[0].u.number);
 				}
 				break;
+			case APPEND_BRANCH_T:
+				if (t->val[0].type!=STRING_ST){
+					BUG("invalid subtype%d for append_branch_t\n",
+								t->val[0].type);
+					return E_BUG;
+				}
+				s.s=t->val[0].u.string;
+				s.len=(s.s)?strlen(s.s):0;
+				t->val[0].u.str=s;
+				t->val[0].type=STR_ST;
+				break;
 			default:
 				/* no fixup required for the rest */
 				break;




More information about the sr-dev mailing list