loadmodule "sl"
loadmodule "xlog"
loadmodule "maxfwd"
loadmodule "carrierroute"
loadmodule "pv"
loadmodule "mi_fifo"

modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")

modparam("carrierroute", "config_file", "carrierroute.cfg")

request_route {
	# initial sanity checks
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483","Too Many Hops");
		return;
	};
	if (method == "REGISTER") {
		if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(s:30)")) {
			sl_send_reply("403", "Not allowed");
		}
		sl_send_reply("200", "OK");
		return;
	}
	if (method == "INVITE") {
		if(!cr_route("default", "proxy", "$rU", "$rU", "call_id")) {
			sl_send_reply("403", "Not allowed");
		}
		sl_send_reply("100", "Trying");
		return;
	}
}