[OpenSIPS-Users] NAT Contact address issues with Nokia Mobile

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Apr 2 12:42:40 CEST 2009


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 
> <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> 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:8000 at 212.15.B.C:1120
>         - Contact of X-Lite:
>         sip:6000 at 58.186.Y.Z: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
>         <ndlgroup1 at gmail.com <mailto:ndlgroup1 at gmail.com>
>         <mailto:ndlgroup1 at gmail.com <mailto:ndlgroup1 at gmail.com>>> wrote:
>
>            Dear Bogdan,
>
>            Thanks very much for your time.
>
>            Regards,
>            -LN
>
>
>            On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu
>            <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>
>         <mailto:bogdan at voice-system.ro
>         <mailto:bogdan at voice-system.ro>>> 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 at 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 at 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 at 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 at 77.69.220.94:5060;transport=UDP /and
>                    with X-Lite User 6000 the contact is
>                    /6000 at 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
>                    <bogdan at voice-system.ro
>         <mailto:bogdan at voice-system.ro> <mailto:bogdan at voice-system.ro
>         <mailto:bogdan at voice-system.ro>>
>                    <mailto:bogdan at voice-system.ro
>         <mailto:bogdan at voice-system.ro>
>                    <mailto:bogdan at voice-system.ro
>         <mailto:bogdan at voice-system.ro>>>> 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 at 192.168.1.100
>         <mailto:sip%3A5000 at 192.168.1.100>
>                    <mailto:sip%3A5000 at 192.168.1.100
>         <mailto:sip%253A5000 at 192.168.1.100>>
>                    <mailto:sip%3A5000 at 192.168.1.100
>         <mailto:sip%253A5000 at 192.168.1.100>
>                    <mailto:sip%253A5000 at 192.168.1.100
>         <mailto:sip%25253A5000 at 192.168.1.100>>>
>                           <mailto:sip%3A5000 at 192.168.1.100
>         <mailto:sip%253A5000 at 192.168.1.100>
>                    <mailto:sip%253A5000 at 192.168.1.100
>         <mailto:sip%25253A5000 at 192.168.1.100>>
>                           <mailto:sip%253A5000 at 192.168.1.100
>         <mailto:sip%25253A5000 at 192.168.1.100>
>                    <mailto:sip%25253A5000 at 192.168.1.100
>         <mailto:sip%2525253A5000 at 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
>




More information about the Users mailing list