examples/onr.cfg
468bf60b
 #
 # $Id$
 #
 # example script showing both types of forking;
0e3e0fbf
 # incoming message is forked in parallel to
468bf60b
 # 'nobody' and 'parallel', if no positive reply
 # appears with final_response timer, nonsense
 # is retried (serial forking); than, destination
 # 'foo' is given last chance
 
 # ------------------ module loading ----------------------------------
 
0e3e0fbf
 loadmodule "modules/sl/sl.so"
 loadmodule "modules/tm/tm.so"
468bf60b
 
 # ----------------- setting module-specific parameters ---------------
 
 # -- tm params --
0e3e0fbf
 # set time for which ser will be waiting for a final response;
 # fr_inv_timer sets value for INVITE transactions, fr_timer
 # for all others
 modparam("tm", "fr_inv_timer", 15 )
468bf60b
 modparam("tm", "fr_timer", 10 )
 
 # -------------------------  request routing logic -------------------
 
 # main routing logic
 
 route{
 	# for testing purposes, simply okay all REGISTERs
 	if (method=="REGISTER") {
 		log("REGISTER");
 		sl_send_reply("200", "ok");
 		break;
 	};
0e3e0fbf
 	# try these two destinations first in parallel; the second
 	# destination is targeted to sink port -- that will make ser
 	# wait until timer hits
468bf60b
 	seturi("sip:nobody@iptel.org");
 	append_branch("sip:parallel@iptel.org:9");
0e3e0fbf
 	# if we do not get a positive reply, continue at reply_route[1]
87405423
 	t_on_failure("1");
0e3e0fbf
 	# forward the request to all destinations in destination set now 
468bf60b
 	t_relay();
 }
 
87405423
 failure_route[1] {
0e3e0fbf
 	# forwarding failed -- try again at another destination 
 	append_branch("sip:nonsense@iptel.org");
468bf60b
 	log(1,"first redirection\n");
0e3e0fbf
 	# if this alternative destination fails too, proceed to reply_route[2] 
87405423
 	t_on_failure("2");
c96013a1
 	t_relay();
468bf60b
 }
 
87405423
 failure_route[2] {
0e3e0fbf
 	# try out the last resort destination
 	append_branch("sip:foo@iptel.org");
468bf60b
 	log(1, "second redirection\n");
0e3e0fbf
 	# we no more call t_on_negative here; if this destination
 	# fails too, transaction will complete
c96013a1
 	t_relay();
468bf60b
 }