Hello,
I've some issues with my mysql accounting, I can only log successful calls in the acc table and I've no informations about missed calls. In mysql accounting I've only sip 200 ok and no errors. I've not this behavior in my syslog.
It's very important for us for evaluate the performance of our providers and we can only do it with a database accouting.
For example, If I pass a call and I let it ring til operator timeout, I've no trace of this call in the accounting table.
I've also another question, the lcr and gw tables have very small fixed limits (256 for lcr and 32 for gw), since we have much more gateways and sdas I've updated theses limits to a value which fit our needs, do you thinks it can be a problem ?
Thanks in advance,
Tanguy Bouzéloc Init-Sys
# ----------- global configuration parameters ------------------------
#debug=9 fork=yes check_via=no dns=no rev_dns=no port=5060 children=4 sip_warning=0
# ------------------ module loading ----------------------------------
loadmodule "/usr/lib/openser/modules/mysql.so" loadmodule "/usr/lib/openser/modules/nathelper.so" loadmodule "/usr/lib/openser/modules/sl.so" loadmodule "/usr/lib/openser/modules/tm.so" loadmodule "/usr/lib/openser/modules/rr.so" loadmodule "/usr/lib/openser/modules/maxfwd.so" loadmodule "/usr/lib/openser/modules/lcr.so" loadmodule "/usr/lib/openser/modules/acc.so" loadmodule "/usr/lib/openser/modules/xlog.so" loadmodule "/usr/lib/openser/modules/textops.so" loadmodule "/usr/lib/openser/modules/permissions.so"
# ----------------- setting module-specific parameters ---------------
modparam("lcr", "db_url", "mysql://???") modparam("lcr", "db_mode", 0)
modparam("rr","enable_full_lr",1)
modparam("acc", "db_url", "mysql://???") modparam("acc", "db_flag", 1) modparam("acc", "db_localtime", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1 )
modparam("permissions", "db_url", "mysql://???")
route {
if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); return; };
if (msg:len >= max_len ) { sl_send_reply("513", "Message too big"); return; };
if (!is_method("REGISTER")) { record_route(); };
if (is_method("BYE") || is_method("CANCEL")) { xlog("L_NOTICE", "End call($ci | $Ri): $fU -> $tU"); if (is_method("BYE")) setflag(1); unforce_rtp_proxy(); };
if (loose_route()) { route(1); return; };
if (!allow_trusted()) { xlog("L_WARN", "Host not trusted ($fu/$si/$rP)"); sl_send_reply("403", "Forbidden"); exit; };
if (!load_gws()) { sl_send_reply("500", "Internal server error, unable to load gateways"); return; }
if (!next_gw()) { xlog("L_ERR", "No gw found ($ru/$fu)"); sl_send_reply("503", "Service not available, no gateways found"); return; };
t_on_failure("2");
route(1); }
route[1] { setflag(1);
if (is_method("INVITE") || is_method("ACK")){ if (is_method("INVITE")) xlog("L_NOTICE", "Incoming call($ci | $Ri): $fU -> $tU"); if (!search("^Content-Length:[ ]*0")) force_rtp_proxy("foc");
# if(src_ip == 217.15.85.178) { # subst('/^From:.*<sip:(.*)@(.*)$/From: "\1" <sip:\1/@\2'); # }
t_on_reply("1"); };
if (!t_relay()) { sl_reply_error(); }; }
onreply_route[1] { setflag(1); if (status=~"[12][0-9][0-9]"){ if (!search("^Content-Length:[ ]*0")) force_rtp_proxy("foc"); }; }
failure_route[2] {
if (t_check_status("400")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 400 Bad Request"); } else if (t_check_status("401")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 401 Unauthorized"); } else if (t_check_status("403")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 403 Forbidden"); } else if (t_check_status("404")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 404 Not Found"); } else if (t_check_status("405")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 405 Method Not Allowed"); } else if (t_check_status("406")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 406 Not Acceptable"); } else if (t_check_status("407")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 407 Proxy Authentication Required"); } else if (t_check_status("408")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 408 Request Timeout"); } else if (t_check_status("410")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 410 Gone"); } else if (t_check_status("413")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 413 Request Entity Too Large"); } else if (t_check_status("414")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 414 Request-URI Too Long"); } else if (t_check_status("415")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 415 Unsupported Media Type"); } else if (t_check_status("416")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 416 Unsupported URI Scheme"); } else if (t_check_status("420")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 420 Bad Extension"); } else if (t_check_status("421")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 421 Extension Required"); } else if (t_check_status("423")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 423 Interval Too Brief"); } else if (t_check_status("480")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 480 Temporarily Unavailable"); } else if (t_check_status("481")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 481 Call/Transaction Does Not Exist"); } else if (t_check_status("482")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 482 Loop Detected"); } else if (t_check_status("483")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 483 Too Many Hops"); } else if (t_check_status("484")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 484 Address Incomplete"); } else if (t_check_status("485")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 485 Ambiguous"); } else if (t_check_status("486")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 486 Busy Here"); } else if (t_check_status("487")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 487 Request Terminated"); } else if (t_check_status("488")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 488 Not Acceptable Here"); } else if (t_check_status("491")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 491 Request Pending"); } else if (t_check_status("493")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 493 Undecipherable"); } else if (t_check_status("500")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 500 Server Internal Error"); } else if (t_check_status("501")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 501 Not Implemented"); } else if (t_check_status("502")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 502 Bad Gateway"); } else if (t_check_status("503")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 503 Service Unavailable"); } else if (t_check_status("504")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 504 Server Time-out"); } else if (t_check_status("505")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 505 Version Not Supported"); } else if (t_check_status("513")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 513 Message Too Large"); } else { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU Unknown code"); }
setflag(1);
if (is_method("INVITE") && t_check_status("408|500|503")) { if (!next_gw()) { xlog("L_ERR", "No more gw ($ru/$fu)"); t_reply("486", "Busy"); # t_reply("503", "Service not available"); exit; } t_on_failure("2"); force_rtp_proxy("foc"); t_relay(); } }
Hello
better use these function
acc_db_request("200","acc");
On 4/11/07, Tanguy Bouzéloc tbouzeloc@init-sys.com wrote:
Hello,
I've some issues with my mysql accounting, I can only log successful calls in the acc table and I've no informations about missed calls. In mysql accounting I've only sip 200 ok and no errors. I've not this behavior in my syslog.
It's very important for us for evaluate the performance of our providers and we can only do it with a database accouting.
For example, If I pass a call and I let it ring til operator timeout, I've no trace of this call in the accounting table.
I've also another question, the lcr and gw tables have very small fixed limits (256 for lcr and 32 for gw), since we have much more gateways and sdas I've updated theses limits to a value which fit our needs, do you thinks it can be a problem ?
Thanks in advance,
Tanguy Bouzéloc Init-Sys
# ----------- global configuration parameters ------------------------
#debug=9 fork=yes check_via=no dns=no rev_dns=no port=5060 children=4 sip_warning=0
# ------------------ module loading ----------------------------------
loadmodule "/usr/lib/openser/modules/mysql.so" loadmodule "/usr/lib/openser/modules/nathelper.so" loadmodule "/usr/lib/openser/modules/sl.so" loadmodule "/usr/lib/openser/modules/tm.so" loadmodule "/usr/lib/openser/modules/rr.so" loadmodule "/usr/lib/openser/modules/maxfwd.so" loadmodule "/usr/lib/openser/modules/lcr.so" loadmodule "/usr/lib/openser/modules/acc.so" loadmodule "/usr/lib/openser/modules/xlog.so" loadmodule "/usr/lib/openser/modules/textops.so" loadmodule "/usr/lib/openser/modules/permissions.so"
# ----------------- setting module-specific parameters ---------------
modparam("lcr", "db_url", "mysql://???") modparam("lcr", "db_mode", 0)
modparam("rr","enable_full_lr",1)
modparam("acc", "db_url", "mysql://???") modparam("acc", "db_flag", 1) modparam("acc", "db_localtime", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1 )
modparam("permissions", "db_url", "mysql://???")
route {
if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); return; }; if (msg:len >= max_len ) { sl_send_reply("513", "Message too big"); return; }; if (!is_method("REGISTER")) { record_route(); }; if (is_method("BYE") || is_method("CANCEL")) { xlog("L_NOTICE", "End call($ci | $Ri): $fU -> $tU"); if (is_method("BYE")) setflag(1); unforce_rtp_proxy(); }; if (loose_route()) { route(1); return; }; if (!allow_trusted()) { xlog("L_WARN", "Host not trusted ($fu/$si/$rP)"); sl_send_reply("403", "Forbidden"); exit; }; if (!load_gws()) { sl_send_reply("500", "Internal server error, unable to
load gateways"); return; }
if (!next_gw()) { xlog("L_ERR", "No gw found ($ru/$fu)"); sl_send_reply("503", "Service not available, no gateways
found"); return; };
t_on_failure("2"); route(1);
}
route[1] { setflag(1);
if (is_method("INVITE") || is_method("ACK")){ if (is_method("INVITE")) xlog("L_NOTICE", "Incoming call($ci | $Ri): $fU ->
$tU"); if (!search("^Content-Length:[ ]*0")) force_rtp_proxy("foc");
# if(src_ip == 217.15.85.178) { # subst('/^From:.*<sip:(.*)@(.*)$/From: "\1" <sip:\1/@\2'); # }
t_on_reply("1"); }; if (!t_relay()) { sl_reply_error(); };
}
onreply_route[1] { setflag(1); if (status=~"[12][0-9][0-9]"){ if (!search("^Content-Length:[ ]*0")) force_rtp_proxy("foc"); }; }
failure_route[2] {
if (t_check_status("400")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 400
Bad Request"); } else if (t_check_status("401")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 401 Unauthorized"); } else if (t_check_status("403")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 403 Forbidden"); } else if (t_check_status("404")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 404 Not Found"); } else if (t_check_status("405")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 405 Method Not Allowed"); } else if (t_check_status("406")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 406 Not Acceptable"); } else if (t_check_status("407")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 407 Proxy Authentication Required"); } else if (t_check_status("408")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 408 Request Timeout"); } else if (t_check_status("410")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 410 Gone"); } else if (t_check_status("413")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 413 Request Entity Too Large"); } else if (t_check_status("414")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 414 Request-URI Too Long"); } else if (t_check_status("415")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 415 Unsupported Media Type"); } else if (t_check_status("416")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 416 Unsupported URI Scheme"); } else if (t_check_status("420")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 420 Bad Extension"); } else if (t_check_status("421")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 421 Extension Required"); } else if (t_check_status("423")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 423 Interval Too Brief"); } else if (t_check_status("480")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 480 Temporarily Unavailable"); } else if (t_check_status("481")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 481 Call/Transaction Does Not Exist"); } else if (t_check_status("482")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 482 Loop Detected"); } else if (t_check_status("483")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 483 Too Many Hops"); } else if (t_check_status("484")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 484 Address Incomplete"); } else if (t_check_status("485")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 485 Ambiguous"); } else if (t_check_status("486")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 486 Busy Here"); } else if (t_check_status("487")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 487 Request Terminated"); } else if (t_check_status("488")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 488 Not Acceptable Here"); } else if (t_check_status("491")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 491 Request Pending"); } else if (t_check_status("493")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 493 Undecipherable"); } else if (t_check_status("500")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 500 Server Internal Error"); } else if (t_check_status("501")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 501 Not Implemented"); } else if (t_check_status("502")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 502 Bad Gateway"); } else if (t_check_status("503")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 503 Service Unavailable"); } else if (t_check_status("504")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 504 Server Time-out"); } else if (t_check_status("505")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 505 Version Not Supported"); } else if (t_check_status("513")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 513 Message Too Large"); } else { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU Unknown code"); }
setflag(1); if (is_method("INVITE") && t_check_status("408|500|503")) { if (!next_gw()) { xlog("L_ERR", "No more gw ($ru/$fu)"); t_reply("486", "Busy");
# t_reply("503", "Service not available"); exit; } t_on_failure("2"); force_rtp_proxy("foc"); t_relay(); } }
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
raviprakash sunkara wrote:
Hello
better use these function
acc_db_request("200","acc");
Can somebody explain me some OpenSER logic?
So if I have following config (simplified):
--------------- cut here ------------------ modparam("acc", "db_flag", 1) modparam("acc", "failed_transaction_flag", 1)
route {
setflag(1);
if ( ! lookup("location") ) { sl_send_reply("404", "Not found"); exit; }
route(1); } --------------- /cut here ------------------
can I expect that calls to not registered users (lookup() return FALSE) will be accounted?
if NOT -- so, what is it means "failed_transaction_flag" and "db_missed_flag" ? What is it means "missed calls": user does not respond? or user busy? or user not registered?
If locally generated reply does not considered as failed transaction (I think it's because I still haven't transaction at this moment) can I manually create transaction by t_newtran() and expect that it will be considered by ACC-module as "failed_transaction" ?
(yes I red documentation but I still don't understand some logic)
Hi Victor,
automatic accounting (via flags) works only for transactions (stateful requests). It does not work for stateless processing (like sl_send_reply() - "sl" comes from stateless - or for save() - which internally uses sl_send_reply).
transactions replied by t_reply() will be accounted, but not the sl_send_reply(). In this last case, use acc_db_request() to force accounting.
regards, bogdan
Victor Gamov wrote:
raviprakash sunkara wrote:
Hello
better use these function
acc_db_request("200","acc");
Can somebody explain me some OpenSER logic?
So if I have following config (simplified):
--------------- cut here ------------------ modparam("acc", "db_flag", 1) modparam("acc", "failed_transaction_flag", 1)
route {
setflag(1);
if ( ! lookup("location") ) { sl_send_reply("404", "Not found"); exit; }
route(1); } --------------- /cut here ------------------
can I expect that calls to not registered users (lookup() return FALSE) will be accounted?
if NOT -- so, what is it means "failed_transaction_flag" and "db_missed_flag" ? What is it means "missed calls": user does not respond? or user busy? or user not registered?
If locally generated reply does not considered as failed transaction (I think it's because I still haven't transaction at this moment) can I manually create transaction by t_newtran() and expect that it will be considered by ACC-module as "failed_transaction" ?
(yes I red documentation but I still don't understand some logic)
Bogdan-Andrei Iancu wrote:
Hi Victor,
automatic accounting (via flags) works only for transactions (stateful requests). It does not work for stateless processing (like sl_send_reply() - "sl" comes from stateless - or for save() - which internally uses sl_send_reply).
transactions replied by t_reply() will be accounted, but not the sl_send_reply(). In this last case, use acc_db_request() to force accounting.
I see. I do it already but I was need more assurance that it's correct :-)
Thanks!
Hi Tanguy,
for the statefully processed requests, use the "failed_transaction_flag" to enable acc for non-2xx. For statelessly requests, you will have to use acc_db_request().
regards, bogdan
Tanguy Bouzéloc wrote:
Hello,
I've some issues with my mysql accounting, I can only log successful calls in the acc table and I've no informations about missed calls. In mysql accounting I've only sip 200 ok and no errors. I've not this behavior in my syslog.
It's very important for us for evaluate the performance of our providers and we can only do it with a database accouting.
For example, If I pass a call and I let it ring til operator timeout, I've no trace of this call in the accounting table.
I've also another question, the lcr and gw tables have very small fixed limits (256 for lcr and 32 for gw), since we have much more gateways and sdas I've updated theses limits to a value which fit our needs, do you thinks it can be a problem ?
Thanks in advance,
Tanguy Bouzéloc Init-Sys
Hi Bodgan,
Superb it works like a charm, thanks a lot ;-)
I've another question about openser accouting, a regular call log is composed by 3 db lines (INVITE, ACK, BYE). I remark that the timestamps between the INVITE and ACK lines are the same, I think I've miss something in my configuration anyone have an idea about this ?
Regards, Tanguy Bouzéloc Init-Sys
Bogdan-Andrei Iancu a écrit :
Hi Tanguy,
for the statefully processed requests, use the "failed_transaction_flag" to enable acc for non-2xx. For statelessly requests, you will have to use acc_db_request().
regards, bogdan
Tanguy Bouzéloc wrote:
Hello,
I've some issues with my mysql accounting, I can only log successful calls in the acc table and I've no informations about missed calls. In mysql accounting I've only sip 200 ok and no errors. I've not this behavior in my syslog.
It's very important for us for evaluate the performance of our providers and we can only do it with a database accouting.
For example, If I pass a call and I let it ring til operator timeout, I've no trace of this call in the accounting table.
I've also another question, the lcr and gw tables have very small fixed limits (256 for lcr and 32 for gw), since we have much more gateways and sdas I've updated theses limits to a value which fit our needs, do you thinks it can be a problem ?
Thanks in advance,
Tanguy Bouzéloc Init-Sys
# ----------- global configuration parameters ------------------------
#debug=9 fork=yes check_via=no dns=no rev_dns=no port=5060 children=4 sip_warning=0
# ------------------ module loading ----------------------------------
loadmodule "/usr/lib/openser/modules/mysql.so" loadmodule "/usr/lib/openser/modules/nathelper.so" loadmodule "/usr/lib/openser/modules/sl.so" loadmodule "/usr/lib/openser/modules/tm.so" loadmodule "/usr/lib/openser/modules/rr.so" loadmodule "/usr/lib/openser/modules/maxfwd.so" loadmodule "/usr/lib/openser/modules/lcr.so" loadmodule "/usr/lib/openser/modules/acc.so" loadmodule "/usr/lib/openser/modules/xlog.so" loadmodule "/usr/lib/openser/modules/textops.so" loadmodule "/usr/lib/openser/modules/permissions.so"
# ----------------- setting module-specific parameters ---------------
modparam("lcr", "db_url", "mysql://???") modparam("lcr", "db_mode", 0)
modparam("rr","enable_full_lr",1)
modparam("acc", "db_url", "mysql://???") modparam("acc", "db_flag", 1) modparam("acc", "db_localtime", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1 )
modparam("permissions", "db_url", "mysql://???")
route {
if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); return; };
if (msg:len >= max_len ) { sl_send_reply("513", "Message too big"); return; };
if (!is_method("REGISTER")) { record_route(); };
if (is_method("BYE") || is_method("CANCEL")) { xlog("L_NOTICE", "End call($ci | $Ri): $fU -> $tU"); if (is_method("BYE")) setflag(1); unforce_rtp_proxy(); };
if (loose_route()) { route(1); return; };
if (!allow_trusted()) { xlog("L_WARN", "Host not trusted ($fu/$si/$rP)"); sl_send_reply("403", "Forbidden"); exit; };
if (!load_gws()) { sl_send_reply("500", "Internal server error, unable to load gateways"); return; }
if (!next_gw()) { xlog("L_ERR", "No gw found ($ru/$fu)"); sl_send_reply("503", "Service not available, no gateways found"); return; };
t_on_failure("2");
route(1); }
route[1] { setflag(1);
if (is_method("INVITE") || is_method("ACK")){ if (is_method("INVITE")) xlog("L_NOTICE", "Incoming call($ci | $Ri): $fU -> $tU"); if (!search("^Content-Length:[ ]*0")) force_rtp_proxy("foc");
# if(src_ip == 217.15.85.178) { # subst('/^From:.*<sip:(.*)@(.*)$/From: "\1" <sip:\1/@\2'); # }
t_on_reply("1"); };
if (!t_relay()) { sl_reply_error(); }; }
onreply_route[1] { setflag(1); if (status=~"[12][0-9][0-9]"){ if (!search("^Content-Length:[ ]*0")) force_rtp_proxy("foc"); }; }
failure_route[2] {
if (t_check_status("400")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 400 Bad Request"); } else if (t_check_status("401")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 401 Unauthorized"); } else if (t_check_status("403")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 403 Forbidden"); } else if (t_check_status("404")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 404 Not Found"); } else if (t_check_status("405")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 405 Method Not Allowed"); } else if (t_check_status("406")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 406 Not Acceptable"); } else if (t_check_status("407")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 407 Proxy Authentication Required"); } else if (t_check_status("408")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 408 Request Timeout"); } else if (t_check_status("410")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 410 Gone"); } else if (t_check_status("413")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 413 Request Entity Too Large"); } else if (t_check_status("414")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 414 Request-URI Too Long"); } else if (t_check_status("415")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 415 Unsupported Media Type"); } else if (t_check_status("416")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 416 Unsupported URI Scheme"); } else if (t_check_status("420")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 420 Bad Extension"); } else if (t_check_status("421")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 421 Extension Required"); } else if (t_check_status("423")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 423 Interval Too Brief"); } else if (t_check_status("480")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 480 Temporarily Unavailable"); } else if (t_check_status("481")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 481 Call/Transaction Does Not Exist"); } else if (t_check_status("482")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 482 Loop Detected"); } else if (t_check_status("483")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 483 Too Many Hops"); } else if (t_check_status("484")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 484 Address Incomplete"); } else if (t_check_status("485")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 485 Ambiguous"); } else if (t_check_status("486")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 486 Busy Here"); } else if (t_check_status("487")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 487 Request Terminated"); } else if (t_check_status("488")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 488 Not Acceptable Here"); } else if (t_check_status("491")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 491 Request Pending"); } else if (t_check_status("493")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 493 Undecipherable"); } else if (t_check_status("500")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 500 Server Internal Error"); } else if (t_check_status("501")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 501 Not Implemented"); } else if (t_check_status("502")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 502 Bad Gateway"); } else if (t_check_status("503")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 503 Service Unavailable"); } else if (t_check_status("504")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 504 Server Time-out"); } else if (t_check_status("505")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 505 Version Not Supported"); } else if (t_check_status("513")) { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU 513 Message Too Large"); } else { xlog("L_NOTICE", "Failure call($ci | $Ri): $fU -> $tU Unknown code"); }
setflag(1);
if (is_method("INVITE") && t_check_status("408|500|503")) { if (!next_gw()) { xlog("L_ERR", "No more gw ($ru/$fu)"); t_reply("486", "Busy"); # t_reply("503", "Service not available"); exit; } t_on_failure("2"); force_rtp_proxy("foc"); t_relay(); } }
Hi Tanguy,
the INVITE timestamp is at 200 OK and for ACK when request is received, so the difference is very,very small (as time). Also the timestamp has accuracy at second limit, so in most of the cases the INVITE and ACK will have the same timestamp.
regards, bogdan
Tanguy Bouzéloc wrote:
Hi Bodgan,
Superb it works like a charm, thanks a lot ;-)
I've another question about openser accouting, a regular call log is composed by 3 db lines (INVITE, ACK, BYE). I remark that the timestamps between the INVITE and ACK lines are the same, I think I've miss something in my configuration anyone have an idea about this ?
Regards, Tanguy Bouzéloc Init-Sys
Bogdan-Andrei Iancu a écrit :
Hi Tanguy,
for the statefully processed requests, use the "failed_transaction_flag" to enable acc for non-2xx. For statelessly requests, you will have to use acc_db_request().
regards, bogdan
Tanguy Bouzéloc wrote:
Hello,
I've some issues with my mysql accounting, I can only log successful calls in the acc table and I've no informations about missed calls. In mysql accounting I've only sip 200 ok and no errors. I've not this behavior in my syslog.
It's very important for us for evaluate the performance of our providers and we can only do it with a database accouting.
For example, If I pass a call and I let it ring til operator timeout, I've no trace of this call in the accounting table.
I've also another question, the lcr and gw tables have very small fixed limits (256 for lcr and 32 for gw), since we have much more gateways and sdas I've updated theses limits to a value which fit our needs, do you thinks it can be a problem ?
Thanks in advance,
Tanguy Bouzéloc Init-Sys