Browse code

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

Andrei Pelinescu-Onciul authored on 31/10/2009 09:27:43
Showing 2 changed files
... ...
@@ -339,15 +339,16 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
339 339
 
340 340
 		/* jku -- introduce a new branch */
341 341
 		case APPEND_BRANCH_T:
342
-			if ((a->val[0].type!=STRING_ST)) {
342
+			if (unlikely(a->val[0].type!=STR_ST)) {
343 343
 				LOG(L_CRIT, "BUG: do_action: bad append_branch_t %d\n",
344 344
 					a->val[0].type );
345 345
 				ret=E_BUG;
346 346
 				goto error;
347 347
 			}
348
-			ret=ser_append_branch( msg, a->val[0].u.string,
349
-					   a->val[0].u.string ? strlen(a->val[0].u.string):0,
350
-					   0, 0, a->val[1].u.number, 0);
348
+			getbflagsval(0, (flag_t*)&flags);
349
+			ret=append_branch(msg, &a->val[0].u.str, &msg->dst_uri,
350
+								&msg->path_vec, a->val[1].u.number,
351
+								(flag_t)flags, msg->force_send_socket);
351 352
 			break;
352 353
 
353 354
 		/* jku begin: is_length_greater_than */
... ...
@@ -976,6 +976,17 @@ int fix_actions(struct action* a)
976 976
 									(unsigned int)t->val[0].u.number);
977 977
 				}
978 978
 				break;
979
+			case APPEND_BRANCH_T:
980
+				if (t->val[0].type!=STRING_ST){
981
+					BUG("invalid subtype%d for append_branch_t\n",
982
+								t->val[0].type);
983
+					return E_BUG;
984
+				}
985
+				s.s=t->val[0].u.string;
986
+				s.len=(s.s)?strlen(s.s):0;
987
+				t->val[0].u.str=s;
988
+				t->val[0].type=STR_ST;
989
+				break;
979 990
 			default:
980 991
 				/* no fixup required for the rest */
981 992
 				break;