[OpenSIPS-Users] NAT traversal issue in case of different internal and external ports

Krunal Patel krunal.lists at gmail.com
Mon Dec 15 13:58:59 CET 2008


Hi,

I am having an UAC behind NAT.
When I send call to openser, openser does NAT traversal & detects external
IP & port.
As per trace I found that  UAC sends request from some internal port and
router sends to openser with some other external port.
external port is : 50034
internal port is : 5065
So openser sends 183 progress .. to 5065 instead of external port 50034.

Here is the sip trace:

U XXX.XXX.XXX.XXX:50034 -> YYY.YYY.YYY.YYY:5060
INVITE sip:TO_NUM at domain SIP/2.0.
Via: SIP/2.0/UDP [INTERNAL_IP]:5065;branch=z9hG4bK-a0646ab7.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>.
...

U YYY.YYY.YYY.YYY:5060 -> XXX.XXX.XXX.XXX:50034
SIP/2.0 407 Proxy Authentication Required.
Via: SIP/2.0/UDP
[INTERNAL_IP]:5065;branch=z9hG4bK-a0646ab7;rport=50034;received=XXX.XXX.XXX.XXX.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>;tag=b802e73ab92fec121a4f880263d541a3.b5ab.
...

U XXX.XXX.XXX.XXX:50034 -> YYY.YYY.YYY.YYY:5060
ACK sip:TO_NUM at domain SIP/2.0.
Via: SIP/2.0/UDP [INTERNAL_IP]:5065;branch=z9hG4bK-a0646ab7.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>;tag=b802e73ab92fec121a4f880263d541a3.b5ab.
...

U XXX.XXX.XXX.XXX:50034 -> YYY.YYY.YYY.YYY:5060
INVITE sip:TO_NUM at domain SIP/2.0.
Via: SIP/2.0/UDP [INTERNAL_IP]:5065;branch=z9hG4bK-a85eb9f3.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>.
...

U YYY.YYY.YYY.YYY:5060 -> ZZZ.ZZZ.ZZZ.ZZZ:5060
INVITE sip:TO_NUM at ZZZ.ZZZ.ZZZ.ZZZ:5060;transport=udp SIP/2.0.
Record-Route: <sip:TO_NUM at domain
:5060;nat=yes;ftag=45a59ea2bc86747fo0;lr=on>.
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY;branch=z9hG4bKf644.351975f.0.
Via: SIP/2.0/UDP
[INTERNAL_IP]:5065;rport=50034;received=XXX.XXX.XXX.XXX;branch=z9hG4bK-a85eb9f3.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>.
...

U ZZZ.ZZZ.ZZZ.ZZZ:5060 -> YYY.YYY.YYY.YYY:5060
SIP/2.0 100 Trying.
Call-ID: df9cc79e-ffa2ffb3@[INTERNAL_IP].
CSeq: 102 INVITE.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>;tag=3eddfbdb7400749.
...
U ZZZ.ZZZ.ZZZ.ZZZ:5060 -> YYY.YYY.YYY.YYY:5060
SIP/2.0 183 Session Progress.
Call-ID: df9cc79e-ffa2ffb3@[INTERNAL_IP].
CSeq: 102 INVITE.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>;tag=3eddfbdb7400749.
...

U YYY.YYY.YYY.YYY:5060 -> XXX.XXX.XXX.XXX:5065
SIP/2.0 183 Session Progress.
Call-ID: df9cc79e-ffa2ffb3@[INTERNAL_IP].
CSeq: 102 INVITE.
From: "FROM_NUM" <sip:FROM_NUM at domain>;tag=45a59ea2bc86747fo0.
To: <sip:TO_NUM at domain>;tag=3eddfbdb7400749.
...

here is snippet from cfg:

route[3]
{
    # invite route
        if(nat_uac_test("19") )
        {
                 setbflag(6); #Changed from 7 to 6 on 28-May-2008
                 force_rport();
                 fix_nated_contact();
        }
      # .......skipped other
}

onreply_route[1] {
              if (isbflagset(6) || isbflagset(7)) {
              if (status =~ "(180)|(183)|2[0-9][0-9]")  {
                        #xlog("----------- USE MEDIA PROXY ---------- \n ");
                        use_media_proxy();
                        force_rport();
                }
        }

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

Please let me know what I am doing wrong?

Thanks in Advance!!

--
Krunal Patel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20081215/6a45c49d/attachment.htm 


More information about the Users mailing list