I configured ser to work with an pstn gw accounting all call to mysql db.
But I when I call a local user I get accounted the INVITE and the BYE messages, but when I call an outging uri I get accounted only BYE messages and not the INVTE.
Where is the probelm? THANKS below there is may ser.cfg file: ______________________________________________________________ # # Italycom SER server ver 0.052 # # modificato il 16-02-2005 # # con nathelper e rtpproxy funzioannte # da perfezionare l'accounting # # # ----------- global configuration parameters ------------------------
/* Uncomment these lines to enter debugging mode debug=9 fork=no log_stderror=yes */
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 fifo="/tmp/ser_fifo" fifo_mode=0666
listen=213.178.216.44
# ------------------ module loading ---------------------------------- # # loadmodule "/usr/local/lib/ser/modules/mysql.so" loadmodule "/usr/local/lib/ser/modules/sl.so" loadmodule "/usr/local/lib/ser/modules/tm.so" loadmodule "/usr/local/lib/ser/modules/rr.so" loadmodule "/usr/local/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/lib/ser/modules/usrloc.so" loadmodule "/usr/local/lib/ser/modules/registrar.so" loadmodule "/usr/local/lib/ser/modules/nathelper.so" loadmodule "/usr/local/lib/ser/modules/textops.so" loadmodule "/usr/local/lib/ser/modules/xlog.so" loadmodule "/usr/local/lib/ser/modules/acc.so" loadmodule "/usr/local/lib/ser/modules/auth.so" loadmodule "/usr/local/lib/ser/modules/auth_db.so" # # ----------------- setting module-specific parameters --------------- # # # -- usrloc params -- # modparam("usrloc", "db_url", "mysql://user:password@domain.us/ser") modparam("usrloc", "db_mode", 1) # # # -- auth params -- # modparam("auth_db", "db_url", "mysql://user:password@domain.us/ser") modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") # # # -- nathelper params -- # modparam("registrar", "nat_flag", 6) modparam("nathelper", "natping_interval", 30) # Ping interval 30 s modparam("nathelper", "ping_nated_only", 1) # Ping only clients behind NAT # # # -- acc params -- # modparam("acc", "db_url", "mysql://ser:heslo@ns2.italycomnet.it/ser") modparam("acc", "db_flag", 1) modparam("acc", "db_missed_flag", 1) modparam("acc", "failed_transactions", 1) modparam("acc", "report_cancels", 1) modparam("acc", "log_fmt", "cdfimorstup") modparam("acc", "log_level", 1) modparam("acc", "report_ack", 0) # # # -- rr params -- # add value to ;lr param to make some broken UAs happy modparam("rr", "enable_full_lr", 1)
# -- tm params -- modparam("tm", "fr_timer", 20) modparam("tm", "fr_inv_timer", 40) modparam("tm", "wt_timer", 5) # # # # # ------------------------- request routing logic -------------------
# main routing logic
route{ if(nat_uac_test("3")) { if((method == "REGISTER") || !(search("^Record-Route:"))) { log("LOG:Someone trying to register from private IP, rewriting\n");
fix_nated_contact(); if(method == "INVITE") { fix_nated_sdp("1"); }; force_rport(); setflag(6); }; }; # initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { sl_send_reply("513", "Message too big"); break; }; # # Accounting if (method=="INVITE" || method=="BYE") { setflag(1); }; # # # we record-route all messages -- to make sure that # subsequent messages will go through our proxy; that's # particularly good if upstream and downstream entities # use different transport protocol record_route();
# loose-route processing if (loose_route()) { # mark routing logic in request t_relay(); append_hf("P-hint: rr-enforced\r\n"); route(1); break; };
# if the request is for other domain use UsrLoc # (in case, it does not work, use the following command # with proper names and addresses in it) if (uri==myself) { if (method=="REGISTER") { if (!www_authorize("voip.mydomain.it", "subscriber")) { www_challenge("voip.mydomain.it", "0"); break; }; save("location"); break; }; # lookup("aliases") ; # # if (!lookup("location")) { if (method=="INVITE") { if ( (uri=~"sip:[0-9]{5,20}@.*") ) { rewritehostport( "pstngw.com:5060" ); forward( pstngw.com, 5060 ); break; }; sl_send_reply("404", "Not Found"); break; } else { # forward to user's current destination t_relay(); break; }; }; }; append_hf("P-hint: usrloc applied\r\n"); route(1);
} #
route[1] { # !! Nathelper if (uri=~"[@:](192.168.|10.|172.(1[6-9]|2[0-9]|3[0-1]).)" && !search("^Route:")){ sl_send_reply("479", "We don't forward to private IP addresses"); break; };
# if client or server know to be behind a NAT, enable relay if (isflagset(6)) { force_rtp_proxy(); }; # # NAT processing of replies; apply to all transactions (for example, # re-INVITEs from public to private UA are hard to identify as # NATed at the moment of request processing); look at replies t_on_reply("1");
# send it out now; use stateful forwarding as it works reliably # even for UDP2TCP if (!t_relay()) { sl_reply_error(); }; }
# !! Nathelper onreply_route[1] { if (isflagset(6) && status =~ "(180)|(183)|2[0-9][0-9]") { # fix_nated_contact(); if (!search("^Content-Length:\ 0")) { force_rtp_proxy(); };
# force_rtp_proxy(); }; if (nat_uac_test("1")) { fix_nated_contact(); }; }
Hi Rosario,
You miss the accounting for the GW INVITEs because you use a forward(), which is a stateless function - acc works only with statefull function. Replace forward( pstngw.com, 5060 ); with t_relay_to_udp("pstngw.com","5060");
Best regards, Marian
Rosario Pingaro wrote:
I configured ser to work with an pstn gw accounting all call to mysql db.
But I when I call a local user I get accounted the INVITE and the BYE messages, but when I call an outging uri I get accounted only BYE messages and not the INVTE.
Where is the probelm? THANKS below there is may ser.cfg file: ______________________________________________________________ # # Italycom SER server ver 0.052 # # modificato il 16-02-2005 # # con nathelper e rtpproxy funzioannte # da perfezionare l'accounting # # # ----------- global configuration parameters ------------------------
/* Uncomment these lines to enter debugging mode debug=9 fork=no log_stderror=yes */
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 fifo="/tmp/ser_fifo" fifo_mode=0666
listen=213.178.216.44
# ------------------ module loading ---------------------------------- # # loadmodule "/usr/local/lib/ser/modules/mysql.so" loadmodule "/usr/local/lib/ser/modules/sl.so" loadmodule "/usr/local/lib/ser/modules/tm.so" loadmodule "/usr/local/lib/ser/modules/rr.so" loadmodule "/usr/local/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/lib/ser/modules/usrloc.so" loadmodule "/usr/local/lib/ser/modules/registrar.so" loadmodule "/usr/local/lib/ser/modules/nathelper.so" loadmodule "/usr/local/lib/ser/modules/textops.so" loadmodule "/usr/local/lib/ser/modules/xlog.so" loadmodule "/usr/local/lib/ser/modules/acc.so" loadmodule "/usr/local/lib/ser/modules/auth.so" loadmodule "/usr/local/lib/ser/modules/auth_db.so" # # ----------------- setting module-specific parameters --------------- # # # -- usrloc params -- # modparam("usrloc", "db_url", "mysql://user:password@domain.us/ser") modparam("usrloc", "db_mode", 1) # # # -- auth params -- # modparam("auth_db", "db_url", "mysql://user:password@domain.us/ser") modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") # # # -- nathelper params -- # modparam("registrar", "nat_flag", 6) modparam("nathelper", "natping_interval", 30) # Ping interval 30 s modparam("nathelper", "ping_nated_only", 1) # Ping only clients behind NAT # # # -- acc params -- # modparam("acc", "db_url", "mysql://ser:heslo@ns2.italycomnet.it/ser") modparam("acc", "db_flag", 1) modparam("acc", "db_missed_flag", 1) modparam("acc", "failed_transactions", 1) modparam("acc", "report_cancels", 1) modparam("acc", "log_fmt", "cdfimorstup") modparam("acc", "log_level", 1) modparam("acc", "report_ack", 0) # # # -- rr params -- # add value to ;lr param to make some broken UAs happy modparam("rr", "enable_full_lr", 1)
# -- tm params -- modparam("tm", "fr_timer", 20) modparam("tm", "fr_inv_timer", 40) modparam("tm", "wt_timer", 5) # # # # # ------------------------- request routing logic -------------------
# main routing logic
route{ if(nat_uac_test("3")) { if((method == "REGISTER") || !(search("^Record-Route:"))) { log("LOG:Someone trying to register from private IP, rewriting\n");
fix_nated_contact(); if(method == "INVITE") { fix_nated_sdp("1"); }; force_rport(); setflag(6); }; };
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { sl_send_reply("513", "Message too big"); break; }; # # Accounting if (method=="INVITE" || method=="BYE") { setflag(1); }; # # # we record-route all messages -- to make sure that # subsequent messages will go through our proxy; that's # particularly good if upstream and downstream entities # use different transport protocol record_route(); # loose-route processing if (loose_route()) { # mark routing logic in request t_relay(); append_hf("P-hint: rr-enforced\r\n"); route(1); break; }; # if the request is for other domain use UsrLoc # (in case, it does not work, use the following command # with proper names and addresses in it) if (uri==myself) { if (method=="REGISTER") { if (!www_authorize("voip.mydomain.it", "subscriber")) { www_challenge("voip.mydomain.it", "0"); break; }; save("location"); break; }; # lookup("aliases") ; # # if (!lookup("location")) { if (method=="INVITE") { if ( (uri=~"sip:[0-9]{5,20}@.*") ) { rewritehostport( "pstngw.com:5060" ); forward( pstngw.com, 5060 ); break; }; sl_send_reply("404", "Not Found"); break; } else { # forward to user's current destination t_relay(); break; }; }; }; append_hf("P-hint: usrloc applied\r\n"); route(1);
} #
route[1] { # !! Nathelper if (uri=~"[@:](192.168.|10.|172.(1[6-9]|2[0-9]|3[0-1]).)" && !search("^Route:")){ sl_send_reply("479", "We don't forward to private IP addresses"); break; }; # if client or server know to be behind a NAT, enable relay if (isflagset(6)) { force_rtp_proxy(); }; # # NAT processing of replies; apply to all transactions (for example, # re-INVITEs from public to private UA are hard to identify as # NATed at the moment of request processing); look at replies t_on_reply("1");
# send it out now; use stateful forwarding as it works reliably # even for UDP2TCP if (!t_relay()) { sl_reply_error(); }; }
# !! Nathelper onreply_route[1] { if (isflagset(6) && status =~ "(180)|(183)|2[0-9][0-9]") { # fix_nated_contact(); if (!search("^Content-Length:\ 0")) { force_rtp_proxy(); };
# force_rtp_proxy(); }; if (nat_uac_test("1")) { fix_nated_contact(); }; }
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
On Thu, 2005-02-17 at 09:46 +0100, Marian Dumitru wrote:
You miss the accounting for the GW INVITEs because you use a forward(), which is a stateless function - acc works only with statefull function. Replace forward( pstngw.com, 5060 ); with t_relay_to_udp("pstngw.com","5060");
Would that work with rewritehostport() too?
thanks
Luca
Hi Luca,
rewritehostport() just modify the RURI without triggering any signaling operation. So, you can use it before t_relay(), safely from acc perspective.
Best regards, Marian
Luca Corti wrote:
On Thu, 2005-02-17 at 09:46 +0100, Marian Dumitru wrote:
You miss the accounting for the GW INVITEs because you use a forward(), which is a stateless function - acc works only with statefull function. Replace forward( pstngw.com, 5060 ); with t_relay_to_udp("pstngw.com","5060");
Would that work with rewritehostport() too?
thanks
Luca