debug=3
fork=yes
log_stderror=no

auto_aliases=no

tcp_connection_lifetime=3605
tcp_accept_no_cl=yes

mpath="/usr/local/lib64/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/"
loadmodule "/usr/local/lib64/kamailio/modules_k/xlog.so"
loadmodule "/usr/local/lib64/kamailio/modules/db_mysql.so"
loadmodule "/usr/local/lib64/kamailio/modules/sl.so"
loadmodule "/usr/local/lib64/kamailio/modules_k/pv.so"
loadmodule "/usr/local/lib64/kamailio/modules/xhttp.so"
loadmodule "/usr/local/lib64/kamailio/modules/xhttp_rpc.so"
 modparam("xhttp_rpc", "xhttp_rpc_root", "http_rpc")
loadmodule "/usr/local/lib64/kamailio/modules/xhttp_pi.so"
 modparam("xhttp_pi", "xhttp_pi_root", "http_pi")
 modparam("xhttp_pi", "framework", "/usr/local/etc/kamailio/pi_framework.xml")

route{
	exit;
}

event_route[xhttp:request] {
	$var(xhttp_rpc_root) = $(hu{s.substr,0,9});
	if ($var(xhttp_rpc_root) == "/http_rpc") {
		dispatch_xhttp_rpc();
	}
	$var(xhttp_rpc_root) = $(hu{s.substr,0,8});
	if ($var(xhttp_rpc_root) == "/http_pi") {
		dispatch_xhttp_pi();
	}
	else
		xhttp_reply("200", "OK", "text/html",
        		"<html><body>Wrong URL $hu</body></html>");
}