core: append_branch() sets also the send_socket, path & flags
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Sat, 31 Oct 2009 09:27:43 +0000 (10:27 +0100)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Sat, 31 Oct 2009 09:27:43 +0000 (10:27 +0100)
- 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
route.c

index 1694419..b8256a7 100644 (file)
--- 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 (file)
--- 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;