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=2
check_via=no      # (cmd. line: -v)
dns=off           # (cmd. line: -r)
rev_dns=off       # (cmd. line: -R)
port=5070
listen=193.175.132.142
# for more info: sip_router -h

#modules
loadmodule "modules/print/print.so"
loadmodule "modules/textops/textops.so"
loadmodule "modules/maxfwd/maxfwd.so"
loadmodule "modules/sl/sl.so"
loadmodule "modules/tm/tm.so"
loadmodule "modules/im/im.so"
loadmodule "modules/sms/sms.so"


modparam("sms","modems","Falcom [d=/dev/ttyS1;b=9600;p=9254;m=new;l=2;r=1] ")
modparam("sms","networks","D1[c=491710765000;m=10]")
modparam("sms","links","Falcom[D1] ")
#modparam("sms","domain","hope.fokus.gmd.de")
modparam("sms","max_sms_parts",3)
modparam("sms","use_contact",1)
modparam("sms","sms_report_type",2)

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

	if (uri=~"sip:(\+[0-9]+@)?fesarius\.fokus\.gmd\.de"
	  | uri=~"sip:(\+[0-9]+@)?193\.175\.132\.142")
	{
		if (method=="MESSAGE")
		{
			log("MESSAGE received -> sending as sms\n");
			if (sms_send_msg_to_net("D1"))
			{
				sl_send_reply("200","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;
	};


	sl_send_reply("502","Not Implemented");
	#forward(uri:host,uri:port);
}