Hi List

avp stacking is starting to drive me crazy... Somehow I don't
understand what is going on in this situation:

I have a main branch, and add two more branches with append_branch()

I use a on_branch_route trigger:

branch_route[BR_TO_CPE]
{

        [Here, some code setting $var(needbh)]

        if ("yes" == $var(needbh)) {
                xlog("L_INFO", "$cfg(route): BR_idx: $T_branch_idx BACKHAUL: 
YES to $nh(u) \n");
                add_rr_param(";rtp=yes");
                record_route();
                $avp(backhaul) = "yes";
                $avp(nexthop) = $nh(u);
                rtpengine_manage($avp(rtp_to_cpe));
        } else {
                xlog("L_INFO", "$cfg(route): BR_idx: $T_branch_idx BACKHAUL: NO 
to $nh(u) \n");
                record_route();
                $avp(backhaul) = "yes";
                $avp(nexthop) = $nh(u);
        }
}

In the Logs, I see Branches Index 0,1,2 with the desired information.
So I have 3 values stacked in the avp backhaul and nexthop, right?

When I get a reply, I would like to determine if backhauling is required or not.

onreply_route[MANAGE_REPLY]
{
        xlog("L_INFO", "MANAGE_REPLY: for BR_idx: $T_branch_idx\n");
        
        while ($(avp(nexthop)[$var(i)]) != $null) {
                xlog("L_INFO", "MANAGE_REPLY: DEBUG Branch: $T_branch_idx VAR 
IDX: $var(i) NH: $(avp(nexthop)[$var(i)]) \n");
                $var(i) = $var(i) + 1;
        }
}

So on EVERY reply, I would expect to get three "DEBUG" lines as I stacked 3 
AVP..

Bug I get only 2!

Why I am missing one of the stacked AVP? (the last one as it looks like)

Or is there any other way to access a arbitrary variable specific to a
branch on the reply to that branch?

PS: I don't need $avp(nexthop). It's just an easy way to make sure I
get the correct avp index for the branch I am interested in.

Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G    -    Leiter Commerce Kunden
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 00
CH-4133 Pratteln                Fax  +41 61 826 93 01
Schweiz                         Web  http://www.imp.ch
______________________________________________________
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to