Pārlūkot izejas kodu

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
(cherry picked from commit 394e061f8c582a4e146603934ef101f3bcd479db)
Andrei Pelinescu-Onciul 16 gadi atpakaļ
vecāks
revīzija
ce764c9107
2 mainītis faili ar 16 papildinājumiem un 4 dzēšanām
  1. 5 4
      action.c
  2. 11 0
      route.c

+ 5 - 4
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 */

+ 11 - 0
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;