examples/kamailio/serial_183.cfg
91301510
 #
 # $Id$
 #
 # this example shows how to use forking on failure
 #
 
 log_stderror=1
 fork=no
 listen=192.168.2.16
 debug=3
 # ------------------ module loading ----------------------------------
 
8a79b963
 #set module path
f41e32d6
 mpath="/usr/local/lib/kamailio/modules/"
8a79b963
 
91301510
 # Uncomment this if you want to use SQL database
8a79b963
 loadmodule "tm.so"
 loadmodule "sl.so"
 loadmodule "maxfwd.so"
91301510
 # -------------------------  request routing logic -------------------
 
 # main routing logic
 
 route{
 
 	# initial sanity checks -- messages with
 	# max_forwards==0, or excessively long requests
 	if (!mf_process_maxfwd_header("10")) {
 		sl_send_reply("483","Too Many Hops");
8a79b963
 		exit;
91301510
 	};
8a79b963
 	if (msg:len >=  2048 ) {
91301510
 		sl_send_reply("513", "Message too big");
8a79b963
 		exit;
91301510
 	};
 
 	/* skip register for testing purposes */
8a79b963
 	if (method=="REGISTER") { sl_send_reply("200", "ok"); exit; };
91301510
 
 	if (!method=="ACK")
 		log(1, "forwarding now to primary destination\n");
 	if (method=="INVITE") {
 		rewriteuri("sip:xxx@192.168.2.16:5064");
 		# if transaction broken, try other an alternative
 		# route
 		t_on_failure("1");
 		# if a provisional came, stop alternating
 		t_on_reply("1");
 	};
 	t_relay();
 }
 
 failure_route[1] {
 	log(1, "trying at alternate destination\n");
 	append_branch("sip:yyy@192.168.2.16:5064");
 	t_relay();
 }
 
 onreply_route[1] {
 	log(1, "reply came in\n");
 	if (status=~"18[0-9]")  {
 		log(1, "provisional -- resetting negative failure\n");
 		t_on_failure("0");
 	};
 }