Skip to content

Commit

Permalink
[tm] fix the visibility of $T_branch_idx in failure route
Browse files Browse the repository at this point in the history
The bavp's are already available in failure route and they are using the same internal variable for the branch index. So, to keep consistency, the branch index should be visible also in failure route via $T_branch_idx

(cherry picked from commit ae9e51e)
  • Loading branch information
bogdan-iancu committed Nov 28, 2023
1 parent 8b4771d commit f94618a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions modules/tm/doc/tm_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1953,9 +1953,10 @@ route{
<para>
<emphasis>$T_branch_idx</emphasis> - the index (starting with 0
for the first branch) of the currently proccessed branch. This
index makes sense only in BRANCH and REPLY routes (where there is
a concept of per branch processing). In all the other types of
routes, the value of this index will be NULL.
index makes sense only in BRANCH and REPLY routes (where the
processing is per branch) and in FAILURE route (where it points
to the branch with the last final reply on the transaction). In all
the other types of routes, the value of this index will be NULL.
</para>
</section>
<section id="pv_T_reply_code" xreflabel="$T_reply_code">
Expand Down
3 changes: 2 additions & 1 deletion modules/tm/tm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,8 @@ static int pv_get_tm_branch_idx(struct sip_msg *msg, pv_param_t *param,
if(msg==NULL || res==NULL)
return -1;

if (route_type!=BRANCH_ROUTE && route_type!=ONREPLY_ROUTE) {
if (route_type!=BRANCH_ROUTE && route_type!=ONREPLY_ROUTE &&
route_type!=FAILURE_ROUTE) {
res->flags = PV_VAL_NULL;
return 0;
}
Expand Down

0 comments on commit f94618a

Please sign in to comment.