[SR-Users] check for the number of open branches in Reply

Sebastian Damm damm at sipgate.de
Thu Jun 12 09:00:20 CEST 2014


Hi Daniel,

On Fri, Jun 6, 2014 at 10:21 AM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:

> try to save the number of branches in an avp before t_relay() in
> request_route.
>

I just tried that, but it looks strange.

This is how my route for t_relay looks like:

route[2] {

        xlog("L_DBG", "Sending out packet $rm stateful.\n");
        if (is_method("INVITE")) {
                xlog("L_INFO", "REQUEST: Open branches: $avp(s:branches)
T=$tU\n");
                if (defined ($avp(s:branches))) {
                        xlog("L_INFO", "REQUEST: branches avp is
defined\n");
                        $avp(s:branches) = $avp(s:branches) + 1;
                        xlog("L_INFO", "REQUEST: branches avp is now:
$avp(s:branches) T=$tU\n");
                } else {
                        xlog("L_INFO", "REQUEST: branches avp is NOT
defined\n");
                        $avp(s:branches) = 1;
                        xlog("L_INFO", "REQUEST: branches avp is now:
$avp(s:branches) T=$tU\n");
                }
        }
        if (!t_relay()) {

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

                sl_reply_error();
                return;
        };
        return;
}

Additionally I have a route called from a named reply_route, where I print
the number of branches:

xlog("L_INFO", "REPLY: Number of open branches: $avp(s:branches) T=$tU\n");

Now, when I run this code, calling the extension 1016908e0 with two devices
registered to it, the log gives me the following output:

Jun 12 08:39:26 hagi /usr/sbin/kamailio[32497]: INFO: <script>: REQUEST:
Open branches: <null> T=1016908e0
Jun 12 08:39:26 hagi /usr/sbin/kamailio[32497]: INFO: <script>: REQUEST:
branches avp is NOT defined
Jun 12 08:39:26 hagi /usr/sbin/kamailio[32497]: INFO: <script>: REQUEST:
branches avp is now: 1 T=1016908e0
[..]
Jun 12 08:39:31 hagi /usr/sbin/kamailio[32499]: NOTICE: <script>: reply:
486 Busy Here - M=INVITE F=sip:021163555552 at sipgate.de T=
sip:1016908e0 at sipgate.de SRCIP=217.10.66.131:5070
Jun 12 08:39:31 hagi /usr/sbin/kamailio[32499]: INFO: <script>: REPLY:
Number of open branches: 18446744073709551613 T=1016908e0

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.

Do you have any idea, why Kamailio is doing this?

Best Regards,
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140612/c7be3fb7/attachment.html>


More information about the sr-users mailing list