[OpenSIPS-Users] Parallel forking and per branch AVPs explanations

Samuel Muller sml at l33.fr
Fri Dec 7 12:53:19 CET 2012


Thanks Bogdan for your answer.

I tried several things since, I understood that :
    $branch = $ru;
    append_branch();
makes 2 branches, so everything is duplicated.

I removed $branch = $ru; it's better now, but I had again 1 duplicated
branch : the 0 and the last one in the loop.

This worked for me :
$var(j) = $(avp(callee_fork){param.count}) - 1;
if ($var(i) < $var(j)) {
    append_branch();
}

then, what I did mistake, is that I've to do manipulations into my loop and
set up branch flags accordingly.
so, I've now a huge loop process :(

There are 2 little things I don't understand yet :

1/ in the branch route where I send the result of the loop :
branch_route[1] {
    xlog("L_NOTICE","br1: engage branch $T_branch_idx to $ru");
    ...
}

I got this ERROR line for each branch :
opensips[15295]: ERROR:tm:pv_get_tm_ruri: BUG: _tm_branch_index greater
than nr_of_outgoings

2/ accounting

I've really something clean for the INVITE using Sip-Leg-Dst / Sip-Leg-Src,
each R-URI branch is correctly added.
but ... nothing in the BYE or CANCEL (independently of the direction of the
request).
I can not know which branch answered, and nothing in the accounting logs
that indicates which one I've to account - I've only the first request URI
of the INVITE, and no information about the callee behind the hunting group
that I've to use.

How can I get that ?

Thank you,


*.Sam.*



On Thu, Dec 6, 2012 at 6:40 PM, Bogdan-Andrei Iancu <bogdan at opensips.org>wrote:

> **
> Hi Samuel,
>
> It is not clear from your script snapshots where you are supposed to set
> the bflags 11 and 28.
>
> The idea is that you create all the additional branches (as normally you
> have the RURI - mandatory - plus some optional additional branches) in that
> "while" loop. In the request route you are doing changes only over the RURI
> (and not over the additional branches). Accessing the already created
> branches can be done via the $branch[] variables only.
>
> Regards,
>
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developerhttp://www.opensips-solutions.com
>
>
> On 12/05/2012 06:08 PM, Samuel Muller wrote:
>
> Hello,
>
> I'm looking for explanations about parallel forking and branch flags.
> I'm deeply annoyed by this feature ...
>
> I need to set up different parameters (like rtpproxy, from display,
> accounting, ...) per contact.
>
> actually, I retrieve a list of contact using an AVP, in the format that
> the core function "while" can use.
>
> It's working fine when there are no manipulation or no (new) callee
> parameters to add :
>
> route[FORK] {
>     xlog("L_NOTICE","parallel fork requested");
>     $var(i) = 0;
>     while ($var(i) < $(avp(callee_fork){param.count})) {
>             $avp(callee_uri) = $(avp(callee_fork){param.valueat,$var(i)});
>             $ru = $avp(callee_uri);
>             $avp(callee_username) = $rU;
>             $avp(callee_realm) = $rd;
>             setbflag(27);
>             lookup("location","mb");
>             setflag(9);
>             $branch = $ru;
>             append_branch();
>             $var(i) = $var(i) + 1;
>     }
>     route(RTPPROXY);   # rtp proxy set = bflag 11
>     route(ACCOUNTING); # accounting using $rU. $ru, ...
>     route(RELAY);
>     exit;
> }
> route[RELAY] {
>     t_on_branch("1");
>     t_on_reply("1");
>     t_on_failure("1");
>     t_relay("0x01");
>     exit;
> }
>
> At this point, I'm totally lost :
> I have to check if a callee need to use rtpproxy, set up the accounting,
> change the "from" display based on the destination (PSTN vs. local
> subscriber), and so on.
> Everything failed, the parameters are always global (based on the
> branch("0")) even if I use branch flag, script flag, or do anything into
> the branch route.
>
> branch_route[1] {
>     xlog("L_NOTICE","br1: engage branch $T_branch_idx with R-URI: $T_ruri
> ($ru)");
>     xlog("L_NOTICE","br1: dest set: $ds / dest uri: $du");
>     if (isbflagset(11)) {
>         xlog("L_NOTICE","br1: rtp proxy set to \"cr\"");
>         engage_rtp_proxy("cr");
>     }
>     if (isbflagset(28)) {
>             uac_replace_from("$avp(caller_cli)","");
>         }
>     }
> }
>
> did I missed something ???
>
> Thanks to light my fire, I really need it ...
>
> .Sam.
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20121207/1fbe7ee2/attachment.htm>


More information about the Users mailing list