<div class="gmail_quote"><div>Hi Binan,</div><div>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:</div>
<div><br></div><div>lookup("location");</div><div>$branch = $ru;</div><div><br></div><div>avp_db_query("SELECT cli, phone_number FROM users WHERE user_id = '$rU', "$avp(cli), $avp(parallel_number)");</div>
<div>$rU = $avp(parallel_number);</div><div>$rd = my_gateway_ip;</div><div>$var(uri) = "sip:"+$rU+"@"+$rd;</div><div><br></div><div>$branch = $var(ruri);</div><div><br></div><div>t_on_branch("1"); # --This is confusing me---</div>
<div>t_relay();</div><div>exit;</div><div><br></div><div>branch_route[1] { #---Need to know how to check for branch id here---</div><div> if(branch_id == 1) { #--- How do I check for this condition??</div><div> uac_replace_from("sip:$avp(cli)@<a href="http://mydomain.com">mydomain.com</a>");</div>
<div> }</div><div>}</div><div><br></div><div>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.</div>
<div>Isn't there any straight forward way of checking the id of the branch when it comes to the branch route??</div><div><br></div><div>Any help is really appreciated. Thanks.</div><div><br></div><div>--- Jayesh</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
lets say you have 2 branches 0 towards user in location and 1 towards PSTN.<br>
?<br>
I suggest to use branch flags which are used to activate some functions in branch level<br>
<br>
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.<br>
<br>
use branch routing blocks to execute certain logic (it could be the manipulation ) for each branch before forwarding the request.<br>
<br>
// Binan<br>
<br>
--- On Thu, 8/30/12, Jayesh Nambiar <<a href="mailto:jayesh.voip@gmail.com">jayesh.voip@gmail.com</a>> wrote:<br>
<br>
From: Jayesh Nambiar <<a href="mailto:jayesh.voip@gmail.com">jayesh.voip@gmail.com</a>><br>
Subject: [OpenSIPS-Users] Parallel forking and per branch manipulation<br>
To: "OpenSIPS users mailling list" <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br>
Date: Thursday, August 30, 2012, 8:11 AM<br>
<br>
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.?<br>
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("<a href="mailto:sip%3A123456789@1.2.3.4">sip:123456789@1.2.3.4</a>"), and insert_hf("P-Asserted_Identity: <a href="mailto:sip%3A123456789@1.2.3.4">sip:123456789@1.2.3.4</a>\r\n") before calling t_relay(). There are many other manipulations like this.<br>
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 !!<br>
<br>
Probably I am missing something on my understanding on how to call branch_routes while doing parallel forking.<br>
Thanks for any help.<br>
--- Jayesh<br>
<br></blockquote></div>