[Serusers] NATHelper Issues

Darren Nay dnay at ionosphere.net
Thu Aug 25 22:01:28 CEST 2005


Hey All,

Got a question for you all.  I've had a nathelper implementation in place
for months thinking that it was working, but recent events have made me
question my configuration.

It doesn't seem to be rewriting the contact header when the src_port and
contact_port are different.  Even though I am using fix_nated_contact() for
REGISTER requests.  Please see my details below.

I am using SER v8.12

Here is an example ngrep capture for a REGISTER.  Notice that the source
port is 53492, and the contact port is 53616.

--------------
U 66.110.232.221:53492 -> 208.253.183.40:5060 at 01:52:55 08/26/2005
REGISTER sip:proxy.ionosphere.net SIP/2.0
Via: SIP/2.0/UDP 66.110.232.221:53492;branch=z9hG4bK-7c0d1eaa
From: spectrum wireless
<sip:+13367908202 at proxy.ionosphere.net>;tag=f8c505c5a8fc2e3o0
To: spectrum wireless <sip:+13367908202 at proxy.ionosphere.net>
Call-ID: e0bd4b00-2770688f at 192.168.1.29
CSeq: 10 REGISTER
Max-Forwards: 70
Contact: spectrum wireless
<sip:+13367908202 at 66.110.232.221:53616>;expires=600
User-Agent: IONOSPHERE I-PHONE v1.0
Content-Length: 0
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: x-sipura
-------
U 208.253.183.40:5060 -> 66.110.232.221:53492 at 01:52:55 08/26/2005
SIP/2.0 200 OK
Via: SIP/2.0/UDP 66.110.232.221:53492;branch=z9hG4bK-7c0d1eaa
From: spectrum wireless
<sip:+13367908202 at proxy.ionosphere.net>;tag=f8c505c5a8fc2e3o0
To: spectrum wireless
<sip:+13367908202 at proxy.ionosphere.net>;tag=309667ea73a5d01d816917cdbd4fb3ac
.6723
Call-ID: e0bd4b00-2770688f at 192.168.1.29
CSeq: 10 REGISTER
Contact: <sip:+13367908202 at 66.110.232.221:53616>;q=0.00;expires=600
Server: Sip EXpress router (0.8.12-tcp_nonb (i386/linux))
Content-Length: 0
Warning: 392 208.253.183.40:5060 "Noisy feedback tells:  pid=31855
req_src_ip=66.110.232.221 req_src_port=53492 in_uri=sip:proxy.ionosphere.net
out_uri=sip:proxy.ionosphere.net via_cnt==1"
-------------

Here is a snipet for REGISTER requests from my ser.cfg

--------


         # Nathelper
         if (nat_uac_test("3")) {
           if (method == "REGISTER" || !search("^Record-Route:")) {
             log("LOG:Someone trying to use private IP, rewriting\n");
             fix_nated_contact(); # Rewrite contact with source IP
             force_rport();
             setflag(6);
           };
         };

         # Turn on SIP accounting
         setflag(3);

         if (!method=="REGISTER") record_route();

         # loose-route processing
         if (loose_route()) {
           route(1);
           break;
         };

         lookup("aliases");
         if (!uri==myself) {
                # mark routing logic in request
                append_hf("P-hint: outbound\r\n");
                route(1);
                break;
         };

         if (uri==myself) {

             if (method=="REGISTER") {
               if (!www_authorize("proxy.ionosphere.net", "subscriber")) {
                 www_challenge("proxy.ionosphere.net", "0");
                 break;
               };
            
               save("location")
               break;
             };

            ## etc..................
         };
--------

Then the registration is always recorded as the contact port.  Here is a
serctl ul output:

<sip:+13367908202 at 66.110.232.221:53616>;q=0.00;expires=529


Does anyone have idea why this is happening?  Is my SER.CFG incorrect?

Thanks so much!

Darren Nay
VoIP Network Development
Ionosphere, Inc.
dnay at ionosphere.net





More information about the sr-users mailing list