<div dir="ltr">Hello.<div><br></div><div>We faced an issue that $T_branch_idx called from failure_route returned a strange result.</div><div><br></div><div>Few words about our setup. </div><div>We use branch indexes like key in avp when we store via-branch value for rtpengine. </div><div><br></div><div>route[RTPMANAGE]</div><div>...</div><div>if ( is_request() and is_method("INVITE") and !has_totag() and t_is_branch_route() )<br>     {<br>             $avp(viabranch$T_branch_idx) = $branch_str;<br>   }<br></div><div>$avp(extra_branch_id) = $avp(viabranch$T_branch_idx);<br></div><div>$var(rtpkey) = $var(rtpkey) + " via-branch=extra";</div><div>......</div><div>rtpengine_manage($var(rtpkey));<br></div><div><br></div><div>Call this route in branch_route and in failure_route. <br></div><div>In branch_route T_branch_idx is 0, in failure_route is 1. </div><div><br></div><div>In documentation:</div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif">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'.</span><br></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif"><br></span></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif">But in source code behavior is different. (</span>modules/tmx/t_var.c:480):</div><div>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; <br></div><div><br></div><div>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?</div></div>