[Serusers] Support for branch_route and t_on_branch

Jan Janak jan at iptel.org
Thu Aug 18 18:49:12 CEST 2005


Hello,

The latest development version of SER has support for branch_route
sections and tm module contains new function called t_on_branch.

The branch_route section is a section that can be defined in the
configuration file, just like failure_route or onreply_route sections:

branch_route[1]
{
	if (uri == "sip:a at iptel.org") {
		append_hf("P-RURI: sip:a at iptel.org\r\n");
	};
}

branch_route sections can be activated using t_on_branch, for example:

t_on_branch("1");
t_relay();
break;

branch_route sections are executed for each downstream branch. In other
words, if SER forks a message to 3 destinations then the branch_route
section will be executed 3 times:
                 a
             +-*----->
             |   b
----> SER ---+-*----->
             |   c
	     +-*----->

* - branch_route will be executed here.

It is not possible to stop the processing or generate a reply in
branch_route sections at the moment, you can only do last-minute
modifications to the SIP message and it will be forwarded automatically
once branch_route section finishes.

branch_route sections can be used to perform actions that are branch
specific, for examply you can add a header field to a message only in a
particular branch and leave other branches unmodified, based on the
Request-URI.

In the future we could implement better NAT traversal (where RTP proxy
will only be applied to branches where it is really needed), proper PSTN
gateway checks, and so on.

Attached is a short example file that demonstrates the use of
t_on_branch and branch_route sections.

  Jan.
-------------- next part --------------
debug=9         # debug level (cmd line: -dddddddddd)

check_via=no	# (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
#port=5060
#children=4
fifo="/tmp/ser_fifo"

mhomed=yes

loadmodule "./modules/sl/sl.so"
loadmodule "./modules/tm/tm.so"
loadmodule "./modules/rr/rr.so"
loadmodule "./modules/maxfwd/maxfwd.so"
loadmodule "./modules/usrloc/usrloc.so"
loadmodule "./modules/registrar/registrar.so"
loadmodule "./modules/textops/textops.so"
loadmodule "./modules/xlog/xlog.so"

modparam("usrloc", "db_mode",   0)
modparam("rr", "enable_full_lr", 1)

route 
{
	# send it out now; use stateful forwarding as it works reliably
	# even for UDP2TCP

	xdbg("Appending branches\n");
	append_branch("sip:a at iptel.org");
	append_branch("sip:b at iptel.org");
	t_on_branch("1");
	if (!t_relay()) {
		sl_reply_error();
	};
}


branch_route[1]
{
	if (uri == "sip:a at iptel.org") {
		append_hf("Test: foo\r\n");
	};
	xdbg("Executing branch %ru\n");
}



More information about the sr-users mailing list