#
# iptel.org real world configuration for secondary host
#
# $Id$
#

debug=4          # debug level (cmd line: -dddddddddd)
#fork=yes
fork=no
#log_stderror=no	# (cmd line: -E)
log_stderror=yes	# (cmd line: -E)
check_via=yes     # (cmd. line: -v)
dns=on           # (cmd. line: -r)
rev_dns=yes      # (cmd. line: -R)
port=5060
children=1

# advertise IP address in Via (as opposed to advertising DNS name
# which is annoying for downstream servers and some phones can
# not handle DNS at all)
listen=195.37.77.100

loadmodule "../sip_router/modules/sl/sl.so"
loadmodule "../sip_router/modules/print/print.so"
loadmodule "../sip_router/modules/tm/tm.so"
loadmodule "../sip_router/modules/acc/acc.so"
loadmodule "../sip_router/modules/rr/rr.so"
loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
loadmodule "../sip_router/modules/mysql/mysql.so"
loadmodule "../sip_router/modules/usrloc/usrloc.so"
loadmodule "../sip_router/modules/auth/auth.so"
loadmodule "../sip_router/modules/cpl/cpl.so"

modparam("usrloc", "use_database",   1)
modparam("usrloc", "use_database",   0)

modparam("usrloc", "table",          "location")
modparam("usrloc", "user_column",    "user")
modparam("usrloc", "contact_column", "contact")
modparam("usrloc", "expires_column", "expires")
modparam("usrloc", "q_column",       "q")
modparam("usrloc", "callid_column",  "callid")
modparam("usrloc", "cseq_column",    "cseq")
modparam("usrloc", "flush_interval", 60)
modparam("usrloc", "db_url",         "sql://csps:47csps11@dbhost/csps107")

modparam("auth", "db_url",         "sql://csps:47csps11@dbhost/csps107")
modparam("auth", "table",         "subscriber")
modparam("auth", "user_column",         "user")

modparam("acc", "report_ack", 1)
modparam("acc", "early_media", 1)
modparam("acc", "log_level", 1)
modparam("acc", "acc_flag", 1 )
modparam("acc", "failed_transactions", 1 )

modparam("tm", "fr_timer", 10 )
modparam("tm", "fr_inv_timer", 30 )


route{


	# filter local stateless ACK generated by authentication of mf replies
	sl_filter_ACK();

	# filter too old messages
        log("Checking maxfwd\n");
	if (!mf_process_maxfwd_header("10")) {
		log("Too many hops\n");
		sl_send_reply("483","Too Many Hops");
		break;
	};

	# Do strict routing if route headers present
	rewriteFromRoute();

	sethost("iptel.org");
	if (uri=~"sip:0") 
		setflag(1);

	if (method=="INVITE")
		addRecordRoute();

	# we now know we may, we now where, let it go out now!
	t_relay();
}

