Hello,
i found that $T_barnch_idx returns inconsistent numbers for the same branch. If printed in REQUEST_ROUTE, the value is alwasy 1 more that in REPLY_ROUTE. The branch index is set using tm_ctx_set_branch_index(branch) in a lot of places, but only in t_fwd.c it is set with tm_ctx_set_branch_index(branch+1).
If i change that to the same as elsewhere, the numbering is consistent. I'd like to get an ACK from a tm guru before i commit this fix, because i have no idea what side-effects this might have.
--- a/modules/tm/t_fwd.c +++ b/modules/tm/t_fwd.c @@ -317,7 +317,7 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req, /* run branch_route actions if provided */ backup_route_type = get_route_type(); set_route_type(BRANCH_ROUTE); - tm_ctx_set_branch_index(branch+1); + tm_ctx_set_branch_index(branch); /* no need to backup/set avp lists: the on_branch route is run only in the main route context (e.g. t_relay() in the main route) or in the failure route context (e.g. append_branch &