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-
Hi all
I had a mistake in the branch routes, which caused the AVP not to get added to the stack in a case. That's why I had such a hard time with the indexes being all over the place.
Mit freundlichen Grüssen
-Benoît Panizzon-