#
# configuration for TurboSIP testing
#
# $ID: $
#


debug=9          # debug level (cmd line: -dddddddddd)
#fork=yes          # (cmd. line: -D)
fork=no
log_stderror=yes  # (cmd line: -E)
#log_stderror=no   # (cmd line: -E)


children=4
check_via=no      # (cmd. line: -v)
dns=off           # (cmd. line: -r)
rev_dns=off       # (cmd. line: -R)
#port=5070
#listen=10.0.0.179
#listen=192.168.57.33
loop_checks=0
# for more info: sip_router -h

#modules
loadmodule "modules/print/print.so"
loadmodule "modules/textops/textops.so"
#loadmodule "modules/tm/tm.so"
#loadmodule "modules/rr/rr.so"
loadmodule "modules/maxfwd/maxfwd.so"
loadmodule "modules/sl/sl.so"
#loadmodule "modules/sms/sms.so"
#loadmodule "modules/cpl/cpl.so"
loadmodule "modules/pike/pike.so"


#modparam("sms","modems","Nokia [d=/dev/ttyS1;b=9600;m=new;l=30] ")
#modparam("sms","networks","  D1 [c=491710765000;m=10] ;d2[ c=3456;m=20]")
#modparam("sms","links","NOKIA[D1;d2]")

route{
	sl_filter_ACK();

	if ( !mf_process_maxfwd_header("10") )
	{
		sl_send_reply("483","To Many Hops");
		drop();
	};

/*
	if (method=="INVITE")
	{
		log("SER : runing CPL!! :)\n");
		if ( !cpl_run_script() )
		{
			log("SER : Error during running CPL script!\n");
		}else{
			if ( cpl_is_response_reject() ) {
				sl_send_reply("603","I am not available!");
				drop();
			}else if ( cpl_is_response_redirect() ) {
				log("SER : redirect\n");
				cpl_update_contact();
				sl_send_reply("302","Moved temporarily");
				drop();
			};
		};
	};
*/
/*	if (method=="INVITE" && uri=~"sip:alpha@iptel.org")
	{
		t_fork_to_uri("sip:haha@iptel.org");
	};
	if (method=="INVITE" && uri=~"sip:bogdan@iptel.org" )
	{
		t_fork_on_no_response("sip:haha@iptel.org");
	};
	if (method=="INVITE" && uri=~"sip:haha@iptel.org")
	{
		t_fork_to_uri("sip:bogdan@iptel.org");
	};
*/
/*
	if (uri=~"sip:.*@sms\.iptel\.org")
	{
		if (method=="MESSAGE")
		{
			log("MESSAGE received -> sending as sms\n");
			if (sms_send_msg_to_net("D1"))
			{
				sl_send_reply("202","Accepted");
			}else{
				sl_send_reply("502","Bad gateway");
			};
		}else{
			log("NON_Message request received for sms gateway->dropt!\n");
			sl_send_reply("501","Not implemented");
		};
		break;
	};
*/

	pike_check_req();
	forward(uri:host,uri:port);
	#t_relay();
}