NAT Contact address issues with Nokia Mobile

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

NAT Contact address issues with Nokia Mobile

oso che bol
Dear All,

I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.

I use X-Lite which is Behind NAT, register to OpenSIPs proxy, Opensips store right contact address. But, when i use Nokia E66 to register to Opensips, the contact address is bellow: 

Online SIP Users
Username Domain Contact Expires User Agent
5000 [hidden email];transport=UDP 2009-03-30 07:20:24.0 E66-1 RM-343 102.07.81

User 5000 do not store with external IP address of its (external address not 192.168.1.100). Do you have any ideas about this?

Bellow is my Opensips.conf

Thanks and Regards,

-LN

Opensips.conf

==================

####### Global Parameters #########

debug=4
log_stderror=yes
log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes

#disable_tcp=yes
#disable_dns_blacklist=no
#dns_try_ipv6=yes
#auto_aliases=no

/* uncomment the following lines to enable TLS support  (default off) */
#disable_tls = no
#listen = tls:your_IP:5061
#tls_verify_server = 1
#tls_verify_client = 1
#tls_require_client_certificate = 0
#tls_method = TLSv1
#tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
#tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
#tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"


port=5060
listen=udp:MY_OPENSIP_IP:5060


####### Modules Section ########

#set module path
mpath="//lib/opensips/modules/"

/* uncomment next line for MySQL DB support */
loadmodule "db_mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
loadmodule "uri_db.so"
loadmodule "uri.so"
loadmodule "xlog.so"
loadmodule "acc.so"
loadmodule "auth.so"
loadmodule "auth_db.so"

#loadmodule "presence.so"
#loadmodule "presence_xml.so"

loadmodule "nathelper.so"
loadmodule "avpops.so"
######################


modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 0)
modparam("registrar", "method_filtering", 1)

/* uncomment the next line to disable parallel forking via location */
# modparam("registrar", "append_branches", 0)
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
modparam("uri_db", "use_uri_table", 1)
modparam("uri_db", "db_url", "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
#them for bug9, like guide in bug9
modparam("uri_db", "db_table", "uri")


# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "detect_direction", 0)
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)

modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url",
    "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db|permission", "db_url",
    "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

modparam("avpops", "avp_url", "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
modparam("avpops", "avp_table", "usr_preferences")

#try for fix error of Mobile Address
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("nathelper", "received_avp", "$avp(s:rcv)")

#Theo guide http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
modparam("usrloc", "nat_bflag", 6)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", 8)

#modparam("nathelper", "rtpproxy_sock", "udp:MY_RTPPROXY_IP:7890")
modparam("nathelper", "force_socket", "udp:MY_RTPPROXY_IP:7890")
modparam("nathelper", "natping_interval", 89)
modparam("nathelper", "sipping_from", "sip:1000@MY_OPENSIP_IP")


# main request routing logic

route {

    # -----------------------------------------------------------------
    # Sanity Check Section
    # -----------------------------------------------------------------
    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483", "Too Many Hops");
        exit;
    }

    if (msg:len > max_len) {
        sl_send_reply("513", "Message Overflow");
        exit;
    }

    # -----------------------------------------------------------------
    # Record Route Section
    # -----------------------------------------------------------------
    if (method!="REGISTER") {
        record_route();
    }

    if (method=="BYE" || method=="CANCEL") {
        unforce_rtp_proxy();
    }

    # -----------------------------------------------------------------
    # Loose Route Section
    # -----------------------------------------------------------------
    if (loose_route()) {

        if ((method=="INVITE" || method=="REFER") && !has_totag()) {
            sl_send_reply("403", "Forbidden");
            exit;
        }

        if (method=="INVITE") {

            if (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
                proxy_challenge("MY_OPENSIPS_IP","0");
                exit;
            } else if (!check_from()) {
                sl_send_reply("403", "Use From=ID");
                exit;
            }
            consume_credentials();

            if (nat_uac_test("19")) {
                setflag(6);
                force_rport();
                fix_nated_contact();
            }
            force_rtp_proxy("l");
        }
        route(1);
        exit;
    }

    # -----------------------------------------------------------------
    # Call Type Processing Section
    # -----------------------------------------------------------------
    if (uri!=myself) {
        route(4);
        route(1);
        exit;
    }

    if (method=="ACK") {
        route(1);
        exit;
    } else if (method=="CANCEL") {
        route(1);
        exit;
    } else if (method=="INVITE") {
        route(3);
        exit;
    } else  if (method=="REGISTER") {
        route(2);
        exit;
    }

    lookup("aliases");
    if (uri!=myself) {
        route(4);
        route(1);
        exit;
    }

    if (!lookup("location")) {
        sl_send_reply("404", "User Not Found");
        exit;
    }

    route(1);
}

route[1] {

    # -----------------------------------------------------------------
    # Default Message Handler
    # -----------------------------------------------------------------

    t_on_reply("1");

    if (!t_relay()) {
        if (method=="INVITE" && isflagset(6)) {
            unforce_rtp_proxy();
        };
        sl_reply_error();
    }
}

route[2] {

    # -----------------------------------------------------------------
    # REGISTER Message Handler
    # ----------------------------------------------------------------

    if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
        setflag(6);
        fix_nated_register();
        force_rport();
    }

    sl_send_reply("100", "Trying");

    if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
        www_challenge("MY_OPENSIPS_IP","0");
        exit;
    }

    #if (!check_to()) {
    #    sl_send_reply("401", "Unauthorized Loi Ngo");
    #    exit;
    #}

    consume_credentials();

    if (!save("location")) {
        sl_reply_error();
    };
}

route[3] {

    # -----------------------------------------------------------------
    # INVITE Message Handler
    # -----------------------------------------------------------------
   
    #Drop because error Use From=ID when call. Open
    #if (!proxy_authorize("","subscriber")) {
    #    proxy_challenge("","0");
    #    exit;
    #} else if (!check_from()) {
    #    sl_send_reply("403", "Use From=ID");
    #    exit;
    #}

    #consume_credentials();

    if (nat_uac_test("19")) {
        setflag(6);
    }

    lookup("aliases");
    if (uri!=myself) {
        route(4);
        route(1);
        exit;
    }

    if (!lookup("location")) {
        sl_send_reply("404", "User Not Found");
        exit;
    }

    route(4);
    route(1);
}

route[4] {

    # -----------------------------------------------------------------
    # NAT Traversal Section
    # -----------------------------------------------------------------

    if (isflagset(6)) {
        force_rport();
        fix_nated_contact();
        force_rtp_proxy();
    }
}

onreply_route[1] {

    if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
        if (!search("^Content-Length:[ ]*0")) {
            force_rtp_proxy();
        }
    }

    if (nat_uac_test("1")) {
        fix_nated_contact();
    }
}


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

Bogdan-Andrei Iancu
Hi,

if the online-user info is correct, it looks like the
fix_nated_register() is not done.

Please post the output of "opensipsctl ul show", for that specific user.

Also test by using xlog if the at register time your processing gets
inside the "if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {".

Regards,
Bogdan

oso che bol wrote:

> Dear All,
>
> I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.
>
> I use X-Lite which is Behind NAT, register to OpenSIPs proxy, Opensips
> store right contact address. But, when i use Nokia E66 to register to
> Opensips, the contact address is bellow:
>
> Online SIP Users
> Username Domain Contact Expires User Agent
> 5000 *sip:5000@192.168.1.100
> <mailto:sip%3A5000@192.168.1.100>;transport=UDP* 2009-03-30 07:20:24.0
> E66-1 RM-343 102.07.81
>
> User 5000 do not store with external IP address of its (external
> address not 192.168.1.100). Do you have any ideas about this?
>
> Bellow is my Opensips.conf
>
> Thanks and Regards,
>
> -LN
>
> Opensips.conf
>
> ==================
>
> ####### Global Parameters #########
>
> debug=4
> log_stderror=yes
> log_facility=LOG_LOCAL0
>
> fork=yes
> children=4
>
> /* uncomment the following lines to enable debugging */
> #debug=6
> #fork=no
> #log_stderror=yes
>
> #disable_tcp=yes
> #disable_dns_blacklist=no
> #dns_try_ipv6=yes
> #auto_aliases=no
>
> /* uncomment the following lines to enable TLS support  (default off) */
> #disable_tls = no
> #listen = tls:your_IP:5061
> #tls_verify_server = 1
> #tls_verify_client = 1
> #tls_require_client_certificate = 0
> #tls_method = TLSv1
> #tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
> #tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
> #tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"
>
>
> port=5060
> listen=udp:MY_OPENSIP_IP:5060
>
>
> ####### Modules Section ########
>
> #set module path
> mpath="//lib/opensips/modules/"
>
> /* uncomment next line for MySQL DB support */
> loadmodule "db_mysql.so"
> loadmodule "sl.so"
> loadmodule "tm.so"
> loadmodule "rr.so"
> loadmodule "maxfwd.so"
> loadmodule "usrloc.so"
> loadmodule "registrar.so"
> loadmodule "textops.so"
> loadmodule "mi_fifo.so"
> loadmodule "uri_db.so"
> loadmodule "uri.so"
> loadmodule "xlog.so"
> loadmodule "acc.so"
> loadmodule "auth.so"
> loadmodule "auth_db.so"
>
> #loadmodule "presence.so"
> #loadmodule "presence_xml.so"
>
> loadmodule "nathelper.so"
> loadmodule "avpops.so"
> ######################
>
>
> modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
> modparam("rr", "enable_full_lr", 1)
> modparam("rr", "append_fromtag", 0)
> modparam("registrar", "method_filtering", 1)
>
> /* uncomment the next line to disable parallel forking via location */
> # modparam("registrar", "append_branches", 0)
> /* uncomment the next line not to allow more than 10 contacts per AOR */
> #modparam("registrar", "max_contacts", 10)
> modparam("uri_db", "use_uri_table", 1)
> modparam("uri_db", "db_url",
> "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
> #them for bug9, like guide in bug9
> modparam("uri_db", "db_table", "uri")
>
>
> # ----- acc params -----
> /* what sepcial events should be accounted ? */
> modparam("acc", "early_media", 1)
> modparam("acc", "report_ack", 1)
> modparam("acc", "report_cancels", 1)
> modparam("acc", "detect_direction", 0)
> modparam("acc", "failed_transaction_flag", 3)
> modparam("acc", "log_flag", 1)
> modparam("acc", "log_missed_flag", 2)
> modparam("acc", "db_flag", 1)
> modparam("acc", "db_missed_flag", 2)
>
> modparam("usrloc", "db_mode",   2)
> modparam("usrloc", "db_url",
>     "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>
> modparam("auth_db", "calculate_ha1", yes)
> modparam("auth_db", "password_column", "password")
> modparam("auth_db|permission", "db_url",
>     "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>
> modparam("avpops", "avp_url",
> "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
> modparam("avpops", "avp_table", "usr_preferences")
>
> #try for fix error of Mobile Address
> modparam("registrar", "received_avp", "$avp(s:rcv)")
> modparam("nathelper", "received_avp", "$avp(s:rcv)")
>
> #Theo guide http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
> modparam("usrloc", "nat_bflag", 6)
> modparam("nathelper", "ping_nated_only", 1)
> modparam("nathelper", "sipping_bflag", 8)
>
> #modparam("nathelper", "rtpproxy_sock", "udp:MY_RTPPROXY_IP:7890")
> modparam("nathelper", "force_socket", "udp:MY_RTPPROXY_IP:7890")
> modparam("nathelper", "natping_interval", 89)
> modparam("nathelper", "sipping_from", "sip:1000@MY_OPENSIP_IP")
>
>
> # main request routing logic
>
> route {
>
>     # -----------------------------------------------------------------
>     # Sanity Check Section
>     # -----------------------------------------------------------------
>     if (!mf_process_maxfwd_header("10")) {
>         sl_send_reply("483", "Too Many Hops");
>         exit;
>     }
>
>     if (msg:len > max_len) {
>         sl_send_reply("513", "Message Overflow");
>         exit;
>     }
>
>     # -----------------------------------------------------------------
>     # Record Route Section
>     # -----------------------------------------------------------------
>     if (method!="REGISTER") {
>         record_route();
>     }
>
>     if (method=="BYE" || method=="CANCEL") {
>         unforce_rtp_proxy();
>     }
>
>     # -----------------------------------------------------------------
>     # Loose Route Section
>     # -----------------------------------------------------------------
>     if (loose_route()) {
>
>         if ((method=="INVITE" || method=="REFER") && !has_totag()) {
>             sl_send_reply("403", "Forbidden");
>             exit;
>         }
>
>         if (method=="INVITE") {
>
>             if (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
>                 proxy_challenge("MY_OPENSIPS_IP","0");
>                 exit;
>             } else if (!check_from()) {
>                 sl_send_reply("403", "Use From=ID");
>                 exit;
>             }
>             consume_credentials();
>
>             if (nat_uac_test("19")) {
>                 setflag(6);
>                 force_rport();
>                 fix_nated_contact();
>             }
>             force_rtp_proxy("l");
>         }
>         route(1);
>         exit;
>     }
>
>     # -----------------------------------------------------------------
>     # Call Type Processing Section
>     # -----------------------------------------------------------------
>     if (uri!=myself) {
>         route(4);
>         route(1);
>         exit;
>     }
>
>     if (method=="ACK") {
>         route(1);
>         exit;
>     } else if (method=="CANCEL") {
>         route(1);
>         exit;
>     } else if (method=="INVITE") {
>         route(3);
>         exit;
>     } else  if (method=="REGISTER") {
>         route(2);
>         exit;
>     }
>
>     lookup("aliases");
>     if (uri!=myself) {
>         route(4);
>         route(1);
>         exit;
>     }
>
>     if (!lookup("location")) {
>         sl_send_reply("404", "User Not Found");
>         exit;
>     }
>
>     route(1);
> }
>
> route[1] {
>
>     # -----------------------------------------------------------------
>     # Default Message Handler
>     # -----------------------------------------------------------------
>
>     t_on_reply("1");
>
>     if (!t_relay()) {
>         if (method=="INVITE" && isflagset(6)) {
>             unforce_rtp_proxy();
>         };
>         sl_reply_error();
>     }
> }
>
> route[2] {
>
>     # -----------------------------------------------------------------
>     # REGISTER Message Handler
>     # ----------------------------------------------------------------
>
>     if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
>         setflag(6);
>         fix_nated_register();
>         force_rport();
>     }
>
>     sl_send_reply("100", "Trying");
>
>     if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
>         www_challenge("MY_OPENSIPS_IP","0");
>         exit;
>     }
>
>     #if (!check_to()) {
>     #    sl_send_reply("401", "Unauthorized Loi Ngo");
>     #    exit;
>     #}
>
>     consume_credentials();
>
>     if (!save("location")) {
>         sl_reply_error();
>     };
> }
>
> route[3] {
>
>     # -----------------------------------------------------------------
>     # INVITE Message Handler
>     # -----------------------------------------------------------------
>    
>     #Drop because error Use From=ID when call. Open
>     #if (!proxy_authorize("","subscriber")) {
>     #    proxy_challenge("","0");
>     #    exit;
>     #} else if (!check_from()) {
>     #    sl_send_reply("403", "Use From=ID");
>     #    exit;
>     #}
>
>     #consume_credentials();
>
>     if (nat_uac_test("19")) {
>         setflag(6);
>     }
>
>     lookup("aliases");
>     if (uri!=myself) {
>         route(4);
>         route(1);
>         exit;
>     }
>
>     if (!lookup("location")) {
>         sl_send_reply("404", "User Not Found");
>         exit;
>     }
>
>     route(4);
>     route(1);
> }
>
> route[4] {
>
>     # -----------------------------------------------------------------
>     # NAT Traversal Section
>     # -----------------------------------------------------------------
>
>     if (isflagset(6)) {
>         force_rport();
>         fix_nated_contact();
>         force_rtp_proxy();
>     }
> }
>
> onreply_route[1] {
>
>     if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
>         if (!search("^Content-Length:[ ]*0")) {
>             force_rtp_proxy();
>         }
>     }
>
>     if (nat_uac_test("1")) {
>         fix_nated_contact();
>     }
> }
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

oso che bol

Dear Bogdan

I change the config of NATed REGISTER request to:

    if (nat_uac_test("19")) {
        if (is_method("REGISTER") || !search("^Record-Route")) {
            log("LOG: HTK Someone trying to register from private IP, rewriting\n");
            fix_nated_contact(); # Rewrite contact with source IP of signalling
            force_rport(); # Add rport parameter to topmost Via
            setbflag(6);    # Mark as NATed
        if (method=="INVITE") {
            fix_nated_sdp("1"); # Add direction=active to SDP
            force_rport(); # Add rport parameter to topmost Via
            setbflag(6); # Mark as NATed
         };
        };

Output of "opensipsctl ul show":

[root@LN]# opensipsctl ul show
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
entering fifo_cmd ul_dump
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of input tree
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done parsing the mi tree
Domain:: aliases table=512 records=0 max_slot=0
Domain:: location table=512 records=2 max_slot=1
    AOR:: 5000
        Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=
            Expires:: 1038
            Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
            Cseq:: 6049
            User-agent:: E66-1 RM-343 102.07.81
            State:: CS_SYNC
            Flags:: 0
            Cflag:: 64
            Socket:: udp:174.132.X.Y:5060
            Methods:: 4294967295
    AOR:: 6000
        Contact:: sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
            Expires:: 1060
            Callid:: MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
            Cseq:: 6
            User-agent:: X-Lite release 1100l stamp 47546
            State:: CS_SYNC
            Flags:: 0
            Cflag:: 64
            Socket:: udp:174.132.X.Y:5060
            Methods:: 5951
FIFO command was:
:ul_dump:opensips_receiver_6568

Could you please explain why with mobile user 5000, the contact sip:5000@77.69.220.94:5060;transport=UDP and with X-Lite User 6000 the contact is 6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4

How fix_nated_register() differ with fix_nated_register(), do we need to call fix_nated_register() at REGISTER processing?

Thanks and Regards,

-LN

On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu <[hidden email]> wrote:

Hi,

if the online-user info is correct, it looks like the fix_nated_register() is not done.

Please post the output of "opensipsctl ul show", for that specific user.

Also test by using xlog if the at register time your processing gets inside the "if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {".

Regards,
Bogdan

oso che bol wrote:
Dear All,

I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.

I use X-Lite which is Behind NAT, register to OpenSIPs proxy, Opensips store right contact address. But, when i use Nokia E66 to register to Opensips, the contact address is bellow:
Online SIP Users
Username Domain Contact Expires User Agent
5000 *[hidden email] <mailto:[hidden email]>;transport=UDP* 2009-03-30 07:20:24.0 E66-1 RM-343 102.07.81


User 5000 do not store with external IP address of its (external address not 192.168.1.100). Do you have any ideas about this?

Bellow is my Opensips.conf

Thanks and Regards,

-LN

Opensips.conf

==================

####### Global Parameters #########

debug=4
log_stderror=yes
log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes

#disable_tcp=yes
#disable_dns_blacklist=no
#dns_try_ipv6=yes
#auto_aliases=no

/* uncomment the following lines to enable TLS support  (default off) */
#disable_tls = no
#listen = tls:your_IP:5061
#tls_verify_server = 1
#tls_verify_client = 1
#tls_require_client_certificate = 0
#tls_method = TLSv1
#tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
#tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
#tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"


port=5060
listen=udp:MY_OPENSIP_IP:5060


####### Modules Section ########

#set module path
mpath="//lib/opensips/modules/"

/* uncomment next line for MySQL DB support */
loadmodule "db_mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
loadmodule "uri_db.so"
loadmodule "uri.so"
loadmodule "xlog.so"
loadmodule "acc.so"
loadmodule "auth.so"
loadmodule "auth_db.so"

#loadmodule "presence.so"
#loadmodule "presence_xml.so"

loadmodule "nathelper.so"
loadmodule "avpops.so"
######################


modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 0)
modparam("registrar", "method_filtering", 1)

/* uncomment the next line to disable parallel forking via location */
# modparam("registrar", "append_branches", 0)
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
modparam("uri_db", "use_uri_table", 1)
modparam("uri_db", "db_url", "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
#them for bug9, like guide in bug9
modparam("uri_db", "db_table", "uri")


# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "detect_direction", 0)
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)

modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url",
   "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db|permission", "db_url",
   "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

modparam("avpops", "avp_url", "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
modparam("avpops", "avp_table", "usr_preferences")

#try for fix error of Mobile Address
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("nathelper", "received_avp", "$avp(s:rcv)")

#Theo guide http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
modparam("usrloc", "nat_bflag", 6)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", 8)

#modparam("nathelper", "rtpproxy_sock", "udp:MY_RTPPROXY_IP:7890")
modparam("nathelper", "force_socket", "udp:MY_RTPPROXY_IP:7890")
modparam("nathelper", "natping_interval", 89)
modparam("nathelper", "sipping_from", "sip:1000@MY_OPENSIP_IP")


# main request routing logic

route {

   # -----------------------------------------------------------------
   # Sanity Check Section
   # -----------------------------------------------------------------
   if (!mf_process_maxfwd_header("10")) {
       sl_send_reply("483", "Too Many Hops");
       exit;
   }

   if (msg:len > max_len) {
       sl_send_reply("513", "Message Overflow");
       exit;
   }

   # -----------------------------------------------------------------
   # Record Route Section
   # -----------------------------------------------------------------
   if (method!="REGISTER") {
       record_route();
   }

   if (method=="BYE" || method=="CANCEL") {
       unforce_rtp_proxy();
   }

   # -----------------------------------------------------------------
   # Loose Route Section
   # -----------------------------------------------------------------
   if (loose_route()) {

       if ((method=="INVITE" || method=="REFER") && !has_totag()) {
           sl_send_reply("403", "Forbidden");
           exit;
       }

       if (method=="INVITE") {

           if (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
               proxy_challenge("MY_OPENSIPS_IP","0");
               exit;
           } else if (!check_from()) {
               sl_send_reply("403", "Use From=ID");
               exit;
           }
           consume_credentials();

           if (nat_uac_test("19")) {
               setflag(6);
               force_rport();
               fix_nated_contact();
           }
           force_rtp_proxy("l");
       }
       route(1);
       exit;
   }

   # -----------------------------------------------------------------
   # Call Type Processing Section
   # -----------------------------------------------------------------
   if (uri!=myself) {
       route(4);
       route(1);
       exit;
   }

   if (method=="ACK") {
       route(1);
       exit;
   } else if (method=="CANCEL") {
       route(1);
       exit;
   } else if (method=="INVITE") {
       route(3);
       exit;
   } else  if (method=="REGISTER") {
       route(2);
       exit;
   }

   lookup("aliases");
   if (uri!=myself) {
       route(4);
       route(1);
       exit;
   }

   if (!lookup("location")) {
       sl_send_reply("404", "User Not Found");
       exit;
   }

   route(1);
}

route[1] {

   # -----------------------------------------------------------------
   # Default Message Handler
   # -----------------------------------------------------------------

   t_on_reply("1");

   if (!t_relay()) {
       if (method=="INVITE" && isflagset(6)) {
           unforce_rtp_proxy();
       };
       sl_reply_error();
   }
}

route[2] {

   # -----------------------------------------------------------------
   # REGISTER Message Handler
   # ----------------------------------------------------------------

   if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
       setflag(6);
       fix_nated_register();
       force_rport();
   }

   sl_send_reply("100", "Trying");

   if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
       www_challenge("MY_OPENSIPS_IP","0");
       exit;
   }

   #if (!check_to()) {
   #    sl_send_reply("401", "Unauthorized Loi Ngo");
   #    exit;
   #}

   consume_credentials();

   if (!save("location")) {
       sl_reply_error();
   };
}

route[3] {

   # -----------------------------------------------------------------
   # INVITE Message Handler
   # -----------------------------------------------------------------
     #Drop because error Use From=ID when call. Open
   #if (!proxy_authorize("","subscriber")) {
   #    proxy_challenge("","0");
   #    exit;
   #} else if (!check_from()) {
   #    sl_send_reply("403", "Use From=ID");
   #    exit;
   #}

   #consume_credentials();

   if (nat_uac_test("19")) {
       setflag(6);
   }

   lookup("aliases");
   if (uri!=myself) {
       route(4);
       route(1);
       exit;
   }

   if (!lookup("location")) {
       sl_send_reply("404", "User Not Found");
       exit;
   }

   route(4);
   route(1);
}

route[4] {

   # -----------------------------------------------------------------
   # NAT Traversal Section
   # -----------------------------------------------------------------

   if (isflagset(6)) {
       force_rport();
       fix_nated_contact();
       force_rtp_proxy();
   }
}

onreply_route[1] {

   if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
       if (!search("^Content-Length:[ ]*0")) {
           force_rtp_proxy();
       }
   }

   if (nat_uac_test("1")) {
       fix_nated_contact();
   }
}

------------------------------------------------------------------------

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
 



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

Bogdan-Andrei Iancu
Please use fix_nated_register() for REGISTER requests - this will set
the appropriate info to be saved in usrloc.

fix_nated_register() is not changing the contact (so the usrloc will
save the real contact), but is just setting some additional info to be
saved in usrloc (the received field)

fix_nated_contact() is actually changing the contact from the request -
this is to be used for non-REGISTER requests.

Regards,
Bogdan

oso che bol wrote:

>
> Dear Bogdan
>
> I change the config of NATed REGISTER request to:
>
> /    if (nat_uac_test("19")) {
>         if (is_method("REGISTER") || !search("^Record-Route")) {
>             log("LOG: HTK Someone trying to register from private IP,
> rewriting\n");
>             fix_nated_contact(); # Rewrite contact with source IP of
> signalling
>             force_rport(); # Add rport parameter to topmost Via
>             setbflag(6);    # Mark as NATed
>         if (method=="INVITE") {
>             fix_nated_sdp("1"); # Add direction=active to SDP
>             force_rport(); # Add rport parameter to topmost Via
>             setbflag(6); # Mark as NATed
>          };
>         };/
>
> Output of "opensipsctl ul show":
>
> /[root@LN]# opensipsctl ul show
> database engine 'MYSQL' loaded
> Control engine 'FIFO' loaded
> entering fifo_cmd ul_dump
> Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of input tree
> Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done parsing the mi
> tree
> Domain:: aliases table=512 records=0 max_slot=0
> Domain:: location table=512 records=2 max_slot=1
>     AOR:: 5000
>         Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=
>             Expires:: 1038
>             Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
>             Cseq:: 6049
>             User-agent:: E66-1 RM-343 102.07.81
>             State:: CS_SYNC
>             Flags:: 0
>             Cflag:: 64
>             Socket:: udp:174.132.X.Y:5060
>             Methods:: 4294967295
>     AOR:: 6000
>         Contact::
> sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
>             Expires:: 1060
>             Callid:: MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
>             Cseq:: 6
>             User-agent:: X-Lite release 1100l stamp 47546
>             State:: CS_SYNC
>             Flags:: 0
>             Cflag:: 64
>             Socket:: udp:174.132.X.Y:5060
>             Methods:: 5951
> FIFO command was:
> :ul_dump:opensips_receiver_6568/
>
> Could you please explain why with mobile user 5000, the contact
> /sip:5000@77.69.220.94:5060;transport=UDP /and with X-Lite User 6000
> the contact is /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/
>
> How fix_nated_register() differ with fix_nated_register(), do we need
> to call fix_nated_register() at REGISTER processing?
>
> Thanks and Regards,
>
> -LN
>
> On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     if the online-user info is correct, it looks like the
>     fix_nated_register() is not done.
>
>     Please post the output of "opensipsctl ul show", for that specific
>     user.
>
>     Also test by using xlog if the at register time your processing
>     gets inside the "if (!search("^Contact:[ ]*\*") &&
>     nat_uac_test("19")) {".
>
>     Regards,
>     Bogdan
>
>     oso che bol wrote:
>
>         Dear All,
>
>         I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.
>
>         I use X-Lite which is Behind NAT, register to OpenSIPs proxy,
>         Opensips store right contact address. But, when i use Nokia
>         E66 to register to Opensips, the contact address is bellow:
>         Online SIP Users
>         Username Domain Contact Expires User Agent
>         5000 *sip:5000@192.168.1.100 <mailto:sip%3A5000@192.168.1.100>
>         <mailto:sip%3A5000@192.168.1.100
>         <mailto:sip%253A5000@192.168.1.100>>;transport=UDP* 2009-03-30
>         07:20:24.0 E66-1 RM-343 102.07.81
>
>
>         User 5000 do not store with external IP address of its
>         (external address not 192.168.1.100). Do you have any ideas
>         about this?
>
>         Bellow is my Opensips.conf
>
>         Thanks and Regards,
>
>         -LN
>
>         Opensips.conf
>
>         ==================
>
>         ####### Global Parameters #########
>
>         debug=4
>         log_stderror=yes
>         log_facility=LOG_LOCAL0
>
>         fork=yes
>         children=4
>
>         /* uncomment the following lines to enable debugging */
>         #debug=6
>         #fork=no
>         #log_stderror=yes
>
>         #disable_tcp=yes
>         #disable_dns_blacklist=no
>         #dns_try_ipv6=yes
>         #auto_aliases=no
>
>         /* uncomment the following lines to enable TLS support
>          (default off) */
>         #disable_tls = no
>         #listen = tls:your_IP:5061
>         #tls_verify_server = 1
>         #tls_verify_client = 1
>         #tls_require_client_certificate = 0
>         #tls_method = TLSv1
>         #tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
>         #tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
>         #tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"
>
>
>         port=5060
>         listen=udp:MY_OPENSIP_IP:5060
>
>
>         ####### Modules Section ########
>
>         #set module path
>         mpath="//lib/opensips/modules/"
>
>         /* uncomment next line for MySQL DB support */
>         loadmodule "db_mysql.so"
>         loadmodule "sl.so"
>         loadmodule "tm.so"
>         loadmodule "rr.so"
>         loadmodule "maxfwd.so"
>         loadmodule "usrloc.so"
>         loadmodule "registrar.so"
>         loadmodule "textops.so"
>         loadmodule "mi_fifo.so"
>         loadmodule "uri_db.so"
>         loadmodule "uri.so"
>         loadmodule "xlog.so"
>         loadmodule "acc.so"
>         loadmodule "auth.so"
>         loadmodule "auth_db.so"
>
>         #loadmodule "presence.so"
>         #loadmodule "presence_xml.so"
>
>         loadmodule "nathelper.so"
>         loadmodule "avpops.so"
>         ######################
>
>
>         modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
>         modparam("rr", "enable_full_lr", 1)
>         modparam("rr", "append_fromtag", 0)
>         modparam("registrar", "method_filtering", 1)
>
>         /* uncomment the next line to disable parallel forking via
>         location */
>         # modparam("registrar", "append_branches", 0)
>         /* uncomment the next line not to allow more than 10 contacts
>         per AOR */
>         #modparam("registrar", "max_contacts", 10)
>         modparam("uri_db", "use_uri_table", 1)
>         modparam("uri_db", "db_url",
>         "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>         #them for bug9, like guide in bug9
>         modparam("uri_db", "db_table", "uri")
>
>
>         # ----- acc params -----
>         /* what sepcial events should be accounted ? */
>         modparam("acc", "early_media", 1)
>         modparam("acc", "report_ack", 1)
>         modparam("acc", "report_cancels", 1)
>         modparam("acc", "detect_direction", 0)
>         modparam("acc", "failed_transaction_flag", 3)
>         modparam("acc", "log_flag", 1)
>         modparam("acc", "log_missed_flag", 2)
>         modparam("acc", "db_flag", 1)
>         modparam("acc", "db_missed_flag", 2)
>
>         modparam("usrloc", "db_mode",   2)
>         modparam("usrloc", "db_url",
>            "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>
>         modparam("auth_db", "calculate_ha1", yes)
>         modparam("auth_db", "password_column", "password")
>         modparam("auth_db|permission", "db_url",
>            "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>
>         modparam("avpops", "avp_url",
>         "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>         modparam("avpops", "avp_table", "usr_preferences")
>
>         #try for fix error of Mobile Address
>         modparam("registrar", "received_avp", "$avp(s:rcv)")
>         modparam("nathelper", "received_avp", "$avp(s:rcv)")
>
>         #Theo guide
>         http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
>         modparam("usrloc", "nat_bflag", 6)
>         modparam("nathelper", "ping_nated_only", 1)
>         modparam("nathelper", "sipping_bflag", 8)
>
>         #modparam("nathelper", "rtpproxy_sock", "udp:MY_RTPPROXY_IP:7890")
>         modparam("nathelper", "force_socket", "udp:MY_RTPPROXY_IP:7890")
>         modparam("nathelper", "natping_interval", 89)
>         modparam("nathelper", "sipping_from", "sip:1000@MY_OPENSIP_IP")
>
>
>         # main request routing logic
>
>         route {
>
>            #
>         -----------------------------------------------------------------
>            # Sanity Check Section
>            #
>         -----------------------------------------------------------------
>            if (!mf_process_maxfwd_header("10")) {
>                sl_send_reply("483", "Too Many Hops");
>                exit;
>            }
>
>            if (msg:len > max_len) {
>                sl_send_reply("513", "Message Overflow");
>                exit;
>            }
>
>            #
>         -----------------------------------------------------------------
>            # Record Route Section
>            #
>         -----------------------------------------------------------------
>            if (method!="REGISTER") {
>                record_route();
>            }
>
>            if (method=="BYE" || method=="CANCEL") {
>                unforce_rtp_proxy();
>            }
>
>            #
>         -----------------------------------------------------------------
>            # Loose Route Section
>            #
>         -----------------------------------------------------------------
>            if (loose_route()) {
>
>                if ((method=="INVITE" || method=="REFER") &&
>         !has_totag()) {
>                    sl_send_reply("403", "Forbidden");
>                    exit;
>                }
>
>                if (method=="INVITE") {
>
>                    if (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
>                        proxy_challenge("MY_OPENSIPS_IP","0");
>                        exit;
>                    } else if (!check_from()) {
>                        sl_send_reply("403", "Use From=ID");
>                        exit;
>                    }
>                    consume_credentials();
>
>                    if (nat_uac_test("19")) {
>                        setflag(6);
>                        force_rport();
>                        fix_nated_contact();
>                    }
>                    force_rtp_proxy("l");
>                }
>                route(1);
>                exit;
>            }
>
>            #
>         -----------------------------------------------------------------
>            # Call Type Processing Section
>            #
>         -----------------------------------------------------------------
>            if (uri!=myself) {
>                route(4);
>                route(1);
>                exit;
>            }
>
>            if (method=="ACK") {
>                route(1);
>                exit;
>            } else if (method=="CANCEL") {
>                route(1);
>                exit;
>            } else if (method=="INVITE") {
>                route(3);
>                exit;
>            } else  if (method=="REGISTER") {
>                route(2);
>                exit;
>            }
>
>            lookup("aliases");
>            if (uri!=myself) {
>                route(4);
>                route(1);
>                exit;
>            }
>
>            if (!lookup("location")) {
>                sl_send_reply("404", "User Not Found");
>                exit;
>            }
>
>            route(1);
>         }
>
>         route[1] {
>
>            #
>         -----------------------------------------------------------------
>            # Default Message Handler
>            #
>         -----------------------------------------------------------------
>
>            t_on_reply("1");
>
>            if (!t_relay()) {
>                if (method=="INVITE" && isflagset(6)) {
>                    unforce_rtp_proxy();
>                };
>                sl_reply_error();
>            }
>         }
>
>         route[2] {
>
>            #
>         -----------------------------------------------------------------
>            # REGISTER Message Handler
>            #
>         ----------------------------------------------------------------
>
>            if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
>                setflag(6);
>                fix_nated_register();
>                force_rport();
>            }
>
>            sl_send_reply("100", "Trying");
>
>            if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
>                www_challenge("MY_OPENSIPS_IP","0");
>                exit;
>            }
>
>            #if (!check_to()) {
>            #    sl_send_reply("401", "Unauthorized Loi Ngo");
>            #    exit;
>            #}
>
>            consume_credentials();
>
>            if (!save("location")) {
>                sl_reply_error();
>            };
>         }
>
>         route[3] {
>
>            #
>         -----------------------------------------------------------------
>            # INVITE Message Handler
>            #
>         -----------------------------------------------------------------
>              #Drop because error Use From=ID when call. Open
>            #if (!proxy_authorize("","subscriber")) {
>            #    proxy_challenge("","0");
>            #    exit;
>            #} else if (!check_from()) {
>            #    sl_send_reply("403", "Use From=ID");
>            #    exit;
>            #}
>
>            #consume_credentials();
>
>            if (nat_uac_test("19")) {
>                setflag(6);
>            }
>
>            lookup("aliases");
>            if (uri!=myself) {
>                route(4);
>                route(1);
>                exit;
>            }
>
>            if (!lookup("location")) {
>                sl_send_reply("404", "User Not Found");
>                exit;
>            }
>
>            route(4);
>            route(1);
>         }
>
>         route[4] {
>
>            #
>         -----------------------------------------------------------------
>            # NAT Traversal Section
>            #
>         -----------------------------------------------------------------
>
>            if (isflagset(6)) {
>                force_rport();
>                fix_nated_contact();
>                force_rtp_proxy();
>            }
>         }
>
>         onreply_route[1] {
>
>            if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
>                if (!search("^Content-Length:[ ]*0")) {
>                    force_rtp_proxy();
>                }
>            }
>
>            if (nat_uac_test("1")) {
>                fix_nated_contact();
>            }
>         }
>
>         ------------------------------------------------------------------------
>
>         _______________________________________________
>         Users mailing list
>         [hidden email] <mailto:[hidden email]>
>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>          
>
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

oso che bol
Dear Bogdan,

Thanks very much for your time.

Regards,
-LN

On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Please use fix_nated_register() for REGISTER requests - this will set the appropriate info to be saved in usrloc.

fix_nated_register() is not changing the contact (so the usrloc will save the real contact), but is just setting some additional info to be saved in usrloc (the received field)

fix_nated_contact() is actually changing the contact from the request - this is to be used for non-REGISTER requests.


Regards,
Bogdan

oso che bol wrote:

Dear Bogdan

I change the config of NATed REGISTER request to:

/    if (nat_uac_test("19")) {
       if (is_method("REGISTER") || !search("^Record-Route")) {
           log("LOG: HTK Someone trying to register from private IP, rewriting\n");
           fix_nated_contact(); # Rewrite contact with source IP of signalling
           force_rport(); # Add rport parameter to topmost Via
           setbflag(6);    # Mark as NATed
       if (method=="INVITE") {
           fix_nated_sdp("1"); # Add direction=active to SDP
           force_rport(); # Add rport parameter to topmost Via
           setbflag(6); # Mark as NATed
        };
       };/

Output of "opensipsctl ul show":

/[root@LN]# opensipsctl ul show
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
entering fifo_cmd ul_dump
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of input tree
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done parsing the mi tree
Domain:: aliases table=512 records=0 max_slot=0
Domain:: location table=512 records=2 max_slot=1
   AOR:: 5000
       Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=
           Expires:: 1038
           Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
           Cseq:: 6049
           User-agent:: E66-1 RM-343 102.07.81
           State:: CS_SYNC
           Flags:: 0
           Cflag:: 64
           Socket:: udp:174.132.X.Y:5060
           Methods:: 4294967295
   AOR:: 6000
       Contact:: sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
           Expires:: 1060
           Callid:: MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
           Cseq:: 6
           User-agent:: X-Lite release 1100l stamp 47546
           State:: CS_SYNC
           Flags:: 0
           Cflag:: 64
           Socket:: udp:174.132.X.Y:5060
           Methods:: 5951
FIFO command was:
:ul_dump:opensips_receiver_6568/

Could you please explain why with mobile user 5000, the contact /sip:5000@77.69.220.94:5060;transport=UDP /and with X-Lite User 6000 the contact is /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/

How fix_nated_register() differ with fix_nated_register(), do we need to call fix_nated_register() at REGISTER processing?

Thanks and Regards,

-LN

On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu <[hidden email] <mailto:[hidden email]>> wrote:

   Hi,

   if the online-user info is correct, it looks like the
   fix_nated_register() is not done.

   Please post the output of "opensipsctl ul show", for that specific
   user.

   Also test by using xlog if the at register time your processing
   gets inside the "if (!search("^Contact:[ ]*\*") &&
   nat_uac_test("19")) {".

   Regards,
   Bogdan

   oso che bol wrote:

       Dear All,

       I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.

       I use X-Lite which is Behind NAT, register to OpenSIPs proxy,
       Opensips store right contact address. But, when i use Nokia
       E66 to register to Opensips, the contact address is bellow:
       Online SIP Users
       Username Domain Contact Expires User Agent
       5000 *[hidden email] <mailto:[hidden email]>
       <mailto:[hidden email]
       <mailto:[hidden email]>>;transport=UDP* 2009-03-30

       07:20:24.0 E66-1 RM-343 102.07.81


       User 5000 do not store with external IP address of its
       (external address not 192.168.1.100). Do you have any ideas
       about this?

       Bellow is my Opensips.conf

       Thanks and Regards,

       -LN

       Opensips.conf

       ==================

       ####### Global Parameters #########

       debug=4
       log_stderror=yes
       log_facility=LOG_LOCAL0

       fork=yes
       children=4

       /* uncomment the following lines to enable debugging */
       #debug=6
       #fork=no
       #log_stderror=yes

       #disable_tcp=yes
       #disable_dns_blacklist=no
       #dns_try_ipv6=yes
       #auto_aliases=no

       /* uncomment the following lines to enable TLS support
        (default off) */
       #disable_tls = no
       #listen = tls:your_IP:5061
       #tls_verify_server = 1
       #tls_verify_client = 1
       #tls_require_client_certificate = 0
       #tls_method = TLSv1
       #tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
       #tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
       #tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"


       port=5060
       listen=udp:MY_OPENSIP_IP:5060


       ####### Modules Section ########

       #set module path
       mpath="//lib/opensips/modules/"

       /* uncomment next line for MySQL DB support */
       loadmodule "db_mysql.so"
       loadmodule "sl.so"
       loadmodule "tm.so"
       loadmodule "rr.so"
       loadmodule "maxfwd.so"
       loadmodule "usrloc.so"
       loadmodule "registrar.so"
       loadmodule "textops.so"
       loadmodule "mi_fifo.so"
       loadmodule "uri_db.so"
       loadmodule "uri.so"
       loadmodule "xlog.so"
       loadmodule "acc.so"
       loadmodule "auth.so"
       loadmodule "auth_db.so"

       #loadmodule "presence.so"
       #loadmodule "presence_xml.so"

       loadmodule "nathelper.so"
       loadmodule "avpops.so"
       ######################


       modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
       modparam("rr", "enable_full_lr", 1)
       modparam("rr", "append_fromtag", 0)
       modparam("registrar", "method_filtering", 1)

       /* uncomment the next line to disable parallel forking via
       location */
       # modparam("registrar", "append_branches", 0)
       /* uncomment the next line not to allow more than 10 contacts
       per AOR */
       #modparam("registrar", "max_contacts", 10)
       modparam("uri_db", "use_uri_table", 1)
       modparam("uri_db", "db_url",
       "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
       #them for bug9, like guide in bug9
       modparam("uri_db", "db_table", "uri")


       # ----- acc params -----
       /* what sepcial events should be accounted ? */
       modparam("acc", "early_media", 1)
       modparam("acc", "report_ack", 1)
       modparam("acc", "report_cancels", 1)
       modparam("acc", "detect_direction", 0)
       modparam("acc", "failed_transaction_flag", 3)
       modparam("acc", "log_flag", 1)
       modparam("acc", "log_missed_flag", 2)
       modparam("acc", "db_flag", 1)
       modparam("acc", "db_missed_flag", 2)

       modparam("usrloc", "db_mode",   2)
       modparam("usrloc", "db_url",
          "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

       modparam("auth_db", "calculate_ha1", yes)
       modparam("auth_db", "password_column", "password")
       modparam("auth_db|permission", "db_url",
          "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

       modparam("avpops", "avp_url",
       "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
       modparam("avpops", "avp_table", "usr_preferences")

       #try for fix error of Mobile Address
       modparam("registrar", "received_avp", "$avp(s:rcv)")
       modparam("nathelper", "received_avp", "$avp(s:rcv)")

       #Theo guide
       http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
       modparam("usrloc", "nat_bflag", 6)
       modparam("nathelper", "ping_nated_only", 1)
       modparam("nathelper", "sipping_bflag", 8)

       #modparam("nathelper", "rtpproxy_sock", "udp:MY_RTPPROXY_IP:7890")
       modparam("nathelper", "force_socket", "udp:MY_RTPPROXY_IP:7890")
       modparam("nathelper", "natping_interval", 89)
       modparam("nathelper", "sipping_from", "sip:1000@MY_OPENSIP_IP")


       # main request routing logic

       route {

          #
       -----------------------------------------------------------------
          # Sanity Check Section
          #
       -----------------------------------------------------------------
          if (!mf_process_maxfwd_header("10")) {
              sl_send_reply("483", "Too Many Hops");
              exit;
          }

          if (msg:len > max_len) {
              sl_send_reply("513", "Message Overflow");
              exit;
          }

          #
       -----------------------------------------------------------------
          # Record Route Section
          #
       -----------------------------------------------------------------
          if (method!="REGISTER") {
              record_route();
          }

          if (method=="BYE" || method=="CANCEL") {
              unforce_rtp_proxy();
          }

          #
       -----------------------------------------------------------------
          # Loose Route Section
          #
       -----------------------------------------------------------------
          if (loose_route()) {

              if ((method=="INVITE" || method=="REFER") &&
       !has_totag()) {
                  sl_send_reply("403", "Forbidden");
                  exit;
              }

              if (method=="INVITE") {

                  if (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
                      proxy_challenge("MY_OPENSIPS_IP","0");
                      exit;
                  } else if (!check_from()) {
                      sl_send_reply("403", "Use From=ID");
                      exit;
                  }
                  consume_credentials();

                  if (nat_uac_test("19")) {
                      setflag(6);
                      force_rport();
                      fix_nated_contact();
                  }
                  force_rtp_proxy("l");
              }
              route(1);
              exit;
          }

          #
       -----------------------------------------------------------------
          # Call Type Processing Section
          #
       -----------------------------------------------------------------
          if (uri!=myself) {
              route(4);
              route(1);
              exit;
          }

          if (method=="ACK") {
              route(1);
              exit;
          } else if (method=="CANCEL") {
              route(1);
              exit;
          } else if (method=="INVITE") {
              route(3);
              exit;
          } else  if (method=="REGISTER") {
              route(2);
              exit;
          }

          lookup("aliases");
          if (uri!=myself) {
              route(4);
              route(1);
              exit;
          }

          if (!lookup("location")) {
              sl_send_reply("404", "User Not Found");
              exit;
          }

          route(1);
       }

       route[1] {

          #
       -----------------------------------------------------------------
          # Default Message Handler
          #
       -----------------------------------------------------------------

          t_on_reply("1");

          if (!t_relay()) {
              if (method=="INVITE" && isflagset(6)) {
                  unforce_rtp_proxy();
              };
              sl_reply_error();
          }
       }

       route[2] {

          #
       -----------------------------------------------------------------
          # REGISTER Message Handler
          #
       ----------------------------------------------------------------

          if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
              setflag(6);
              fix_nated_register();
              force_rport();
          }

          sl_send_reply("100", "Trying");

          if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
              www_challenge("MY_OPENSIPS_IP","0");
              exit;
          }

          #if (!check_to()) {
          #    sl_send_reply("401", "Unauthorized Loi Ngo");
          #    exit;
          #}

          consume_credentials();

          if (!save("location")) {
              sl_reply_error();
          };
       }

       route[3] {

          #
       -----------------------------------------------------------------
          # INVITE Message Handler
          #
       -----------------------------------------------------------------
            #Drop because error Use From=ID when call. Open
          #if (!proxy_authorize("","subscriber")) {
          #    proxy_challenge("","0");
          #    exit;
          #} else if (!check_from()) {
          #    sl_send_reply("403", "Use From=ID");
          #    exit;
          #}

          #consume_credentials();

          if (nat_uac_test("19")) {
              setflag(6);
          }

          lookup("aliases");
          if (uri!=myself) {
              route(4);
              route(1);
              exit;
          }

          if (!lookup("location")) {
              sl_send_reply("404", "User Not Found");
              exit;
          }

          route(4);
          route(1);
       }

       route[4] {

          #
       -----------------------------------------------------------------
          # NAT Traversal Section
          #
       -----------------------------------------------------------------

          if (isflagset(6)) {
              force_rport();
              fix_nated_contact();
              force_rtp_proxy();
          }
       }

       onreply_route[1] {

          if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
              if (!search("^Content-Length:[ ]*0")) {
                  force_rtp_proxy();
              }
          }

          if (nat_uac_test("1")) {
              fix_nated_contact();
          }
       }

       ------------------------------------------------------------------------

       _______________________________________________
       Users mailing list
       [hidden email] <mailto:[hidden email]>



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

oso che bol
Dear Bogdan,

Regarding about old question, could you please tell me why:
- Contact of Mobile: sip:[hidden email]:1120
- Contact of X-Lite: sip:[hidden email]:14553;rinstance=abb597b601e7398b

What is rinstance and does it impact to the call. I make call from Mobile (SJPhone on winCE) to X-Lite and after 32s, it drop call. Both UAs behind NAT.

But, x-lite --to/from -- x-lite: call successful, no drop.

Thanks,
-LN

On Tue, Mar 31, 2009 at 11:09 PM, oso che bol <[hidden email]> wrote:
Dear Bogdan,

Thanks very much for your time.

Regards,
-LN


On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Please use fix_nated_register() for REGISTER requests - this will set the appropriate info to be saved in usrloc.

fix_nated_register() is not changing the contact (so the usrloc will save the real contact), but is just setting some additional info to be saved in usrloc (the received field)

fix_nated_contact() is actually changing the contact from the request - this is to be used for non-REGISTER requests.


Regards,
Bogdan

oso che bol wrote:

Dear Bogdan

I change the config of NATed REGISTER request to:

/    if (nat_uac_test("19")) {
       if (is_method("REGISTER") || !search("^Record-Route")) {
           log("LOG: HTK Someone trying to register from private IP, rewriting\n");
           fix_nated_contact(); # Rewrite contact with source IP of signalling
           force_rport(); # Add rport parameter to topmost Via
           setbflag(6);    # Mark as NATed
       if (method=="INVITE") {
           fix_nated_sdp("1"); # Add direction=active to SDP
           force_rport(); # Add rport parameter to topmost Via
           setbflag(6); # Mark as NATed
        };
       };/

Output of "opensipsctl ul show":

/[root@LN]# opensipsctl ul show
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
entering fifo_cmd ul_dump
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of input tree
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done parsing the mi tree
Domain:: aliases table=512 records=0 max_slot=0
Domain:: location table=512 records=2 max_slot=1
   AOR:: 5000
       Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=
           Expires:: 1038
           Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
           Cseq:: 6049
           User-agent:: E66-1 RM-343 102.07.81
           State:: CS_SYNC
           Flags:: 0
           Cflag:: 64
           Socket:: udp:174.132.X.Y:5060
           Methods:: 4294967295
   AOR:: 6000
       Contact:: sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
           Expires:: 1060
           Callid:: MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
           Cseq:: 6
           User-agent:: X-Lite release 1100l stamp 47546
           State:: CS_SYNC
           Flags:: 0
           Cflag:: 64
           Socket:: udp:174.132.X.Y:5060
           Methods:: 5951
FIFO command was:
:ul_dump:opensips_receiver_6568/

Could you please explain why with mobile user 5000, the contact /sip:5000@77.69.220.94:5060;transport=UDP /and with X-Lite User 6000 the contact is /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/

How fix_nated_register() differ with fix_nated_register(), do we need to call fix_nated_register() at REGISTER processing?

Thanks and Regards,

-LN

On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu <[hidden email] <mailto:[hidden email]>> wrote:

   Hi,

   if the online-user info is correct, it looks like the
   fix_nated_register() is not done.

   Please post the output of "opensipsctl ul show", for that specific
   user.

   Also test by using xlog if the at register time your processing
   gets inside the "if (!search("^Contact:[ ]*\*") &&
   nat_uac_test("19")) {".

   Regards,
   Bogdan

   oso che bol wrote:

       Dear All,

       I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.

       I use X-Lite which is Behind NAT, register to OpenSIPs proxy,
       Opensips store right contact address. But, when i use Nokia
       E66 to register to Opensips, the contact address is bellow:
       Online SIP Users
       Username Domain Contact Expires User Agent
       5000 *[hidden email] <mailto:[hidden email]>
       <mailto:[hidden email]
       <mailto:[hidden email]>>;transport=UDP* 2009-03-30

       07:20:24.0 E66-1 RM-343 102.07.81


       User 5000 do not store with external IP address of its
       (external address not 192.168.1.100). Do you have any ideas
       about this?

       Bellow is my Opensips.conf

       Thanks and Regards,

       -LN

       Opensips.conf

       ==================

       ####### Global Parameters #########

       debug=4
       log_stderror=yes
       log_facility=LOG_LOCAL0

       fork=yes
       children=4

       /* uncomment the following lines to enable debugging */
       #debug=6
       #fork=no
       #log_stderror=yes

       #disable_tcp=yes
       #disable_dns_blacklist=no
       #dns_try_ipv6=yes
       #auto_aliases=no

       /* uncomment the following lines to enable TLS support
        (default off) */
       #disable_tls = no
       #listen = tls:your_IP:5061
       #tls_verify_server = 1
       #tls_verify_client = 1
       #tls_require_client_certificate = 0
       #tls_method = TLSv1
       #tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
       #tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
       #tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"


       port=5060
       listen=udp:MY_OPENSIP_IP:5060


       ####### Modules Section ########

       #set module path
       mpath="//lib/opensips/modules/"

       /* uncomment next line for MySQL DB support */
       loadmodule "db_mysql.so"
       loadmodule "sl.so"
       loadmodule "tm.so"
       loadmodule "rr.so"
       loadmodule "maxfwd.so"
       loadmodule "usrloc.so"
       loadmodule "registrar.so"
       loadmodule "textops.so"
       loadmodule "mi_fifo.so"
       loadmodule "uri_db.so"
       loadmodule "uri.so"
       loadmodule "xlog.so"
       loadmodule "acc.so"
       loadmodule "auth.so"
       loadmodule "auth_db.so"

       #loadmodule "presence.so"
       #loadmodule "presence_xml.so"

       loadmodule "nathelper.so"
       loadmodule "avpops.so"
       ######################


       modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
       modparam("rr", "enable_full_lr", 1)
       modparam("rr", "append_fromtag", 0)
       modparam("registrar", "method_filtering", 1)

       /* uncomment the next line to disable parallel forking via
       location */
       # modparam("registrar", "append_branches", 0)
       /* uncomment the next line not to allow more than 10 contacts
       per AOR */
       #modparam("registrar", "max_contacts", 10)
       modparam("uri_db", "use_uri_table", 1)
       modparam("uri_db", "db_url",
       "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
       #them for bug9, like guide in bug9
       modparam("uri_db", "db_table", "uri")


       # ----- acc params -----
       /* what sepcial events should be accounted ? */
       modparam("acc", "early_media", 1)
       modparam("acc", "report_ack", 1)
       modparam("acc", "report_cancels", 1)
       modparam("acc", "detect_direction", 0)
       modparam("acc", "failed_transaction_flag", 3)
       modparam("acc", "log_flag", 1)
       modparam("acc", "log_missed_flag", 2)
       modparam("acc", "db_flag", 1)
       modparam("acc", "db_missed_flag", 2)

       modparam("usrloc", "db_mode",   2)
       modparam("usrloc", "db_url",
          "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

       modparam("auth_db", "calculate_ha1", yes)
       modparam("auth_db", "password_column", "password")
       modparam("auth_db|permission", "db_url",
          "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

       modparam("avpops", "avp_url",
       "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
       modparam("avpops", "avp_table", "usr_preferences")

       #try for fix error of Mobile Address
       modparam("registrar", "received_avp", "$avp(s:rcv)")
       modparam("nathelper", "received_avp", "$avp(s:rcv)")

       #Theo guide
       http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
       modparam("usrloc", "nat_bflag", 6)
       modparam("nathelper", "ping_nated_only", 1)
       modparam("nathelper", "sipping_bflag", 8)

       #modparam("nathelper", "rtpproxy_sock", "udp:MY_RTPPROXY_IP:7890")
       modparam("nathelper", "force_socket", "udp:MY_RTPPROXY_IP:7890")
       modparam("nathelper", "natping_interval", 89)
       modparam("nathelper", "sipping_from", "sip:1000@MY_OPENSIP_IP")


       # main request routing logic

       route {

          #
       -----------------------------------------------------------------
          # Sanity Check Section
          #
       -----------------------------------------------------------------
          if (!mf_process_maxfwd_header("10")) {
              sl_send_reply("483", "Too Many Hops");
              exit;
          }

          if (msg:len > max_len) {
              sl_send_reply("513", "Message Overflow");
              exit;
          }

          #
       -----------------------------------------------------------------
          # Record Route Section
          #
       -----------------------------------------------------------------
          if (method!="REGISTER") {
              record_route();
          }

          if (method=="BYE" || method=="CANCEL") {
              unforce_rtp_proxy();
          }

          #
       -----------------------------------------------------------------
          # Loose Route Section
          #
       -----------------------------------------------------------------
          if (loose_route()) {

              if ((method=="INVITE" || method=="REFER") &&
       !has_totag()) {
                  sl_send_reply("403", "Forbidden");
                  exit;
              }

              if (method=="INVITE") {

                  if (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
                      proxy_challenge("MY_OPENSIPS_IP","0");
                      exit;
                  } else if (!check_from()) {
                      sl_send_reply("403", "Use From=ID");
                      exit;
                  }
                  consume_credentials();

                  if (nat_uac_test("19")) {
                      setflag(6);
                      force_rport();
                      fix_nated_contact();
                  }
                  force_rtp_proxy("l");
              }
              route(1);
              exit;
          }

          #
       -----------------------------------------------------------------
          # Call Type Processing Section
          #
       -----------------------------------------------------------------
          if (uri!=myself) {
              route(4);
              route(1);
              exit;
          }

          if (method=="ACK") {
              route(1);
              exit;
          } else if (method=="CANCEL") {
              route(1);
              exit;
          } else if (method=="INVITE") {
              route(3);
              exit;
          } else  if (method=="REGISTER") {
              route(2);
              exit;
          }

          lookup("aliases");
          if (uri!=myself) {
              route(4);
              route(1);
              exit;
          }

          if (!lookup("location")) {
              sl_send_reply("404", "User Not Found");
              exit;
          }

          route(1);
       }

       route[1] {

          #
       -----------------------------------------------------------------
          # Default Message Handler
          #
       -----------------------------------------------------------------

          t_on_reply("1");

          if (!t_relay()) {
              if (method=="INVITE" && isflagset(6)) {
                  unforce_rtp_proxy();
              };
              sl_reply_error();
          }
       }

       route[2] {

          #
       -----------------------------------------------------------------
          # REGISTER Message Handler
          #
       ----------------------------------------------------------------

          if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
              setflag(6);
              fix_nated_register();
              force_rport();
          }

          sl_send_reply("100", "Trying");

          if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
              www_challenge("MY_OPENSIPS_IP","0");
              exit;
          }

          #if (!check_to()) {
          #    sl_send_reply("401", "Unauthorized Loi Ngo");
          #    exit;
          #}

          consume_credentials();

          if (!save("location")) {
              sl_reply_error();
          };
       }

       route[3] {

          #
       -----------------------------------------------------------------
          # INVITE Message Handler
          #
       -----------------------------------------------------------------
            #Drop because error Use From=ID when call. Open
          #if (!proxy_authorize("","subscriber")) {
          #    proxy_challenge("","0");
          #    exit;
          #} else if (!check_from()) {
          #    sl_send_reply("403", "Use From=ID");
          #    exit;
          #}

          #consume_credentials();

          if (nat_uac_test("19")) {
              setflag(6);
          }

          lookup("aliases");
          if (uri!=myself) {
              route(4);
              route(1);
              exit;
          }

          if (!lookup("location")) {
              sl_send_reply("404", "User Not Found");
              exit;
          }

          route(4);
          route(1);
       }

       route[4] {

          #
       -----------------------------------------------------------------
          # NAT Traversal Section
          #
       -----------------------------------------------------------------

          if (isflagset(6)) {
              force_rport();
              fix_nated_contact();
              force_rtp_proxy();
          }
       }

       onreply_route[1] {

          if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
              if (!search("^Content-Length:[ ]*0")) {
                  force_rtp_proxy();
              }
          }

          if (nat_uac_test("1")) {
              fix_nated_contact();
          }
       }

       ------------------------------------------------------------------------

       _______________________________________________
       Users mailing list
       [hidden email] <mailto:[hidden email]>




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

Bogdan-Andrei Iancu
Hi,

risntance is just an URI parameter and from server pov it is opaque -
has no meaning. It is exclusively used by phone (X-lite). Tipically such
param is used by phones that register multiple accounts, in order to
make distinction between the accounts (as for all of them , the IP and
port from contact will be the same).

To see why the call is drop, you need to take a sip trace (use ngrep) to
see the signalling on the proxy.

Regards,
Bogdan


oso che bol wrote:

> Dear Bogdan,
>
> Regarding about old question, could you please tell me why:
> - Contact of Mobile: sip:[hidden email]:1120
> - Contact of X-Lite: sip:[hidden email]:14553;rinstance=abb597b601e7398b
>
> What is rinstance and does it impact to the call. I make call from
> Mobile (SJPhone on winCE) to X-Lite and after 32s, it drop call. Both
> UAs behind NAT.
>
> But, x-lite --to/from -- x-lite: call successful, no drop.
>
> Thanks,
> -LN
>
> On Tue, Mar 31, 2009 at 11:09 PM, oso che bol <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Dear Bogdan,
>
>     Thanks very much for your time.
>
>     Regards,
>     -LN
>
>
>     On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu
>     <[hidden email] <mailto:[hidden email]>> wrote:
>
>         Please use fix_nated_register() for REGISTER requests - this
>         will set the appropriate info to be saved in usrloc.
>
>         fix_nated_register() is not changing the contact (so the
>         usrloc will save the real contact), but is just setting some
>         additional info to be saved in usrloc (the received field)
>
>         fix_nated_contact() is actually changing the contact from the
>         request - this is to be used for non-REGISTER requests.
>
>
>         Regards,
>         Bogdan
>
>         oso che bol wrote:
>
>
>             Dear Bogdan
>
>             I change the config of NATed REGISTER request to:
>
>             /    if (nat_uac_test("19")) {
>                    if (is_method("REGISTER") ||
>             !search("^Record-Route")) {
>                        log("LOG: HTK Someone trying to register from
>             private IP, rewriting\n");
>                        fix_nated_contact(); # Rewrite contact with
>             source IP of signalling
>                        force_rport(); # Add rport parameter to topmost Via
>                        setbflag(6);    # Mark as NATed
>                    if (method=="INVITE") {
>                        fix_nated_sdp("1"); # Add direction=active to SDP
>                        force_rport(); # Add rport parameter to topmost Via
>                        setbflag(6); # Mark as NATed
>                     };
>                    };/
>
>             Output of "opensipsctl ul show":
>
>             /[root@LN]# opensipsctl ul show
>             database engine 'MYSQL' loaded
>             Control engine 'FIFO' loaded
>             entering fifo_cmd ul_dump
>             Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of
>             input tree
>             Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done
>             parsing the mi tree
>             Domain:: aliases table=512 records=0 max_slot=0
>             Domain:: location table=512 records=2 max_slot=1
>                AOR:: 5000
>                    Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=
>                        Expires:: 1038
>                        Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
>                        Cseq:: 6049
>                        User-agent:: E66-1 RM-343 102.07.81
>                        State:: CS_SYNC
>                        Flags:: 0
>                        Cflag:: 64
>                        Socket:: udp:174.132.X.Y:5060
>                        Methods:: 4294967295
>                AOR:: 6000
>                    Contact::
>             sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
>                        Expires:: 1060
>                        Callid::
>             MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
>                        Cseq:: 6
>                        User-agent:: X-Lite release 1100l stamp 47546
>                        State:: CS_SYNC
>                        Flags:: 0
>                        Cflag:: 64
>                        Socket:: udp:174.132.X.Y:5060
>                        Methods:: 5951
>             FIFO command was:
>             :ul_dump:opensips_receiver_6568/
>
>             Could you please explain why with mobile user 5000, the
>             contact /sip:5000@77.69.220.94:5060;transport=UDP /and
>             with X-Lite User 6000 the contact is
>             /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/
>
>             How fix_nated_register() differ with fix_nated_register(),
>             do we need to call fix_nated_register() at REGISTER
>             processing?
>
>             Thanks and Regards,
>
>             -LN
>
>             On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu
>             <[hidden email] <mailto:[hidden email]>
>             <mailto:[hidden email]
>             <mailto:[hidden email]>>> wrote:
>
>                Hi,
>
>                if the online-user info is correct, it looks like the
>                fix_nated_register() is not done.
>
>                Please post the output of "opensipsctl ul show", for
>             that specific
>                user.
>
>                Also test by using xlog if the at register time your
>             processing
>                gets inside the "if (!search("^Contact:[ ]*\*") &&
>                nat_uac_test("19")) {".
>
>                Regards,
>                Bogdan
>
>                oso che bol wrote:
>
>                    Dear All,
>
>                    I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.
>
>                    I use X-Lite which is Behind NAT, register to
>             OpenSIPs proxy,
>                    Opensips store right contact address. But, when i
>             use Nokia
>                    E66 to register to Opensips, the contact address is
>             bellow:
>                    Online SIP Users
>                    Username Domain Contact Expires User Agent
>                    5000 *sip:5000@192.168.1.100
>             <mailto:sip%3A5000@192.168.1.100>
>             <mailto:sip%3A5000@192.168.1.100
>             <mailto:sip%253A5000@192.168.1.100>>
>                    <mailto:sip%3A5000@192.168.1.100
>             <mailto:sip%253A5000@192.168.1.100>
>                    <mailto:sip%253A5000@192.168.1.100
>             <mailto:sip%25253A5000@192.168.1.100>>>;transport=UDP*
>             2009-03-30
>
>                    07:20:24.0 E66-1 RM-343 102.07.81
>
>
>                    User 5000 do not store with external IP address of its
>                    (external address not 192.168.1.100). Do you have
>             any ideas
>                    about this?
>
>                    Bellow is my Opensips.conf
>
>                    Thanks and Regards,
>
>                    -LN
>
>                    Opensips.conf
>
>                    ==================
>
>                    ####### Global Parameters #########
>
>                    debug=4
>                    log_stderror=yes
>                    log_facility=LOG_LOCAL0
>
>                    fork=yes
>                    children=4
>
>                    /* uncomment the following lines to enable debugging */
>                    #debug=6
>                    #fork=no
>                    #log_stderror=yes
>
>                    #disable_tcp=yes
>                    #disable_dns_blacklist=no
>                    #dns_try_ipv6=yes
>                    #auto_aliases=no
>
>                    /* uncomment the following lines to enable TLS support
>                     (default off) */
>                    #disable_tls = no
>                    #listen = tls:your_IP:5061
>                    #tls_verify_server = 1
>                    #tls_verify_client = 1
>                    #tls_require_client_certificate = 0
>                    #tls_method = TLSv1
>                    #tls_certificate =
>             "//etc/opensips/tls/user/user-cert.pem"
>                    #tls_private_key =
>             "//etc/opensips/tls/user/user-privkey.pem"
>                    #tls_ca_list =
>             "//etc/opensips/tls/user/user-calist.pem"
>
>
>                    port=5060
>                    listen=udp:MY_OPENSIP_IP:5060
>
>
>                    ####### Modules Section ########
>
>                    #set module path
>                    mpath="//lib/opensips/modules/"
>
>                    /* uncomment next line for MySQL DB support */
>                    loadmodule "db_mysql.so"
>                    loadmodule "sl.so"
>                    loadmodule "tm.so"
>                    loadmodule "rr.so"
>                    loadmodule "maxfwd.so"
>                    loadmodule "usrloc.so"
>                    loadmodule "registrar.so"
>                    loadmodule "textops.so"
>                    loadmodule "mi_fifo.so"
>                    loadmodule "uri_db.so"
>                    loadmodule "uri.so"
>                    loadmodule "xlog.so"
>                    loadmodule "acc.so"
>                    loadmodule "auth.so"
>                    loadmodule "auth_db.so"
>
>                    #loadmodule "presence.so"
>                    #loadmodule "presence_xml.so"
>
>                    loadmodule "nathelper.so"
>                    loadmodule "avpops.so"
>                    ######################
>
>
>                    modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
>                    modparam("rr", "enable_full_lr", 1)
>                    modparam("rr", "append_fromtag", 0)
>                    modparam("registrar", "method_filtering", 1)
>
>                    /* uncomment the next line to disable parallel
>             forking via
>                    location */
>                    # modparam("registrar", "append_branches", 0)
>                    /* uncomment the next line not to allow more than
>             10 contacts
>                    per AOR */
>                    #modparam("registrar", "max_contacts", 10)
>                    modparam("uri_db", "use_uri_table", 1)
>                    modparam("uri_db", "db_url",
>                    "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>                    #them for bug9, like guide in bug9
>                    modparam("uri_db", "db_table", "uri")
>
>
>                    # ----- acc params -----
>                    /* what sepcial events should be accounted ? */
>                    modparam("acc", "early_media", 1)
>                    modparam("acc", "report_ack", 1)
>                    modparam("acc", "report_cancels", 1)
>                    modparam("acc", "detect_direction", 0)
>                    modparam("acc", "failed_transaction_flag", 3)
>                    modparam("acc", "log_flag", 1)
>                    modparam("acc", "log_missed_flag", 2)
>                    modparam("acc", "db_flag", 1)
>                    modparam("acc", "db_missed_flag", 2)
>
>                    modparam("usrloc", "db_mode",   2)
>                    modparam("usrloc", "db_url",
>                      
>             "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>
>                    modparam("auth_db", "calculate_ha1", yes)
>                    modparam("auth_db", "password_column", "password")
>                    modparam("auth_db|permission", "db_url",
>                      
>             "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>
>                    modparam("avpops", "avp_url",
>                    "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
>                    modparam("avpops", "avp_table", "usr_preferences")
>
>                    #try for fix error of Mobile Address
>                    modparam("registrar", "received_avp", "$avp(s:rcv)")
>                    modparam("nathelper", "received_avp", "$avp(s:rcv)")
>
>                    #Theo guide
>                  
>              http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
>                    modparam("usrloc", "nat_bflag", 6)
>                    modparam("nathelper", "ping_nated_only", 1)
>                    modparam("nathelper", "sipping_bflag", 8)
>
>                    #modparam("nathelper", "rtpproxy_sock",
>             "udp:MY_RTPPROXY_IP:7890")
>                    modparam("nathelper", "force_socket",
>             "udp:MY_RTPPROXY_IP:7890")
>                    modparam("nathelper", "natping_interval", 89)
>                    modparam("nathelper", "sipping_from",
>             "sip:1000@MY_OPENSIP_IP")
>
>
>                    # main request routing logic
>
>                    route {
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # Sanity Check Section
>                       #
>                  
>              -----------------------------------------------------------------
>                       if (!mf_process_maxfwd_header("10")) {
>                           sl_send_reply("483", "Too Many Hops");
>                           exit;
>                       }
>
>                       if (msg:len > max_len) {
>                           sl_send_reply("513", "Message Overflow");
>                           exit;
>                       }
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # Record Route Section
>                       #
>                  
>              -----------------------------------------------------------------
>                       if (method!="REGISTER") {
>                           record_route();
>                       }
>
>                       if (method=="BYE" || method=="CANCEL") {
>                           unforce_rtp_proxy();
>                       }
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # Loose Route Section
>                       #
>                  
>              -----------------------------------------------------------------
>                       if (loose_route()) {
>
>                           if ((method=="INVITE" || method=="REFER") &&
>                    !has_totag()) {
>                               sl_send_reply("403", "Forbidden");
>                               exit;
>                           }
>
>                           if (method=="INVITE") {
>
>                               if
>             (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
>                                   proxy_challenge("MY_OPENSIPS_IP","0");
>                                   exit;
>                               } else if (!check_from()) {
>                                   sl_send_reply("403", "Use From=ID");
>                                   exit;
>                               }
>                               consume_credentials();
>
>                               if (nat_uac_test("19")) {
>                                   setflag(6);
>                                   force_rport();
>                                   fix_nated_contact();
>                               }
>                               force_rtp_proxy("l");
>                           }
>                           route(1);
>                           exit;
>                       }
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # Call Type Processing Section
>                       #
>                  
>              -----------------------------------------------------------------
>                       if (uri!=myself) {
>                           route(4);
>                           route(1);
>                           exit;
>                       }
>
>                       if (method=="ACK") {
>                           route(1);
>                           exit;
>                       } else if (method=="CANCEL") {
>                           route(1);
>                           exit;
>                       } else if (method=="INVITE") {
>                           route(3);
>                           exit;
>                       } else  if (method=="REGISTER") {
>                           route(2);
>                           exit;
>                       }
>
>                       lookup("aliases");
>                       if (uri!=myself) {
>                           route(4);
>                           route(1);
>                           exit;
>                       }
>
>                       if (!lookup("location")) {
>                           sl_send_reply("404", "User Not Found");
>                           exit;
>                       }
>
>                       route(1);
>                    }
>
>                    route[1] {
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # Default Message Handler
>                       #
>                  
>              -----------------------------------------------------------------
>
>                       t_on_reply("1");
>
>                       if (!t_relay()) {
>                           if (method=="INVITE" && isflagset(6)) {
>                               unforce_rtp_proxy();
>                           };
>                           sl_reply_error();
>                       }
>                    }
>
>                    route[2] {
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # REGISTER Message Handler
>                       #
>                  
>              ----------------------------------------------------------------
>
>                       if (!search("^Contact:[ ]*\*") &&
>             nat_uac_test("19")) {
>                           setflag(6);
>                           fix_nated_register();
>                           force_rport();
>                       }
>
>                       sl_send_reply("100", "Trying");
>
>                       if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
>                           www_challenge("MY_OPENSIPS_IP","0");
>                           exit;
>                       }
>
>                       #if (!check_to()) {
>                       #    sl_send_reply("401", "Unauthorized Loi Ngo");
>                       #    exit;
>                       #}
>
>                       consume_credentials();
>
>                       if (!save("location")) {
>                           sl_reply_error();
>                       };
>                    }
>
>                    route[3] {
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # INVITE Message Handler
>                       #
>                  
>              -----------------------------------------------------------------
>                         #Drop because error Use From=ID when call. Open
>                       #if (!proxy_authorize("","subscriber")) {
>                       #    proxy_challenge("","0");
>                       #    exit;
>                       #} else if (!check_from()) {
>                       #    sl_send_reply("403", "Use From=ID");
>                       #    exit;
>                       #}
>
>                       #consume_credentials();
>
>                       if (nat_uac_test("19")) {
>                           setflag(6);
>                       }
>
>                       lookup("aliases");
>                       if (uri!=myself) {
>                           route(4);
>                           route(1);
>                           exit;
>                       }
>
>                       if (!lookup("location")) {
>                           sl_send_reply("404", "User Not Found");
>                           exit;
>                       }
>
>                       route(4);
>                       route(1);
>                    }
>
>                    route[4] {
>
>                       #
>                  
>              -----------------------------------------------------------------
>                       # NAT Traversal Section
>                       #
>                  
>              -----------------------------------------------------------------
>
>                       if (isflagset(6)) {
>                           force_rport();
>                           fix_nated_contact();
>                           force_rtp_proxy();
>                       }
>                    }
>
>                    onreply_route[1] {
>
>                       if (isflagset(6) &&
>             status=~"(180)|(183)|2[0-9][0-9]") {
>                           if (!search("^Content-Length:[ ]*0")) {
>                               force_rtp_proxy();
>                           }
>                       }
>
>                       if (nat_uac_test("1")) {
>                           fix_nated_contact();
>                       }
>                    }
>
>                  
>              ------------------------------------------------------------------------
>
>                    _______________________________________________
>                    Users mailing list
>                    [hidden email]
>             <mailto:[hidden email]>
>             <mailto:[hidden email]
>             <mailto:[hidden email]>>
>
>                  
>              http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>                    
>
>
>
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

oso che bol
Dear Bogdan,

I meet the issues of callee reply "400 - bad request"

Attach is my trace from opensips server.

Bellow is my configure of Opensips. Please take a time for my issues:

route {
    log(1, "----------------------------------------------------------------------------------");
    log(1, " ENTER MAIN LOOP\n");
    log(1, "----------------------------------------------------------------------------------");
    #---------
    #Sanity Check
    #-------------
    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483","Too Many Hops");
        exit;
    };
    if ( msg:len >= max_len ) {
        sl_send_reply("513", "Message too big");
        exit;
    }
   
    #--------------------------------------
    #Record-Route all messages
    #-- to make sure subsequent messages will go through our proxy
    #--------------------------------------
    if (method!="REGISTER") {
        record_route();
    }
    #-------------------------------
    # Loose-Route
    #-------------------------------
    if (loose_route()) {
        append_hf("P-hint: rr-enforced\r\n");
        route(1);
        exit;
    }
    #--------------------------------
    # uri != myself
    #--------------------------------------
    if (uri!=myself) {
        append_hf("P-hint: Outbound\r\n");
        route(1);
        exit;
    }
    #----------------------------------
    # uri==myself
    #--------------------------------
    if (uri==myself) {
        if (method=="REGISTER") {
            if (nat_uac_test("19")) {
                setbflag(6);
                force_rport();
                fix_nated_register();
           
            }
            sl_send_reply("100", " Trying\r\n");
            #AUTHENTICATE
            if(!www_authorize("174.132.X.Y", "subscriber")) {
                www_challenge("174.132.X.Y", "0");
                exit;
            }
            consume_credentials();
           
            save("location");
            exit;
       
        }
        lookup("aliases");
        if (uri!=myself) {
            append_hf("P-hint:  outbound alias\r\n");
            route(1);
            exit;
        }
        if (!lookup("location")) {
            sl_send_reply("404", " Not Found");
            exit;
        }
       
    } #End uri==myself
   
    #
    #
    #
    if (method=="INVITE") {
        t_on_failure("1");
    } else if (method=="BYE" || method=="CANCEL") {
        unforce_rtp_proxy();
    }
   
    #---------------------------------------------------------------------
    # LOOSE_ROUTE - INVITE - FORCE_RTP_PROXY
    #-----------------------------------------------------------------------
    if (loose_route()) {
        if (method=="INVITE" || method=="ACK") {
            append_hf("P-hint:- LOOSE ROUTE - Relay re-INVITE + FORCE_RTP_PROXY\r\n");
            force_rtp_proxy();
        }
        # t-relay()
        t_relay();
        exit;
    }
   
    #-----------------------------------------------------------------------
    #NAT - fix_nated_contact()
    #------------------------------------------------------------------------
    if (nat_uac_test("19") && !search("^Record-Route:")) {
        append_hf("P-hint: Fix nated contact\r\n");
        force_rport();
        fix_nated_contact();
    }
   
    if (method=="INVITE") {
        append_hf("P-hint:  INVITE go to on_reply_route[1]\r\n");
        t_on_reply("1");
    }
   
    if (method=="INVITE" || method=="ACK") {
        append_hf("P-hint: INVITE||ACK + FORCE_RTP_PROXY\r\n");
        force_rtp_proxy();
    }
   
    if (!t_relay()) {
        append_hf("P-hint: INVITE||ACK - UNFORCE_RTP_PROXY\r\n");
        if (method=="INVITE" || method=="ACK") {
            unforce_rtp_proxy();
        }
        sl_reply_error();
    }
   
    append_hf("P-hint: usrloc applied\r\n");
   

}

route[1] {
    append_hf("P-hint:Route[1] Processing\r\n");
    if (!t_relay()) {
        sl_reply_error();
    }
}

failure_route[1] {
    unforce_rtp_proxy();
}

onreply_route[1] {
    append_hf("P-hint: On_reply_route[1] processing\r\n");
    if (status=~"(180)|(183)|2[0-9][0-9]") {
        if (nat_uac_test("1")) {
            fix_nated_contact();
        }
        force_rtp_proxy();
    }
}

Thanks and Regards,
-LN
On Wed, Apr 1, 2009 at 5:46 PM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Hi,

risntance is just an URI parameter and from server pov it is opaque - has no meaning. It is exclusively used by phone (X-lite). Tipically such param is used by phones that register multiple accounts, in order to make distinction between the accounts (as for all of them , the IP and port from contact will be the same).

To see why the call is drop, you need to take a sip trace (use ngrep) to see the signalling on the proxy.


Regards,
Bogdan


oso che bol wrote:
Dear Bogdan,

Regarding about old question, could you please tell me why:
- Contact of Mobile: sip:[hidden email]:1120
- Contact of X-Lite: sip:[hidden email]:14553;rinstance=abb597b601e7398b

What is rinstance and does it impact to the call. I make call from Mobile (SJPhone on winCE) to X-Lite and after 32s, it drop call. Both UAs behind NAT.

But, x-lite --to/from -- x-lite: call successful, no drop.

Thanks,
-LN

On Tue, Mar 31, 2009 at 11:09 PM, oso che bol <[hidden email] <mailto:[hidden email]>> wrote:

   Dear Bogdan,

   Thanks very much for your time.

   Regards,
   -LN


   On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu
   <[hidden email] <mailto:[hidden email]>> wrote:

       Please use fix_nated_register() for REGISTER requests - this
       will set the appropriate info to be saved in usrloc.

       fix_nated_register() is not changing the contact (so the
       usrloc will save the real contact), but is just setting some
       additional info to be saved in usrloc (the received field)

       fix_nated_contact() is actually changing the contact from the
       request - this is to be used for non-REGISTER requests.


       Regards,
       Bogdan

       oso che bol wrote:


           Dear Bogdan

           I change the config of NATed REGISTER request to:

           /    if (nat_uac_test("19")) {
                  if (is_method("REGISTER") ||
           !search("^Record-Route")) {
                      log("LOG:  Someone trying to register from
           private IP, rewriting\n");
                      fix_nated_contact(); # Rewrite contact with
           source IP of signalling
                      force_rport(); # Add rport parameter to topmost Via
                      setbflag(6);    # Mark as NATed
                  if (method=="INVITE") {
                      fix_nated_sdp("1"); # Add direction=active to SDP
                      force_rport(); # Add rport parameter to topmost Via
                      setbflag(6); # Mark as NATed
                   };
                  };/

           Output of "opensipsctl ul show":

           /[root@LN]# opensipsctl ul show
           database engine 'MYSQL' loaded
           Control engine 'FIFO' loaded
           entering fifo_cmd ul_dump
           Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of
           input tree
           Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done
           parsing the mi tree
           Domain:: aliases table=512 records=0 max_slot=0
           Domain:: location table=512 records=2 max_slot=1
              AOR:: 5000
                  Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=
                      Expires:: 1038
                      Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
                      Cseq:: 6049
                      User-agent:: E66-1 RM-343 102.07.81
                      State:: CS_SYNC
                      Flags:: 0
                      Cflag:: 64
                      Socket:: udp:174.132.X.Y:5060
                      Methods:: 4294967295
              AOR:: 6000
                  Contact::
           sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
                      Expires:: 1060
                      Callid::
           MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
                      Cseq:: 6
                      User-agent:: X-Lite release 1100l stamp 47546
                      State:: CS_SYNC
                      Flags:: 0
                      Cflag:: 64
                      Socket:: udp:174.132.X.Y:5060
                      Methods:: 5951
           FIFO command was:
           :ul_dump:opensips_receiver_6568/

           Could you please explain why with mobile user 5000, the
           contact /sip:5000@77.69.220.94:5060;transport=UDP /and
           with X-Lite User 6000 the contact is
           /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/

           How fix_nated_register() differ with fix_nated_register(),
           do we need to call fix_nated_register() at REGISTER
           processing?

           Thanks and Regards,

           -LN

           On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu
           <[hidden email] <mailto:[hidden email]>
           <mailto:[hidden email]
           <mailto:[hidden email]>>> wrote:

              Hi,

              if the online-user info is correct, it looks like the
              fix_nated_register() is not done.

              Please post the output of "opensipsctl ul show", for
           that specific
              user.

              Also test by using xlog if the at register time your
           processing
              gets inside the "if (!search("^Contact:[ ]*\*") &&
              nat_uac_test("19")) {".

              Regards,
              Bogdan

              oso che bol wrote:

                  Dear All,

                  I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.

                  I use X-Lite which is Behind NAT, register to
           OpenSIPs proxy,
                  Opensips store right contact address. But, when i
           use Nokia
                  E66 to register to Opensips, the contact address is
           bellow:
                  Online SIP Users
                  Username Domain Contact Expires User Agent
                  5000 *[hidden email]
           <mailto:[hidden email]>
           <mailto:[hidden email]
           <mailto:[hidden email]>>
                  <mailto:[hidden email]
           <mailto:[hidden email]>
                  <mailto:[hidden email]
           <mailto:[hidden email]>>>;transport=UDP*

           2009-03-30

                  07:20:24.0 E66-1 RM-343 102.07.81


                  User 5000 do not store with external IP address of its
                  (external address not 192.168.1.100). Do you have
           any ideas
                  about this?

                  Bellow is my Opensips.conf

                  Thanks and Regards,

                  -LN

                  Opensips.conf

                  ==================

                  ####### Global Parameters #########

                  debug=4
                  log_stderror=yes
                  log_facility=LOG_LOCAL0

                  fork=yes
                  children=4

                  /* uncomment the following lines to enable debugging */
                  #debug=6
                  #fork=no
                  #log_stderror=yes

                  #disable_tcp=yes
                  #disable_dns_blacklist=no
                  #dns_try_ipv6=yes
                  #auto_aliases=no

                  /* uncomment the following lines to enable TLS support
                   (default off) */
                  #disable_tls = no
                  #listen = tls:your_IP:5061
                  #tls_verify_server = 1
                  #tls_verify_client = 1
                  #tls_require_client_certificate = 0
                  #tls_method = TLSv1
                  #tls_certificate =
           "//etc/opensips/tls/user/user-cert.pem"
                  #tls_private_key =
           "//etc/opensips/tls/user/user-privkey.pem"
                  #tls_ca_list =
           "//etc/opensips/tls/user/user-calist.pem"


                  port=5060
                  listen=udp:MY_OPENSIP_IP:5060


                  ####### Modules Section ########

                  #set module path
                  mpath="//lib/opensips/modules/"

                  /* uncomment next line for MySQL DB support */
                  loadmodule "db_mysql.so"
                  loadmodule "sl.so"
                  loadmodule "tm.so"
                  loadmodule "rr.so"
                  loadmodule "maxfwd.so"
                  loadmodule "usrloc.so"
                  loadmodule "registrar.so"
                  loadmodule "textops.so"
                  loadmodule "mi_fifo.so"
                  loadmodule "uri_db.so"
                  loadmodule "uri.so"
                  loadmodule "xlog.so"
                  loadmodule "acc.so"
                  loadmodule "auth.so"
                  loadmodule "auth_db.so"

                  #loadmodule "presence.so"
                  #loadmodule "presence_xml.so"

                  loadmodule "nathelper.so"
                  loadmodule "avpops.so"
                  ######################


                  modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
                  modparam("rr", "enable_full_lr", 1)
                  modparam("rr", "append_fromtag", 0)
                  modparam("registrar", "method_filtering", 1)

                  /* uncomment the next line to disable parallel
           forking via
                  location */
                  # modparam("registrar", "append_branches", 0)
                  /* uncomment the next line not to allow more than
           10 contacts
                  per AOR */
                  #modparam("registrar", "max_contacts", 10)
                  modparam("uri_db", "use_uri_table", 1)
                  modparam("uri_db", "db_url",
                  "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
                  #them for bug9, like guide in bug9
                  modparam("uri_db", "db_table", "uri")


                  # ----- acc params -----
                  /* what sepcial events should be accounted ? */
                  modparam("acc", "early_media", 1)
                  modparam("acc", "report_ack", 1)
                  modparam("acc", "report_cancels", 1)
                  modparam("acc", "detect_direction", 0)
                  modparam("acc", "failed_transaction_flag", 3)
                  modparam("acc", "log_flag", 1)
                  modparam("acc", "log_missed_flag", 2)
                  modparam("acc", "db_flag", 1)
                  modparam("acc", "db_missed_flag", 2)

                  modparam("usrloc", "db_mode",   2)
                  modparam("usrloc", "db_url",
                               "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

                  modparam("auth_db", "calculate_ha1", yes)
                  modparam("auth_db", "password_column", "password")
                  modparam("auth_db|permission", "db_url",
                               "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")

                  modparam("avpops", "avp_url",
                  "mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")
                  modparam("avpops", "avp_table", "usr_preferences")

                  #try for fix error of Mobile Address
                  modparam("registrar", "received_avp", "$avp(s:rcv)")
                  modparam("nathelper", "received_avp", "$avp(s:rcv)")

                  #Theo guide
                            http://www.opensips.org/html/docs/modules/1.4.x/registrar.html
                  modparam("usrloc", "nat_bflag", 6)
                  modparam("nathelper", "ping_nated_only", 1)
                  modparam("nathelper", "sipping_bflag", 8)

                  #modparam("nathelper", "rtpproxy_sock",
           "udp:MY_RTPPROXY_IP:7890")
                  modparam("nathelper", "force_socket",
           "udp:MY_RTPPROXY_IP:7890")
                  modparam("nathelper", "natping_interval", 89)
                  modparam("nathelper", "sipping_from",
           "sip:1000@MY_OPENSIP_IP")


                  # main request routing logic

                  route {

                     #
                            -----------------------------------------------------------------
                     # Sanity Check Section
                     #
                            -----------------------------------------------------------------
                     if (!mf_process_maxfwd_header("10")) {
                         sl_send_reply("483", "Too Many Hops");
                         exit;
                     }

                     if (msg:len > max_len) {
                         sl_send_reply("513", "Message Overflow");
                         exit;
                     }

                     #
                            -----------------------------------------------------------------
                     # Record Route Section
                     #
                            -----------------------------------------------------------------
                     if (method!="REGISTER") {
                         record_route();
                     }

                     if (method=="BYE" || method=="CANCEL") {
                         unforce_rtp_proxy();
                     }

                     #
                            -----------------------------------------------------------------
                     # Loose Route Section
                     #
                            -----------------------------------------------------------------
                     if (loose_route()) {

                         if ((method=="INVITE" || method=="REFER") &&
                  !has_totag()) {
                             sl_send_reply("403", "Forbidden");
                             exit;
                         }

                         if (method=="INVITE") {

                             if
           (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {
                                 proxy_challenge("MY_OPENSIPS_IP","0");
                                 exit;
                             } else if (!check_from()) {
                                 sl_send_reply("403", "Use From=ID");
                                 exit;
                             }
                             consume_credentials();

                             if (nat_uac_test("19")) {
                                 setflag(6);
                                 force_rport();
                                 fix_nated_contact();
                             }
                             force_rtp_proxy("l");
                         }
                         route(1);
                         exit;
                     }

                     #
                            -----------------------------------------------------------------
                     # Call Type Processing Section
                     #
                            -----------------------------------------------------------------
                     if (uri!=myself) {
                         route(4);
                         route(1);
                         exit;
                     }

                     if (method=="ACK") {
                         route(1);
                         exit;
                     } else if (method=="CANCEL") {
                         route(1);
                         exit;
                     } else if (method=="INVITE") {
                         route(3);
                         exit;
                     } else  if (method=="REGISTER") {
                         route(2);
                         exit;
                     }

                     lookup("aliases");
                     if (uri!=myself) {
                         route(4);
                         route(1);
                         exit;
                     }

                     if (!lookup("location")) {
                         sl_send_reply("404", "User Not Found");
                         exit;
                     }

                     route(1);
                  }

                  route[1] {

                     #
                            -----------------------------------------------------------------
                     # Default Message Handler
                     #
                            -----------------------------------------------------------------

                     t_on_reply("1");

                     if (!t_relay()) {
                         if (method=="INVITE" && isflagset(6)) {
                             unforce_rtp_proxy();
                         };
                         sl_reply_error();
                     }
                  }

                  route[2] {

                     #
                            -----------------------------------------------------------------
                     # REGISTER Message Handler
                     #
                            ----------------------------------------------------------------

                     if (!search("^Contact:[ ]*\*") &&
           nat_uac_test("19")) {
                         setflag(6);
                         fix_nated_register();
                         force_rport();
                     }

                     sl_send_reply("100", "Trying");

                     if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {
                         www_challenge("MY_OPENSIPS_IP","0");
                         exit;
                     }

                     #if (!check_to()) {
                     #    sl_send_reply("401", "Unauthorized Loi Ngo");
                     #    exit;
                     #}

                     consume_credentials();

                     if (!save("location")) {
                         sl_reply_error();
                     };
                  }

                  route[3] {

                     #
                            -----------------------------------------------------------------
                     # INVITE Message Handler
                     #
                            -----------------------------------------------------------------
                       #Drop because error Use From=ID when call. Open
                     #if (!proxy_authorize("","subscriber")) {
                     #    proxy_challenge("","0");
                     #    exit;
                     #} else if (!check_from()) {
                     #    sl_send_reply("403", "Use From=ID");
                     #    exit;
                     #}

                     #consume_credentials();

                     if (nat_uac_test("19")) {
                         setflag(6);
                     }

                     lookup("aliases");
                     if (uri!=myself) {
                         route(4);
                         route(1);
                         exit;
                     }

                     if (!lookup("location")) {
                         sl_send_reply("404", "User Not Found");
                         exit;
                     }

                     route(4);
                     route(1);
                  }

                  route[4] {

                     #
                            -----------------------------------------------------------------
                     # NAT Traversal Section
                     #
                            -----------------------------------------------------------------

                     if (isflagset(6)) {
                         force_rport();
                         fix_nated_contact();
                         force_rtp_proxy();
                     }
                  }

                  onreply_route[1] {

                     if (isflagset(6) &&
           status=~"(180)|(183)|2[0-9][0-9]") {
                         if (!search("^Content-Length:[ ]*0")) {
                             force_rtp_proxy();
                         }
                     }

                     if (nat_uac_test("1")) {
                         fix_nated_contact();
                     }
                  }

                            ------------------------------------------------------------------------

                  _______________________________________________
                  Users mailing list
                  [hidden email]
           <mailto:[hidden email]>
           <mailto:[hidden email]
           <mailto:[hidden email]>>

                            http://lists.opensips.org/cgi-bin/mailman/listinfo/users
                 







_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

04022009_badrequest_postopensipslist.txt (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

Bogdan-Andrei Iancu
Hi,

even if this was already discussed on the #opensips IRC channel, for the
sake of completion:

The 400 Bad request was because of the malformed SDP - some bogus space
were inserted while nathelper did some changes. This is an old bug and
it was fixed starting wit 1.4.2.

In this report 1.4.1 was used, so upgrading to 1.4.5 should solve the
problem.

Regards,
Bogdan

oso che bol wrote:

> Dear Bogdan,
>
> I meet the issues of callee reply "400 - bad request"
>
> Attach is my trace from opensips server.
>
> Bellow is my configure of Opensips. Please take a time for my issues:
>
> route {
>     log(1,
> "----------------------------------------------------------------------------------");
>     log(1, " ENTER MAIN LOOP\n");
>     log(1,
> "----------------------------------------------------------------------------------");
>     #---------
>     #Sanity Check
>     #-------------
>     if (!mf_process_maxfwd_header("10")) {
>         sl_send_reply("483","Too Many Hops");
>         exit;
>     };
>     if ( msg:len >= max_len ) {
>         sl_send_reply("513", "Message too big");
>         exit;
>     }
>    
>     #--------------------------------------
>     #Record-Route all messages
>     #-- to make sure subsequent messages will go through our proxy
>     #--------------------------------------
>     if (method!="REGISTER") {
>         record_route();
>     }
>     #-------------------------------
>     # Loose-Route
>     #-------------------------------
>     if (loose_route()) {
>         append_hf("P-hint: rr-enforced\r\n");
>         route(1);
>         exit;
>     }
>     #--------------------------------
>     # uri != myself
>     #--------------------------------------
>     if (uri!=myself) {
>         append_hf("P-hint: Outbound\r\n");
>         route(1);
>         exit;
>     }
>     #----------------------------------
>     # uri==myself
>     #--------------------------------
>     if (uri==myself) {
>         if (method=="REGISTER") {
>             if (nat_uac_test("19")) {
>                 setbflag(6);
>                 force_rport();
>                 fix_nated_register();
>            
>             }
>             sl_send_reply("100", " Trying\r\n");
>             #AUTHENTICATE
>             if(!www_authorize("174.132.X.Y", "subscriber")) {
>                 www_challenge("174.132.X.Y", "0");
>                 exit;
>             }
>             consume_credentials();
>            
>             save("location");
>             exit;
>        
>         }
>         lookup("aliases");
>         if (uri!=myself) {
>             append_hf("P-hint:  outbound alias\r\n");
>             route(1);
>             exit;
>         }
>         if (!lookup("location")) {
>             sl_send_reply("404", " Not Found");
>             exit;
>         }
>        
>     } #End uri==myself
>    
>     #
>     #
>     #
>     if (method=="INVITE") {
>         t_on_failure("1");
>     } else if (method=="BYE" || method=="CANCEL") {
>         unforce_rtp_proxy();
>     }
>    
>     #---------------------------------------------------------------------
>     # LOOSE_ROUTE - INVITE - FORCE_RTP_PROXY
>    
> #-----------------------------------------------------------------------
>     if (loose_route()) {
>         if (method=="INVITE" || method=="ACK") {
>             append_hf("P-hint:- LOOSE ROUTE - Relay re-INVITE +
> FORCE_RTP_PROXY\r\n");
>             force_rtp_proxy();
>         }
>         # t-relay()
>         t_relay();
>         exit;
>     }
>    
>    
> #-----------------------------------------------------------------------
>     #NAT - fix_nated_contact()
>    
> #------------------------------------------------------------------------
>     if (nat_uac_test("19") && !search("^Record-Route:")) {
>         append_hf("P-hint: Fix nated contact\r\n");
>         force_rport();
>         fix_nated_contact();
>     }
>    
>     if (method=="INVITE") {
>         append_hf("P-hint:  INVITE go to on_reply_route[1]\r\n");
>         t_on_reply("1");
>     }
>    
>     if (method=="INVITE" || method=="ACK") {
>         append_hf("P-hint: INVITE||ACK + FORCE_RTP_PROXY\r\n");
>         force_rtp_proxy();
>     }
>    
>     if (!t_relay()) {
>         append_hf("P-hint: INVITE||ACK - UNFORCE_RTP_PROXY\r\n");
>         if (method=="INVITE" || method=="ACK") {
>             unforce_rtp_proxy();
>         }
>         sl_reply_error();
>     }
>    
>     append_hf("P-hint: usrloc applied\r\n");
>    
>
> }
>
> route[1] {
>     append_hf("P-hint:Route[1] Processing\r\n");
>     if (!t_relay()) {
>         sl_reply_error();
>     }
> }
>
> failure_route[1] {
>     unforce_rtp_proxy();
> }
>
> onreply_route[1] {
>     append_hf("P-hint: On_reply_route[1] processing\r\n");
>     if (status=~"(180)|(183)|2[0-9][0-9]") {
>         if (nat_uac_test("1")) {
>             fix_nated_contact();
>         }
>         force_rtp_proxy();
>     }
> }
>
> Thanks and Regards,
> -LN
> On Wed, Apr 1, 2009 at 5:46 PM, Bogdan-Andrei Iancu
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     risntance is just an URI parameter and from server pov it is
>     opaque - has no meaning. It is exclusively used by phone (X-lite).
>     Tipically such param is used by phones that register multiple
>     accounts, in order to make distinction between the accounts (as
>     for all of them , the IP and port from contact will be the same).
>
>     To see why the call is drop, you need to take a sip trace (use
>     ngrep) to see the signalling on the proxy.
>
>
>     Regards,
>     Bogdan
>
>
>     oso che bol wrote:
>
>         Dear Bogdan,
>
>         Regarding about old question, could you please tell me why:
>         - Contact of Mobile: sip:[hidden email]:1120
>         - Contact of X-Lite:
>         sip:[hidden email]:14553;rinstance=abb597b601e7398b
>
>         What is rinstance and does it impact to the call. I make call
>         from Mobile (SJPhone on winCE) to X-Lite and after 32s, it
>         drop call. Both UAs behind NAT.
>
>         But, x-lite --to/from -- x-lite: call successful, no drop.
>
>         Thanks,
>         -LN
>
>         On Tue, Mar 31, 2009 at 11:09 PM, oso che bol
>         <[hidden email] <mailto:[hidden email]>
>         <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>
>            Dear Bogdan,
>
>            Thanks very much for your time.
>
>            Regards,
>            -LN
>
>
>            On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu
>            <[hidden email] <mailto:[hidden email]>
>         <mailto:[hidden email]
>         <mailto:[hidden email]>>> wrote:
>
>                Please use fix_nated_register() for REGISTER requests -
>         this
>                will set the appropriate info to be saved in usrloc.
>
>                fix_nated_register() is not changing the contact (so the
>                usrloc will save the real contact), but is just setting
>         some
>                additional info to be saved in usrloc (the received field)
>
>                fix_nated_contact() is actually changing the contact
>         from the
>                request - this is to be used for non-REGISTER requests.
>
>
>                Regards,
>                Bogdan
>
>                oso che bol wrote:
>
>
>                    Dear Bogdan
>
>                    I change the config of NATed REGISTER request to:
>
>                    /    if (nat_uac_test("19")) {
>                           if (is_method("REGISTER") ||
>                    !search("^Record-Route")) {
>                               log("LOG:  Someone trying to register from
>                    private IP, rewriting\n");
>                               fix_nated_contact(); # Rewrite contact with
>                    source IP of signalling
>                               force_rport(); # Add rport parameter to
>         topmost Via
>                               setbflag(6);    # Mark as NATed
>                           if (method=="INVITE") {
>                               fix_nated_sdp("1"); # Add
>         direction=active to SDP
>                               force_rport(); # Add rport parameter to
>         topmost Via
>                               setbflag(6); # Mark as NATed
>                            };
>                           };/
>
>                    Output of "opensipsctl ul show":
>
>                    /[root@LN]# opensipsctl ul show
>                    database engine 'MYSQL' loaded
>                    Control engine 'FIFO' loaded
>                    entering fifo_cmd ul_dump
>                    Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node:
>         end of
>                    input tree
>                    Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done
>                    parsing the mi tree
>                    Domain:: aliases table=512 records=0 max_slot=0
>                    Domain:: location table=512 records=2 max_slot=1
>                       AOR:: 5000
>                           Contact::
>         sip:5000@77.69.220.94:5060;transport=UDP Q=
>                               Expires:: 1038
>                               Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
>                               Cseq:: 6049
>                               User-agent:: E66-1 RM-343 102.07.81
>                               State:: CS_SYNC
>                               Flags:: 0
>                               Cflag:: 64
>                               Socket:: udp:174.132.X.Y:5060
>                               Methods:: 4294967295
>                       AOR:: 6000
>                           Contact::
>                  
>          sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
>                               Expires:: 1060
>                               Callid::
>                    MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
>                               Cseq:: 6
>                               User-agent:: X-Lite release 1100l stamp
>         47546
>                               State:: CS_SYNC
>                               Flags:: 0
>                               Cflag:: 64
>                               Socket:: udp:174.132.X.Y:5060
>                               Methods:: 5951
>                    FIFO command was:
>                    :ul_dump:opensips_receiver_6568/
>
>                    Could you please explain why with mobile user 5000, the
>                    contact /sip:5000@77.69.220.94:5060;transport=UDP /and
>                    with X-Lite User 6000 the contact is
>                    /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/
>
>                    How fix_nated_register() differ with
>         fix_nated_register(),
>                    do we need to call fix_nated_register() at REGISTER
>                    processing?
>
>                    Thanks and Regards,
>
>                    -LN
>
>                    On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu
>                    <[hidden email]
>         <mailto:[hidden email]> <mailto:[hidden email]
>         <mailto:[hidden email]>>
>                    <mailto:[hidden email]
>         <mailto:[hidden email]>
>                    <mailto:[hidden email]
>         <mailto:[hidden email]>>>> wrote:
>
>                       Hi,
>
>                       if the online-user info is correct, it looks
>         like the
>                       fix_nated_register() is not done.
>
>                       Please post the output of "opensipsctl ul show", for
>                    that specific
>                       user.
>
>                       Also test by using xlog if the at register time your
>                    processing
>                       gets inside the "if (!search("^Contact:[ ]*\*") &&
>                       nat_uac_test("19")) {".
>
>                       Regards,
>                       Bogdan
>
>                       oso che bol wrote:
>
>                           Dear All,
>
>                           I use Opensips 1.4.1 with rtpproxy 1.2 for
>         NAT support.
>
>                           I use X-Lite which is Behind NAT, register to
>                    OpenSIPs proxy,
>                           Opensips store right contact address. But,
>         when i
>                    use Nokia
>                           E66 to register to Opensips, the contact
>         address is
>                    bellow:
>                           Online SIP Users
>                           Username Domain Contact Expires User Agent
>                           5000 *sip:5000@192.168.1.100
>         <mailto:sip%3A5000@192.168.1.100>
>                    <mailto:sip%3A5000@192.168.1.100
>         <mailto:sip%253A5000@192.168.1.100>>
>                    <mailto:sip%3A5000@192.168.1.100
>         <mailto:sip%253A5000@192.168.1.100>
>                    <mailto:sip%253A5000@192.168.1.100
>         <mailto:sip%25253A5000@192.168.1.100>>>
>                           <mailto:sip%3A5000@192.168.1.100
>         <mailto:sip%253A5000@192.168.1.100>
>                    <mailto:sip%253A5000@192.168.1.100
>         <mailto:sip%25253A5000@192.168.1.100>>
>                           <mailto:sip%253A5000@192.168.1.100
>         <mailto:sip%25253A5000@192.168.1.100>
>                    <mailto:sip%25253A5000@192.168.1.100
>         <mailto:sip%2525253A5000@192.168.1.100>>>>;transport=UDP*
>
>                    2009-03-30
>
>                           07:20:24.0 E66-1 RM-343 102.07.81
>
>
>                           User 5000 do not store with external IP
>         address of its
>                           (external address not 192.168.1.100). Do you
>         have
>                    any ideas
>                           about this?
>
>                           Bellow is my Opensips.conf
>
>                           Thanks and Regards,
>
>                           -LN
>
>                           Opensips.conf
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: NAT Contact address issues with Nokia Mobile

oso che bol
Dear Bogdan,

Thanks you for your spending time on this.

It works like a charm :)

Thanks and Regards,
-LN

On Thu, Apr 2, 2009 at 5:42 PM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Hi,

even if this was already discussed on the #opensips IRC channel, for the sake of completion:

The 400 Bad request was because of the malformed SDP - some bogus space were inserted while nathelper did some changes. This is an old bug and it was fixed starting wit 1.4.2.

In this report 1.4.1 was used, so upgrading to 1.4.5 should solve the problem.


Regards,
Bogdan

oso che bol wrote:
Dear Bogdan,

I meet the issues of callee reply "400 - bad request"

Attach is my trace from opensips server.

Bellow is my configure of Opensips. Please take a time for my issues:

route {
   log(1, "----------------------------------------------------------------------------------");
   log(1, " ENTER MAIN LOOP\n");
   log(1, "----------------------------------------------------------------------------------");
   #---------
   #Sanity Check
   #-------------
   if (!mf_process_maxfwd_header("10")) {
       sl_send_reply("483","Too Many Hops");
       exit;
   };
   if ( msg:len >= max_len ) {
       sl_send_reply("513", "Message too big");
       exit;
   }
     #--------------------------------------
   #Record-Route all messages
   #-- to make sure subsequent messages will go through our proxy
   #--------------------------------------
   if (method!="REGISTER") {
       record_route();
   }
   #-------------------------------
   # Loose-Route
   #-------------------------------
   if (loose_route()) {
       append_hf("P-hint: rr-enforced\r\n");
       route(1);
       exit;
   }
   #--------------------------------
   # uri != myself
   #--------------------------------------
   if (uri!=myself) {
       append_hf("P-hint: Outbound\r\n");
       route(1);
       exit;
   }
   #----------------------------------
   # uri==myself
   #--------------------------------
   if (uri==myself) {
       if (method=="REGISTER") {
           if (nat_uac_test("19")) {
               setbflag(6);
               force_rport();
               fix_nated_register();
                     }
           sl_send_reply("100", " Trying\r\n");
           #AUTHENTICATE
           if(!www_authorize("174.132.X.Y", "subscriber")) {
               www_challenge("174.132.X.Y", "0");
               exit;
           }
           consume_credentials();
                     save("location");
           exit;
             }
       lookup("aliases");
       if (uri!=myself) {
           append_hf("P-hint:  outbound alias\r\n");
           route(1);
           exit;
       }
       if (!lookup("location")) {
           sl_send_reply("404", " Not Found");
           exit;
       }
         } #End uri==myself
     #
   #
   #
   if (method=="INVITE") {
       t_on_failure("1");
   } else if (method=="BYE" || method=="CANCEL") {
       unforce_rtp_proxy();
   }
     #---------------------------------------------------------------------
   # LOOSE_ROUTE - INVITE - FORCE_RTP_PROXY
   #-----------------------------------------------------------------------
   if (loose_route()) {
       if (method=="INVITE" || method=="ACK") {
           append_hf("P-hint:- LOOSE ROUTE - Relay re-INVITE + FORCE_RTP_PROXY\r\n");
           force_rtp_proxy();
       }
       # t-relay()
       t_relay();
       exit;
   }
     #-----------------------------------------------------------------------
   #NAT - fix_nated_contact()
   #------------------------------------------------------------------------
   if (nat_uac_test("19") && !search("^Record-Route:")) {
       append_hf("P-hint: Fix nated contact\r\n");
       force_rport();
       fix_nated_contact();
   }
     if (method=="INVITE") {
       append_hf("P-hint:  INVITE go to on_reply_route[1]\r\n");
       t_on_reply("1");
   }
     if (method=="INVITE" || method=="ACK") {
       append_hf("P-hint: INVITE||ACK + FORCE_RTP_PROXY\r\n");
       force_rtp_proxy();
   }
     if (!t_relay()) {
       append_hf("P-hint: INVITE||ACK - UNFORCE_RTP_PROXY\r\n");
       if (method=="INVITE" || method=="ACK") {
           unforce_rtp_proxy();
       }
       sl_reply_error();
   }
     append_hf("P-hint: usrloc applied\r\n");
 
}

route[1] {
   append_hf("P-hint:Route[1] Processing\r\n");
   if (!t_relay()) {
       sl_reply_error();
   }
}

failure_route[1] {
   unforce_rtp_proxy();
}

onreply_route[1] {
   append_hf("P-hint: On_reply_route[1] processing\r\n");
   if (status=~"(180)|(183)|2[0-9][0-9]") {
       if (nat_uac_test("1")) {
           fix_nated_contact();
       }
       force_rtp_proxy();
   }
}

Thanks and Regards,
-LN
On Wed, Apr 1, 2009 at 5:46 PM, Bogdan-Andrei Iancu <[hidden email] <mailto:[hidden email]>> wrote:

   Hi,

   risntance is just an URI parameter and from server pov it is
   opaque - has no meaning. It is exclusively used by phone (X-lite).
   Tipically such param is used by phones that register multiple
   accounts, in order to make distinction between the accounts (as
   for all of them , the IP and port from contact will be the same).

   To see why the call is drop, you need to take a sip trace (use
   ngrep) to see the signalling on the proxy.


   Regards,
   Bogdan


   oso che bol wrote:

       Dear Bogdan,

       Regarding about old question, could you please tell me why:
       - Contact of Mobile: sip:[hidden email]:1120
       - Contact of X-Lite:
       sip:[hidden email]:14553;rinstance=abb597b601e7398b

       What is rinstance and does it impact to the call. I make call
       from Mobile (SJPhone on winCE) to X-Lite and after 32s, it
       drop call. Both UAs behind NAT.

       But, x-lite --to/from -- x-lite: call successful, no drop.

       Thanks,
       -LN

       On Tue, Mar 31, 2009 at 11:09 PM, oso che bol
       <[hidden email] <mailto:[hidden email]>
       <mailto:[hidden email] <mailto:[hidden email]>>> wrote:

          Dear Bogdan,

          Thanks very much for your time.

          Regards,
          -LN


          On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu
          <[hidden email] <mailto:[hidden email]>
       <mailto:[hidden email]
       <mailto:[hidden email]>>> wrote:

              Please use fix_nated_register() for REGISTER requests -
       this
              will set the appropriate info to be saved in usrloc.

              fix_nated_register() is not changing the contact (so the
              usrloc will save the real contact), but is just setting
       some
              additional info to be saved in usrloc (the received field)

              fix_nated_contact() is actually changing the contact
       from the
              request - this is to be used for non-REGISTER requests.


              Regards,
              Bogdan

              oso che bol wrote:


                  Dear Bogdan

                  I change the config of NATed REGISTER request to:

                  /    if (nat_uac_test("19")) {
                         if (is_method("REGISTER") ||
                  !search("^Record-Route")) {
                             log("LOG:  Someone trying to register from
                  private IP, rewriting\n");
                             fix_nated_contact(); # Rewrite contact with
                  source IP of signalling
                             force_rport(); # Add rport parameter to
       topmost Via
                             setbflag(6);    # Mark as NATed
                         if (method=="INVITE") {
                             fix_nated_sdp("1"); # Add
       direction=active to SDP
                             force_rport(); # Add rport parameter to
       topmost Via
                             setbflag(6); # Mark as NATed
                          };
                         };/

                  Output of "opensipsctl ul show":

                  /[root@LN]# opensipsctl ul show
                  database engine 'MYSQL' loaded
                  Control engine 'FIFO' loaded
                  entering fifo_cmd ul_dump
                  Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node:
       end of
                  input tree
                  Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done
                  parsing the mi tree
                  Domain:: aliases table=512 records=0 max_slot=0
                  Domain:: location table=512 records=2 max_slot=1
                     AOR:: 5000
                         Contact::
       sip:5000@77.69.220.94:5060;transport=UDP Q=
                             Expires:: 1038
                             Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5
                             Cseq:: 6049
                             User-agent:: E66-1 RM-343 102.07.81
                             State:: CS_SYNC
                             Flags:: 0
                             Cflag:: 64
                             Socket:: udp:174.132.X.Y:5060
                             Methods:: 4294967295
                     AOR:: 6000
                         Contact::
                        sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=
                             Expires:: 1060
                             Callid::
                  MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.
                             Cseq:: 6
                             User-agent:: X-Lite release 1100l stamp
       47546
                             State:: CS_SYNC
                             Flags:: 0
                             Cflag:: 64
                             Socket:: udp:174.132.X.Y:5060
                             Methods:: 5951
                  FIFO command was:
                  :ul_dump:opensips_receiver_6568/

                  Could you please explain why with mobile user 5000, the
                  contact /sip:5000@77.69.220.94:5060;transport=UDP /and
                  with X-Lite User 6000 the contact is
                  /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/

                  How fix_nated_register() differ with
       fix_nated_register(),
                  do we need to call fix_nated_register() at REGISTER
                  processing?

                  Thanks and Regards,

                  -LN

                  On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu
                  <[hidden email]
       <mailto:[hidden email]> <mailto:[hidden email]
       <mailto:[hidden email]>>
                  <mailto:[hidden email]
       <mailto:[hidden email]>
                  <mailto:[hidden email]
       <mailto:[hidden email]>>>> wrote:

                     Hi,

                     if the online-user info is correct, it looks
       like the
                     fix_nated_register() is not done.

                     Please post the output of "opensipsctl ul show", for
                  that specific
                     user.

                     Also test by using xlog if the at register time your
                  processing
                     gets inside the "if (!search("^Contact:[ ]*\*") &&
                     nat_uac_test("19")) {".

                     Regards,
                     Bogdan

                     oso che bol wrote:

                         Dear All,

                         I use Opensips 1.4.1 with rtpproxy 1.2 for
       NAT support.

                         I use X-Lite which is Behind NAT, register to
                  OpenSIPs proxy,
                         Opensips store right contact address. But,
       when i
                  use Nokia
                         E66 to register to Opensips, the contact
       address is
                  bellow:
                         Online SIP Users
                         Username Domain Contact Expires User Agent
                         5000 *[hidden email]
       <mailto:[hidden email]>
                  <mailto:[hidden email]
       <mailto:[hidden email]>>
                  <mailto:[hidden email]
       <mailto:[hidden email]>
                  <mailto:[hidden email]
       <mailto:[hidden email]>>>
                         <mailto:[hidden email]
       <mailto:[hidden email]>
                  <mailto:[hidden email]
       <mailto:[hidden email]>>
                         <mailto:[hidden email]
       <mailto:[hidden email]>
                  <mailto:[hidden email]
       <mailto:[hidden email]>>>>;transport=UDP*


                  2009-03-30

                         07:20:24.0 E66-1 RM-343 102.07.81


                         User 5000 do not store with external IP
       address of its
                         (external address not 192.168.1.100). Do you
       have
                  any ideas
                         about this?

                         Bellow is my Opensips.conf

                         Thanks and Regards,

                         -LN

                         Opensips.conf




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users