<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>indeed, the docs for it were outdated, the code evolved and the
docs were not updated. I tried to bring them correlated with the
code, hope I haven't missed anything in the code:<br>
</p>
<p> *
<a class="moz-txt-link-freetext" href="https://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#t_branch_idx">https://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#t_branch_idx</a></p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 24.03.21 17:35, Victor Litvinov
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAHt9-ejOcNcZePiEdYAVxhVW=XOuFOk-CGmWRtW6+niq70Qnmg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
</body>
</html>