Thanks Bogdan. Will definitely try this out.<div><br></div><div>--- Jayesh<span></span><br><br>On Monday, September 3, 2012, Bogdan-Andrei Iancu wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<div bgcolor="#ffffff" text="#000000">
<tt>Hi Jayesh,<br>
<br>
See my inline comments.<br>
<br>
Regards,</tt><br>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
<br>
On 08/31/2012 03:02 PM, Jayesh Nambiar wrote:
<blockquote type="cite">
<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>
</blockquote>
You do not need this last line as the $ru will be automatically be
considered branch 0.<br>
<br>
<blockquote type="cite">
<div class="gmail_quote">
<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>
</blockquote>
This is correct, you are arming the branch 1, which will be executed
inside t_relay(), once for each branch.<br>
<br>
<blockquote type="cite">
<div class="gmail_quote">
<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>
</blockquote>
See $T_branch_idx
(<a href="http://www.opensips.org/html/docs/modules/1.8.x/tm.html#id294499" target="_blank">http://www.opensips.org/html/docs/modules/1.8.x/tm.html#id294499</a>)<br>
<br>
<blockquote type="cite">
<div class="gmail_quote">
<div> uac_replace_from("<a>sip:$avp(cli)@</a><a href="http://mydomain.com" target="_blank">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:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);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="javascript:_e({}, 'cvml', 'jayesh.voip@gmail.com');" target="_blank">jayesh.voip@gmail.com</a>>
wrote:<br>
<br>
From: Jayesh Nambiar <<a href="javascript:_e({}, 'cvml', 'jayesh.voip@gmail.com');" target="_blank">jayesh.voip@gmail.com</a>><br>
Subject: [OpenSIPS-Users] Parallel forking and per branch
manipulation<br>
To: "OpenSIPS users mailling list" <<a href="javascript:_e({}, 'cvml', 'users@lists.opensips.org');" target="_blank">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="javascript:_e({}, 'cvml', 'sip%3A123456789@1.2.3.4');" target="_blank">sip:123456789@1.2.3.4</a>"),
and insert_hf("P-Asserted_Identity: <a href="javascript:_e({}, 'cvml', 'sip%3A123456789@1.2.3.4');" target="_blank">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>
<pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a href="javascript:_e({}, 'cvml', 'Users@lists.opensips.org');" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
</blockquote></div>