[SR-Users] Strange behavior with $T_branch_idx in failure_route
Victor Litvinov
victor.litvinov at wildix.com
Wed Mar 24 17:35:24 CET 2021
Hello.
We faced an issue that $T_branch_idx called from failure_route returned a
strange result.
Few words about our setup.
We use branch indexes like key in avp when we store via-branch value for
rtpengine.
route[RTPMANAGE]
...
if ( is_request() and is_method("INVITE") and !has_totag() and
t_is_branch_route() )
{
$avp(viabranch$T_branch_idx) = $branch_str;
}
$avp(extra_branch_id) = $avp(viabranch$T_branch_idx);
$var(rtpkey) = $var(rtpkey) + " via-branch=extra";
......
rtpengine_manage($var(rtpkey));
Call this route in branch_route and in failure_route.
In branch_route T_branch_idx is 0, in failure_route is 1.
In documentation:
the index (starting with 1 for the first branch) of the branch for which is
executed the branch_route[]. If used outside of branch_route[] block, the
value is '0'.
But in source code behavior is different. (modules/tmx/t_var.c:480):
for BRANCH_FAILURE_ROUTE and BRANCH_ROUTE it is idx = tcx->branch_index,
but for FAILURE_ROUTE it is idx = t->nr_of_outgoings + nr_branches;
Can you describe why for failure_route it is different and what we can do
in our case? And can you update documentation for this variable if it is
wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210324/c71f2231/attachment.htm>
More information about the sr-users
mailing list