Hi Ibrahim,
use xlog() to debug the script and to see if the t_on_failure() is
triggered.
regards,
bogdan
Ibrahim Hamouda wrote:
Hi Guys
Could somebody kindly review my openser configuration file below,
and tell me why the call never reaches the failure_route.
I'm using openser 1.2
Thanks
debug=3
fork=no
log_stderror=yes
listen=10.10.10.10 # INSERT YOUR IP ADDRESS HERE
port=5060
children=4
dns=no
rev_dns=no
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 "auth.so"
loadmodule "auth_db.so"
loadmodule "uri.so"
loadmodule "uri_db.so"
loadmodule "domain.so"
loadmodule "mediaproxy.so"
loadmodule "nathelper.so"
loadmodule "textops.so"
loadmodule "avpops.so"
loadmodule "permissions.so"
loadmodule "mi_fifo.so"
loadmodule "xlog.so"
modparam("auth_db|permissions|uri_db|usrloc|domain",
"db_url", "mysql://openser:ngtgmn@localhost/openser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "natping_interval", 0)
modparam("mediaproxy","natping_interval", 30)
modparam("mediaproxy","mediaproxy_socket",
"/var/run/mediaproxy.sock")
modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients")
modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients")
modparam("usrloc", "db_mode", 2)
#modparam("registrar", "nat_flag", 6)
modparam("rr", "enable_full_lr", 1)
modparam("tm", "fr_inv_timer", 27)
modparam("tm", "fr_inv_timer_avp", "i:30")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("avpops", "avp_url",
"mysql://openser:ngtgmn@localhost/openser")
modparam("avpops", "avp_table", "usr_preferences")
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
route {
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
return(0);
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
return(0);
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method=="INVITE" && client_nat_test("3")) {
# INSERT YOUR IP ADDRESS HERE
record_route_preset("10.10.10.10:5060;nat=yes");
} else if (method!="REGISTER") {
record_route();
};
# -----------------------------------------------------------------
# Call Tear Down Section
# -----------------------------------------------------------------
if (method=="BYE" || method=="CANCEL") {
end_media_session();
};
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
if ((method=="INVITE" || method=="REFER") && !has_totag())
{
sl_send_reply("403", "Forbidden");
return(0);
};
if (method=="INVITE") {
if (!allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return(0);
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return(0);
};
consume_credentials();
};
if
(client_nat_test("3")||search("^Route:.*;nat=yes")){
setflag(6);
use_media_proxy();
};
};
route(1);
return(0);
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (!is_uri_host_local()) {
if (is_from_local() || allow_trusted()) {
route(4);
route(1);
} else {
sl_send_reply("403", "Forbidden");
};
return(0);
};
if (method=="ACK") {
route(1);
return(0);
} if (method=="CANCEL") {
route(1);
return(0);
} else if (method=="INVITE") {
route(3);
return(0);
} else if (method=="REGISTER") {
route(2);
return(0);
};
lookup("aliases");
if (!is_uri_host_local()) {
route(4);
route(1);
return(0);
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
return(0);
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[2] {
# -----------------------------------------------------------------
# REGISTER Message Handler
# -----------------------------------------------------------------
sl_send_reply("100", "Trying");
if (!search("^Contact:[ ]*\*") && client_nat_test("7")) {
setflag(6);
fix_nated_register();
force_rport();
};
if (!www_authorize("","subscriber")) {
www_challenge("","0");
return(0);
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
return(0);
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
if (client_nat_test("3")) {
setflag(7);
force_rport();
fix_nated_contact();
};
if (!allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return(0);
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return(0);
};
consume_credentials();
};
lookup("aliases");
if (!is_uri_host_local()) {
route(4);
route(1);
return(0);
};
if (uri=~"^sip:011[0-9]*@") {
route(4);
route(5);
return(0);
};
if (avp_db_query("SELECT value FROM usr_preferences WHERE username =
'$rU' and attribute = 'callfwd'")) {
if (is_avp_set("$avp(i:1)")) {
setflag(22);
avp_pushto("$ru", "$avp(i:1)");
avp_delete("$avp(i:1)");
route(6);
return(0);
};
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
route(4);
route(5);
return(0);
};
sl_send_reply("404", "User Not Found");
return(0);
};
if (avp_db_query("SELECT value FROM usr_preferences WHERE username =
'$rU' and attribute = 'fwdnoanswer'")) {
if (is_avp_set("$avp(i:1)")) {
xlog("L_INFO", "Found no answer attribute
[$avp(i:1)]\n");
avp_delete("$avp(i:1)");
setflag(27);
};
};
if (avp_db_query("SELECT value FROM usr_preferences WHERE username =
'$rU' and attribute = 'fwdbusy'")) {
if (is_avp_set("$avp(i:1)")) {
setflag(26);
};
};
t_on_failure("1");
route(4);
route(1);
}
route[4] {
# -----------------------------------------------------------------
# NAT Traversal Section
# -----------------------------------------------------------------
if (isflagset(6) || isflagset(7)) {
if (!isflagset(8)) {
setflag(8);
use_media_proxy();
};
};
}
route[5] {
# -----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
rewritehost("10.10.10.11"); # INSERT YOUR PSTN GATEWAY IP ADDRESS
# avp_printf("i:5", "s:inv_timeout");
t_on_failure("1");
route(1);
}
route[6] {
#
------------------------------------------------------------------------
# Call Forwarding Reply Route Handler
#
# This must be done as a route block because sl_send_reply() cannot
be
# called from the failure_route block
#
------------------------------------------------------------------------
lookup("aliases");
if (!is_uri_host_local()) {
if (!isflagset(22)) {
append_branch();
};
route(4);
route(1);
return(0);
};
if (uri=~"^sip:011[0-9]*@") {
route(4);
route(5);
return(0);
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
route(4);
route(1);
return(0);
};
sl_send_reply("404", "User Not Found");
};
route(4);
route(1);
}
onreply_route[1] {
if ((isflagset(6) || isflagset(7)) &&
(status=~"(180)|(183)|2[0-9][0-9]")) {
if (!search("^Content-Length:[ ]*0")) {
use_media_proxy();
};
};
if (client_nat_test("1")) {
fix_nated_contact();
};
}
failure_route[1] {
xlog("L_INFO", "Reached failure route\n");
if (t_check_status("487")) {
return(0);
};
if (isflagset(26) && t_check_status("486")) {
if (avp_db_query("SELECT value FROM usr_preferences WHERE
username = '$rU' and attribute = 'fwdbusy'")) {
if (is_avp_set("$avp(i:1)")) {
avp_pushto("$ru", "$avp(i:1)");
avp_delete("$avp(i:1)");
resetflag(26);
route(6);
return(0);
};
};
};
if (isflagset(27) && t_check_status("408")) {
xlog("L_INFO", "Reached no answer route\n");
if (avp_db_query("SELECT value FROM usr_preferences WHERE
username = '$rU' and attribute = 'fwdnoanswer'")) {
if (is_avp_set("$avp(i:1)")) {
xlog("L_INFO", "Processing answer route\n");
avp_pushto("$ru", "$avp(i:1)");
avp_delete("$avp(i:1)");
resetflag(27);
route(6);
return(0);
};
};
};
end_media_session();
}
Ibrahim Hamouda
_______________________________________________
Users mailing list
Users(a)openser.org
http://openser.org/cgi-bin/mailman/listinfo/users