[OpenSER-Users] modparam("usrloc", "nat_bflag", 6) and setflag(6) doesn't update flags column

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Sep 7 18:59:09 CEST 2007


Hi Halomoan,

in OpenSER1.2.x, the flag concept is a bit more complex than in SER. For 
nat purposes we use branch flags (per branch flags) and not general flags.
So, use setbflag() and istbflagset() to set and test. In location table, 
see the cflags field and not the flags.

Also see that the nat_bflag is actually a param of "usrloc" module and 
not registrar.

regards,
bogdan

Halomoan Chow wrote:
> Dear all
>
> I followed tutorial from SER-Getting Start document for Mediaproxy to 
> solve nat problem.
> I read on the Openser document
> http://www.openser.org/docs/modules/1.2.x/usrloc.html#AEN83 
> <http://www.openser.org/docs/modules/1.2.x/usrloc.html#AEN83>
> I have to use modparam("usrloc", "nat_bflag", 6) instead of 
> modparam("registrar", "nat_flag", 6)
>
> And from the documentation, it said
> "When SIP clients attempt to REGISTER with our SIP proxy we need a way 
> to tell the registrar module to
> store NAT information for any particular UA. We do this by using flag 
> 6, which has been arbitrarily chosen
> (but defined earlier in the loadmodule parameter section). We could 
> have specified another integer here, but
> flag 6 seems to be the accepted standard for nat_flag.
>
> If the nat_flag is set before calling the save() function to store 
> contact information, SER will preserve the
> NAT contact information as well as set the flags column in the MySQL 
> location table. By doing so, we can
> call lookup(location) when processing messages and flag 6 will be set 
> for NATed clients."
>
> I have a NAT UA is detected as NAT-ed UA by Openser with below rule 
> and do setflag(6); before it does save("location");
>
> Why in mysql, location table, i see the flags column still 0 instead 
> of 6 ?
>
> Did I miss something?
> Please help :(
>
>
> # $Id: nat-mediaproxy.cfg 51 2006-01-31 13:28:04Z /CN=Paul 
> Hazlett/emailAddress= paul at onsip.org <mailto:paul at onsip.org> $
> debug=3
> fork=no
> log_stderror=yes
> #alias=" halodns.powere2e.com <http://halodns.powere2e.com>"
>
> listen=x.x.x.x           # INSERT YOUR IP ADDRESS HERE
> port=5060
> children=4
>
> dns=no
> rev_dns=no
>
> loadmodule "/usr/local/lib/openser/modules/mysql.so"
> loadmodule "/usr/local/lib/openser/modules/sl.so"
> loadmodule "/usr/local/lib/openser/modules/tm.so"
> loadmodule "/usr/local/lib/openser/modules/rr.so"
> loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
> loadmodule "/usr/local/lib/openser/modules/usrloc.so"
> loadmodule "/usr/local/lib/openser/modules/registrar.so"
> loadmodule "/usr/local/lib/openser/modules/auth.so"
> loadmodule "/usr/local/lib/openser/modules/auth_db.so"
> loadmodule "/usr/local/lib/openser/modules/uri.so"
> loadmodule "/usr/local/lib/openser/modules/uri_db.so"
> loadmodule "/usr/local/lib/openser/modules/domain.so"
> loadmodule "/usr/local/lib/openser/modules/mediaproxy.so"
> loadmodule "/usr/local/lib/openser/modules/nathelper.so"
> loadmodule "/usr/local/lib/openser/modules/textops.so"
> loadmodule "/usr/local/lib/openser/modules/xlog.so"
> loadmodule "/usr/local/lib/openser/modules/mi_fifo.so"
>
> modparam("mi_fifo","fifo_name","/tmp/openser_fifo")
>
> modparam("auth_db|domain|uri_db|usrloc", "db_url", 
> "mysql://openser:openserrw@localhost/openser")
> modparam("auth_db", "calculate_ha1", 1)
> modparam("auth_db", "password_column", "password")
>
> modparam("nathelper|registrar", "received_avp", "$avp(i:42)")
> 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/openser/sip-clients") 
>
> modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/openser/rtp-clients")
>
>
> modparam("usrloc", "db_mode", 2)
> modparam("usrloc", "nat_bflag", 6) <- set to 6
>
> modparam("rr", "enable_full_lr", 1)
>
> .
> .
> .
> .
>
> route[2] {
>
>         # 
> -----------------------------------------------------------------
>         # REGISTER Message Handler
>         # ----------------------------------------------------------------
>          xlog("L_NOTICE","$Cxg Enter Route[2]: REGISTER  $Cxx\n");
>
>         sl_send_reply("100", "Trying");
>
>         if (!search("^Contact:[ ]*\*") && client_nat_test("2")) {
>                 setflag(6);
>                 fix_nated_register();
>                 force_rport();          
>         };
>
>         if (!www_authorize("","subscriber")) {
>                 www_challenge("","0");
>                 return;
>         };
>
>         if (!check_to()) {
>                 sl_send_reply("401", "Unauthorized");
>                 return;
>         };
>
>         consume_credentials();
>
>         if (!save("location")) {
>                 sl_reply_error();
>         };
> }
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>   





More information about the Users mailing list