# ----------- global configuration parameters ------------------------
debug=3
log_facility=LOG_LOCAL7
fork=yes
log_stderror=no
children=5
check_via=yes
dns=no
rev_dns=no
#dns_use_search_list=no
#dns_servers_no=2
disable_dns_blacklist=true
listen=X.X.X.X:5060
alias="cacti.dev.lcl"
alias="X.X.X.X"
# ------------------ module loading ----------------------------------
#set module path
mpath="/usr/local/lib/openser/modules/"
loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "xlog.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "domain.so"
loadmodule "acc.so"
loadmodule "uri_db.so"
loadmodule "alias_db.so"
loadmodule "avpops.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "timer_interval", 3)
# -- auth params --
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
# -- define db connection for other modules --
modparam("acc|auth_db|avpops|group|speeddial|uri_db|usrloc|domain|alias_db", "db_url", "mysql://USERNAME:PASSWORD@localhost/openser")
modparam("mysql", "auto_reconnect", 1)
modparam("mysql", "ping_interval", 300)
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# -- acc params --
modparam("acc", "log_level", 1)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 3)
# -- tm params --
modparam("tm", "fr_timer", 35)
modparam("tm", "fr_inv_timer", 30)
modparam("tm", "noisy_ctimer", 1)
# -- avp params --
modparam("avpops", "avp_table", "usr_preferences")
# ------------------------- request routing logic -------------------
# main routing logic
route{
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
exit;
};
if (!method=="REGISTER")
record_route();
if (loose_route()) {
append_hf("P-hint: rr-enforced\r\n");
route(1);
};
if (!uri==myself) {
append_hf("P-hint: outbound\r\n");
route(1);
};
if(method!="REGISTER" && method!="ACK")
{
setflag(1);
};
#do not send to voicemail if BYE or CANCEL
#is used to end call before user pickup or timeout
if(method=="CANCEL" || method=="BYE")
{
setflag(10);
};
#if (uri==myself) {
if (method=="ACK") {
route(1);
exit;
} if (method=="CANCEL") {
route(1);
exit;
} if (method=="INVITE") {
route(3);
exit;
} else if (method=="REGISTER") {
route(2);
exit;
};
#}
route(1);
}
route[1] {
xlog("L_INFO", "START ROUTE 1\n");
if (!t_relay()) {
sl_reply_error();
};
}
route[2] {
sl_send_reply("100", "Trying");
if (!www_authorize("","subscriber")) {
www_challenge("","0");
exit;
}
if (!check_to()) {
sl_send_reply("403", "Spoofed To-URI Detected");
exit;
}
consume_credentials();
if (!save("location")) {
sl_reply_error();
}
}
route[3] {
xlog("L_INFO", "START ROUTE 3\n");
if (!is_uri_host_local()) {
route(1);
return;
};
if (!lookup("location")) {
route(4);
return;
};
t_on_failure("1");
route(1);
}
route[4] {
xlog("L_INFO", "ROUTE BLOCK 4\n");
if (!proxy_authorize("cacti.dev.lcl","subscriber")) {
proxy_challenge("cacti.dev.lcl","0");
return;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return;
};
xlog("L_INFO", "Call OUT\n");
rewritehostport("127.0.0.1:5065");
# append_branch();
t_on_failure("1");
route(1);
}
failure_route[1] {
xlog("L_INFO", "FAILURE ROUTE 1\n");
if (t_check_status("487")) {
return;
};
}