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

Samuel Muller sml at l33.fr
Wed Dec 5 17:08:53 CET 2012


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20121205/e189ba8b/attachment.htm>


More information about the Users mailing list