Hi, I use "branch_route[1]" for common branches and want to use "branch_route[3]" just for initial INVITE's.
But I'd like "branch_route[1]" is runned after "branch_route[3]" but think is not possible, so I must copy&paste the "branch_route[1]" code at the end of "branch_route[3]".
Is it?
Thanks.
Hi,
You may also create a route[] for the common code and call that route from your branch routes.
Andreas
Iñaki Baz Castillo wrote:
Hi, I use "branch_route[1]" for common branches and want to use "branch_route[3]" just for initial INVITE's.
But I'd like "branch_route[1]" is runned after "branch_route[3]" but think is not possible, so I must copy&paste the "branch_route[1]" code at the end of "branch_route[3]".
Is it?
Thanks.
El Wednesday 17 October 2007 13:28:55 Andreas Granig escribió:
Hi,
You may also create a route[] for the common code and call that route from your branch routes.
I thougt that but have a doubt: if I call a "route(1)" from "branch_route[3]", what is processed in "route[1]"? all the branch together of each one?
So, if I do:
route { ... t_on_branch("1"); t_relay; }
branch_route[1] { if (is_method("INVITE") ) route(3); ... ... }
route[3] { ... operate_in_separate_branch here ¿?¿?¿? o in all branches together ?¿?¿?¿ }
What is processed in route[3] ?
Thanks.
You want to avoid to copy&paste redundant code in your branch-route, right? So the following snipped should do the same as if you were able to execute branch_route[1] after branch_route[3]:
route { if(/* initial invite */) t_on_branch("3"); else t_on_branch("1");
// ... }
// your branch-route helper route[20] { // some code executed by both branch routes }
// broute for common requests branch_route[1] { route(20); }
// broute for initial invites branch_route[3] { // some branch-specific stuff here, then:
route(20); }
Iñaki Baz Castillo wrote:
El Wednesday 17 October 2007 13:28:55 Andreas Granig escribió:
Hi,
You may also create a route[] for the common code and call that route from your branch routes.
I thougt that but have a doubt: if I call a "route(1)" from "branch_route[3]", what is processed in "route[1]"? all the branch together of each one?
So, if I do:
route { ... t_on_branch("1"); t_relay; }
branch_route[1] { if (is_method("INVITE") ) route(3); ... ... }
route[3] { ... operate_in_separate_branch here ¿?¿?¿? o in all branches together ?¿?¿?¿ }
What is processed in route[3] ?
Thanks.
El Wednesday 17 October 2007 14:24:46 Andreas Granig escribió:
You want to avoid to copy&paste redundant code in your branch-route, right? So the following snipped should do the same as if you were able to execute branch_route[1] after branch_route[3]:
route { if(/* initial invite */) t_on_branch("3"); else t_on_branch("1");
// ... }
// your branch-route helper route[20] { // some code executed by both branch routes }
// broute for common requests branch_route[1] { route(20); }
// broute for initial invites branch_route[3] { // some branch-specific stuff here, then:
route(20); }
Ok, thanks. Just lem me insist on a question to be sure:
If a "route[X]" is called from a "branch_route[Y]" then in that "route[X]" is just processed each separate branch and not all together as in main route, is it?
Thanks.
If a "route[X]" is called from a "branch_route[Y]" then in that "route[X]" is just processed each separate branch and not all together as in main route, is it?
Yes, changes made in route[X] are only visible to the current branch being processed. Right, Daniel?
Andreas
Hello,
On 10/17/07 15:41, Andreas Granig wrote:
If a "route[X]" is called from a "branch_route[Y]" then in that "route[X]" is just processed each separate branch and not all together as in main route, is it?
Yes, changes made in route[X] are only visible to the current branch being processed. Right, Daniel?
yes. For example, this is a way to do rtp relaying only for natted branches, or to drop a branch if does not meet some conditions.
Cheers, Daniel
Andreas
El Wednesday 17 October 2007 14:48:36 Daniel-Constantin Mierla escribió:
Hello,
On 10/17/07 15:41, Andreas Granig wrote:
If a "route[X]" is called from a "branch_route[Y]" then in that "route[X]" is just processed each separate branch and not all together as in main route, is it?
Yes, changes made in route[X] are only visible to the current branch being processed. Right, Daniel?
yes. For example, this is a way to do rtp relaying only for natted branches, or to drop a branch if does not meet some conditions.
Ok, is nice to know it. I'll add it to the wiki since is nothing about it.
Thanks a lot.