[OpenSIPS-Users] Parallel forking and per branch manipulation

Jayesh Nambiar jayesh.voip at gmail.com
Fri Aug 31 14:02:12 CEST 2012


Hi Binan,
Thank you very much for your reply. What you wrote is what I understand
from all the documentation present but probably the concept is not working
for me or probably just not getting into my head. This is a snippet of what
I'm trying to do:

lookup("location");
$branch = $ru;

avp_db_query("SELECT cli, phone_number FROM users WHERE user_id = '$rU',
"$avp(cli), $avp(parallel_number)");
$rU = $avp(parallel_number);
$rd = my_gateway_ip;
$var(uri) = "sip:"+$rU+"@"+$rd;

$branch = $var(ruri);

t_on_branch("1"); # --This is confusing me---
t_relay();
exit;

branch_route[1] { #---Need to know how to check for branch id here---
       if(branch_id == 1) { #--- How do I check for this condition??
              uac_replace_from("sip:$avp(cli)@mydomain.com");
       }
}

The problem is I dont know how to identify the branch id in the branch
route. Even if I set branch flag for second branch using setbflag(1,1) and
I check for this flag in the branch route using isbflagset(1,1), by the
time the first branch goes into branch_route, the second branch is created
and the condition isbflagset(1,1) becomes true and the uac_replace_from()
gets executed for first branch also. My requirement is to execute this
branch_route only for second branch which is branch_id 1.
Isn't there any straight forward way of checking the id of the branch when
it comes to the branch route??

Any help is really appreciated. Thanks.

--- Jayesh

> Hi,
>
> lets say you have 2 branches 0 towards user in location and 1 towards PSTN.
> ?
> I suggest to use branch flags which are used to activate some functions in
> branch level
>
> when creating the branches in main route use this variable $branch() to
> set branch flags to each indivisual branch depending on its index 0 for
> branch 0 and 1 for branch 1.
>
> use branch routing blocks to execute certain logic (it could be the
> manipulation ) for each branch before forwarding the request.
>
> // Binan
>
> --- On Thu, 8/30/12, Jayesh Nambiar <jayesh.voip at gmail.com> wrote:
>
> From: Jayesh Nambiar <jayesh.voip at gmail.com>
> Subject: [OpenSIPS-Users] Parallel forking and per branch manipulation
> To: "OpenSIPS users mailling list" <users at lists.opensips.org>
> Date: Thursday, August 30, 2012, 8:11 AM
>
> Hi All,I have a scenario to do parellel forking between the user found in
> location and towards a PSTN gateway. The requirement here is, I have unique
> manipulations to be done before routing the call which I believe can be
> done using branch routes, but I'm just wondering how.?
> For eg: The branch that goes to the user found from location should have
> no FROM Header manipulation and the branch that goes out to PSTN gateway
> needs a uac_replace_from("sip:123456789 at 1.2.3.4"), and
> insert_hf("P-Asserted_Identity: sip:123456789 at 1.2.3.4\r\n") before
> calling t_relay(). There are many other manipulations like this.
> How do I take the script logic to individual branch routes before calling
> t_relay, because whats happening with me is once the location is looked up,
> I go ahead for manipulations that is supposed to be done for the gateway
> branch, but it gets applicable for the branch that goes out to the user as
> well !!
>
> Probably I am missing something on my understanding on how to call
> branch_routes while doing parallel forking.
> Thanks for any help.
> --- Jayesh
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120831/129e50a1/attachment-0001.htm>


More information about the Users mailing list