[SR-Users] NATHELPER issue

Konstantin Polyakov piligrim_pk at mail.ru
Fri Jul 20 14:01:18 CEST 2018


Hello Ali,

ACK is sent by UAC to the Contact which is received in OK from UAS.
So from my point of view you need to fix that Contact in OK on your proxy.

My NATDETECT looks like:

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

I call it for requests and responses.

Best regards.
Konstantin

>Message: 23
>Date: Fri, 20 Jul 2018 11:13:42 +0300
>From: "Ali Taher" < ataher at vanrise.com >
>To: < sr-users at lists.sip-router.org >
>Subject: [SR-Users] NATHELPER issue
>Message-ID: < 070901d42001$939be2b0$bad3a810$@vanrise.com >
>Content-Type: text/plain; charset="utf-8"
>
>Hello,
>
> 
>
>I'm using Kamailio 4.2 as proxy with nathelper enabled.
>
> 
>
>Yet , the ACK packet sent from the proxy to the origination's private IP.
>
> 
>
>The ACK is sent as reply on the following 200 OK sent from the origination :
>
>
> 
>
>8m2EJN41BN/6WSIP/2.0 200 OK
>
>From: <sip:+4444331234567 at X.X.X.X;user=phone>;tag=XQBQNjvjgp4Ze
>
>To: <sip:+905362695933 at 172.16.45.65;user=phone>;tag=12033368836000
>
>Via: SIP/2.0/UDP
>X.X.X.X:5065;branch=z9hG4bK2959.233ecbc5eff949f946d8763ce25e5e6d.0;received=
>X.X.X.X,SIP/2.0/UDP
>X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKN93cXvv26vDDN
>
>Record-Route: <sip:X.X.X.X:5065;lr;ftag=XQBQNjvjgp4Ze>
>
>Call-ID:  CbeX8453909200habfGhEfElPce at BC00.XXXXXXXXXXXXXX
>
>CSeq: 125698370 INVITE
>
>Accept: application/sdp
>
>Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,UPDATE
>
>P-Charging-Vector:
>icid-value=B0912C3D70-0720-09394507;icid-generated-at=BC00.XXXXXXXXXXXXXX.XX
>;orig-ioi=MXXXXXXXXXXXXXX
>
>Content-Type: application/sdp
>
>Contact: <sip:172.16.45.65:5060;transport=UDP>
>
>Content-Length:  268
>
> 
>
>v=0
>
>o=- 5838243 5838244 IN IP4 BC00.XXXXXXXXXXXXXX
>
>s=-
>
>c=IN IP4 172.16.45.144
>
>t=0 0
>
>a=sendrecv
>
>m=audio 47588 RTP/AVP 18 96
>
>c=IN IP4 172.16.45.144
>
>a=rtpmap:18 G729/8000
>
>a=fmtp:18 annexb=yes
>
>a=rtpmap:96 telephone-event/8000
>
>a=fmtp:96 0-15
>
>a=maxptime:20
>
> 
>
>Following is the header of the sent ACK packet:
>
> 
>
>Request-Line: ACK sip:172.16.45.65:5060;transport=UDP SIP/2.0
>
>Record-Route: <sip:X.X.X.X:5065;lr;ftag=XQBQNjvjgp4Ze>
>
>Via: SIP/2.0/UDP
>X.X.X.X:5065;branch=z9hG4bK2959.871535fd341bbe3099d0bf60d6460e18.0
>
>Via: SIP/2.0/UDP
>X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKQUpy0jy90etjc
>
>Max-Forwards: 69
>
>From: <sip:+4444331234567 at X.X.X.X;user=phone>;tag=XQBQNjvjgp4Ze
>
>To: <sip:+905362695933 at 172.16.45.65;user=phone>;tag=12033368836000
>
>Call-ID:  CbeX8453909200habfGhEfElPce at BC00.XXXXXXXXXXXXXX
>
>CSeq: 125698370 ACK
>
>Content-Length: 0
>
> 
>
>Where X.X.X.X is Kamailio server public IP.
>
> 
>
>Following is part of my config file :
>
> 
>
>route {
>
>route(NATDETECT);
>
>record_route();
>
> 
>
>        if(!mf_process_maxfwd_header("10")) {
>
>                sl_send_reply("483", "Too Many Hops");
>
>                exit;
>
>        }
>
> 
>
>        # Maybe some sanity_check() here.
>
> 
>
>        if(has_totag()) {
>
>       
>
>                if(loose_route()) {
>
>                route(DLGURI);
>
>                        if(!t_relay())
>
>                                sl_reply_error();
>
> 
>
>                        exit;
>
>                } else {
>
>                        if(is_method("ACK")) {
>
>                        route(DLGURI);
>
>                                if(t_check_trans()) {
>
>                                        t_relay();
>
>                                }
>
>                        } else
>
>                                sl_send_reply("403", "Forbidden");
>
>                }
>
>                exit;
>
>        }
>
>                                
>
>.....
>
>}
>
>                                
>
> 
>
>route[NATDETECT] {
>
>#!ifdef WITH_NAT
>
>        force_rport();
>
>        if (nat_uac_test("19")) {
>
>                if (is_method("REGISTER")) {
>
>                        fix_nated_register();
>
>                } else {
>
>                        add_contact_alias();
>
>                }
>
>                setflag(FLT_NATS);
>
>        }
>
>#!endif
>
>        return;
>
>}
>
> 
>
>route[DLGURI] {
>
>#!ifdef WITH_NAT
>
>        if(!isdsturiset()) {
>
>         handle_ruri_alias();
>
>        }
>
>#!endif
>
>        return;
>
>} 
>
> 
>
>Can you please check why the ACK is still sent on private IP ?
>
> 
>
>Thanks
>
>Ali Taher
>
>

"Ali Taher" < ataher at vanrise.com >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180720/883ce44e/attachment.html>


More information about the sr-users mailing list