Hello all,<br><br> I finally got accounting on db to work. I added a few extra fields and its all fine. But i have some questions:<br><br>I added:<br><br> modparam("acc", "db_extra", "from_uri=$fu ; to_uri=$tu ; from_user=$fU; source_ip=$si")
<br><br> to me config, and all the info gets loaded. BUT, source_ip is not always the ip from which the request was received, either that, or INVITES are not getting logged!<br> well, that's really 2 questions in one... ;)
<br><br>here's my config:<br><br>#<br># sample config file to be used with nathelper/rtpproxy<br>#<br># start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899<br>#<br><br># ----------- global configuration parameters ------------------------
<br><br>debug=2 # debug level (cmd line: -dddddddddd)<br>fork=yes<br>log_stderror=yes # (cmd line: -E)<br><br># Uncomment these lines to enter debugging mode <br>#fork=no<br>#log_stderror=yes<br><br><br>check_via=no # (cmd. line: -v)
<br>dns=no # (cmd. line: -r)<br>rev_dns=no # (cmd. line: -R)<br>port=5060<br>children=20<br>disable_dns_blacklist=true<br><br><br>#<br><br># --- module loading<br><br>mpath="/usr/lib/openser/modules/"
<br><br>loadmodule "mysql.so"<br>loadmodule "sl.so"<br>loadmodule "tm.so"<br>loadmodule "rr.so"<br>loadmodule "maxfwd.so"<br>loadmodule "usrloc.so"<br>loadmodule "
registrar.so"<br>loadmodule "textops.so"<br>loadmodule "nathelper.so"<br>loadmodule "auth.so"<br>loadmodule "auth_db.so"<br>loadmodule "mi_fifo.so"<br>loadmodule "
dispatcher.so"<br>#loadmodule "domain.so"<br>loadmodule "xlog.so"<br>loadmodule "/usr/lib/openser/modules/acc.so"<br><br>modparam("acc", "early_media", 1)<br>modparam("acc", "report_cancels", 1)
<br><br>modparam("acc", "db_flag", 2)<br>modparam("acc", "db_url", "mysql://openser:password@localhost/openser")<br>modparam("acc", "report_ack", 0)<br>
modparam("acc", "db_missed_flag", 3)<br>modparam("acc", "failed_transaction_flag", 4)<br>modparam("acc", "db_extra", "from_uri=$fu ; to_uri=$tu ; from_user=$fU; source_ip=$si")
<br><br><br>#<br># CONSTANTS<br>#<br><br># --- setting module parameters<br>#modparam("domain","db_url","mysql://openser:password@localhost/openser")<br>#modparam("domain", "db_mode", 1)
<br>#modparam("domain", "domain_table", "domain")<br>#modparam("domain", "domain_col", "domain")<br><br>modparam("xlog", "buf_size", 8192)<br>
<br># --- setting module parameters<br>modparam("dispatcher", "list_file", "/etc/openser/dispatcher.list")<br><br># -- mi_fifo params --<br>modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
<br><br>modparam("usrloc|auth_db","db_url","mysql://openser:password@localhost/openser")<br><br># -- usrloc params --<br>modparam("usrloc", "db_mode", 1)<br>modparam("usrloc", "nat_bflag", 6)
<br>#modparam("usrloc", "use_domain", 0)<br><br># -- registrar params --<br>modparam("registrar|nathelper", "received_avp", "$avp(i:42)")<br><br># -- auth params --<br>modparam("auth_db", "calculate_ha1", yes)
<br>modparam("auth_db", "password_column", "password")<br>#modparam("auth_db", "use_domain", 0)<br><br># -- rr params --<br>#modparam("rr", "enable_full_lr", 1)
<br><br><br><br># -- nathelper<br>modparam("nathelper", "rtpproxy_sock", "udp:<a href="http://1.2.3.4:8899">1.2.3.4:8899</a>")<br>modparam("nathelper", "natping_interval", 30)
<br>modparam("nathelper", "ping_nated_only", 1)<br>modparam("nathelper", "sipping_bflag", 7)<br>modparam("nathelper", "sipping_from", "<a href="mailto:sip:pinger@sip.whatever.com">
sip:pinger@sip.whatever.com</a>")<br><br>#modparam("registrar", "max_contacts", 1)<br><br># --- main routing logic<br>route{<br> if (method=="INVITE") {<br> xlog("L_NOTICE", "INVITE MESSAGE RECEIVED - START ACC\n");
<br> setflag(2);<br> setflag(3);<br> setflag(4);<br> };<br><br> if (method=="BYE") {<br> xlog ("L_NOTICE", "BYE - STOP ACCOUNTING\n");
<br> setflag(2);<br> setflag(3);<br> setflag(4);<br> };<br><br> if (method=="CANCEL") {<br> xlog ("L_NOTICE", "CANCEL - STOP ACCOUNTING\n");
<br> setflag(2);<br> setflag(3);<br> setflag(4);<br> };<br><br> if (method=="REGISTER") {<br> setflag(2);<br> setflag(3);<br>
setflag(4);<br> };<br><br><br> if (!mf_process_maxfwd_header("100")) {<br> sl_send_reply("483","Too Many Hops");<br> exit;<br> };
<br><br> #if (msg:len >= 2048 ) {<br> # sl_send_reply("513", "Message too big");<br> # exit;<br> #};<br><br> # NAT detection<br> route(2);<br><br>
if (!method=="REGISTER")<br> record_route();<br><br> if (loose_route()) {<br> append_hf("P-hint: rr-enforced\r\n"); <br> route(1);<br> };
<br><br> if (!uri==myself) {<br># if (!is_uri_host_local() ) {<br> append_hf("P-hint: outbound\r\n"); <br> route(1);<br> };<br><br> if (uri==myself) {<br>
if (method=="REGISTER") {<br> xlog("L_NOTICE", "\nNew Registration\n");<br><br> if (!www_authorize("<a href="http://sip.whatever.com">
sip.whatever.com</a>", "subscriber")) {<br> xlog("L_NOTICE", "\nRegistration FAILED! CLIENT: $au\n");<br> www_challenge("
<a href="http://sip.whatever.com">sip.whatever.com</a>", "0");<br> exit;<br> };<br><br> if (isflagset(5)) {<br> xlog("L_NOTICE", "\nRegistration OK\n");
<br> setbflag(6);<br> # if you want OPTIONS natpings uncomment next<br> # setbflag(7);<br> };<br> save("location");
<br> exit;<br> };<br><br> };<br><br> route(1);<br>}<br><br><br>route[1] {<br> xlog("L_NOTICE", "\n**************IN ROUTE 1************\n");<br>
if (subst_uri('/(sip:.*);nat=yes/\1/')){<br> setbflag(6);<br> };<br><br> if (isflagset(5)||isbflagset(6)) {<br> route(3);<br> }<br><br> if (!t_relay()) {
<br> sl_reply_error();<br> };<br> exit;<br>}<br><br>route[2]{<br> force_rport();<br> if (nat_uac_test("19")) {<br> if (method=="REGISTER") {<br>
fix_nated_register();<br> } else {<br> fix_nated_contact();<br> };<br> setflag(5);<br> };<br>}<br><br>route[3] {<br> if (is_method("BYE|CANCEL")) {
<br> unforce_rtp_proxy();<br> } else if (is_method("INVITE")){<br> force_rtp_proxy();<br> t_on_failure("1");<br> };<br> if (isflagset(5))
<br> search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');<br> t_on_reply("1");<br>}<br><br>failure_route[1] {<br> if (isbflagset(6) || isflagset(5)) {<br> unforce_rtp_proxy();
<br> }<br>}<br><br>onreply_route[1] {<br> if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])") {<br> force_rtp_proxy();<br> }<br> search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
<br><br> if (isbflagset(6)) {<br> fix_nated_contact();<br> }<br> exit;<br>}<br><br><br>#=======================================<br><br>Thanks in advance!<br><br>Any other comment to make this cfg better, i'm all ears!!
<br><br>David<br><br><br><br>