<div dir="ltr"><div><div><div><div><div><div class="gmail_extra"><div>Hi Daniel,<br><br></div><div class="gmail_quote">On Fri, Jun 6, 2014 at 10:21 AM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">try to save the number of branches in an avp before t_relay() in request_route.<br></blockquote><div>

<br>I just tried that, but it looks strange. <br><br>This is how my route for t_relay looks like:<br><br>route[2] {<br><br>        xlog("L_DBG", "Sending out packet $rm stateful.\n");<br>        if (is_method("INVITE")) {<br>

                xlog("L_INFO", "REQUEST: Open branches: $avp(s:branches) T=$tU\n");<br>                if (defined ($avp(s:branches))) {<br>                        xlog("L_INFO", "REQUEST: branches avp is defined\n");<br>

                        $avp(s:branches) = $avp(s:branches) + 1;<br>                        xlog("L_INFO", "REQUEST: branches avp is now: $avp(s:branches) T=$tU\n");<br>                } else {<br>                        xlog("L_INFO", "REQUEST: branches avp is NOT defined\n");<br>

                        $avp(s:branches) = 1;<br>                        xlog("L_INFO", "REQUEST: branches avp is now: $avp(s:branches) T=$tU\n");<br>                }<br>        }<br>        if (!t_relay()) {<br>

<br>                xlog("L_ERR", "route(2): error to <$tu> from <$fu>\n");<br><br>                sl_reply_error();<br>                return;<br>        };<br>        return;<br>}<br><br>

Additionally I have a route called from a named reply_route, where I print the number of branches:<br><br>xlog("L_INFO", "REPLY: Number of open branches: $avp(s:branches) T=$tU\n");<br><br>Now,
 when I run this code, calling the extension 1016908e0 with two devices 
registered to it, the log gives me the following output:<br><br>Jun 12 08:39:26 hagi /usr/sbin/kamailio[32497]: INFO: <script>: REQUEST: Open branches: <null> T=1016908e0<br>Jun 12 08:39:26 hagi /usr/sbin/kamailio[32497]: INFO: <script>: REQUEST: branches avp is NOT defined<br>

Jun 12 08:39:26 hagi /usr/sbin/kamailio[32497]: INFO: <script>: REQUEST: branches avp is now: 1 T=1016908e0<br>[..]<br>Jun
 12 08:39:31 hagi /usr/sbin/kamailio[32499]: NOTICE: <script>: 
reply: 486 Busy Here - M=INVITE F=<a href="mailto:sip%3A021163555552@sipgate.de">sip:021163555552@sipgate.de</a> 
T=<a href="mailto:sip%3A1016908e0@sipgate.de">sip:1016908e0@sipgate.de</a> SRCIP=<a href="http://217.10.66.131:5070">217.10.66.131:5070</a><br>Jun 12 08:39:31 
hagi /usr/sbin/kamailio[32499]: INFO: <script>: REPLY: Number of 
open branches: 18446744073709551613 T=1016908e0<br><br>Both phones
 do ring. I would expect to see the REQUEST part twice, once for each 
branch, but it is only executed once. And the AVP doesn't survive, 
carries a completely wrong value.<br><br>Do you have any idea, why Kamailio is doing this?<br><br>Best Regards,<br>Sebastian</div></div></div></div></div></div></div></div></div>