Wrong IP address in INVITE SDP

Hello

I have following setup with the server across one NAT and clients will be behind another NAT. The setup is as follows

(Sailfin + asterisk + mediamixer running on Server PC) <===>router (public IP) <===>(internet)<===>(gateway) <===>router(dynamic IP) <===> Client running on PC

With the NAT setting I am able to make the peer to peer call through Asterisk server.

(mcuweb + mediamixer + asterisk) running on same pc with IP 192.168.1.6. This PC is connected to router with public IP 111.222.333.44. I have done the port forwarding correctly for 192.168.1.6 IP in router setting.

I am calling from the client which are behind another NAT to ext 300 which is registered as peer from asterisk (behind another NAT).

The call is getting established but the packets are not forwarded to the client IP. From capture I can see the packets from 192.168.1.6 are forwarded to public IP 111.222.333.44, where as they should have been forwarded to 333.444.555.666 which is client’s IP

user1 and user3 are client which are running on different PC and network and 300 is the number for the mediamixer which is running on the same PC where asterisk server is running.

PLease refer the invite from asterisk.

INVITE sip:300@127.0.0.1:5070 SIP/2.0
Via: SIP/2.0/UDP 111.222.333.44:5060;branch=z9hG4bK4b86b3cb;rport
Max-Forwards: 70
From: “Tariq” sip:user1@111.222.333.44;tag=as4cc63c58
To: sip:300@127.0.0.1:5070
Contact: sip:user1@111.222.333.44
Call-ID: 2487cac1587777cf33610a871672f3d0@111.222.333.44
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.22
Date: Fri, 02 Mar 2012 09:25:33 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 292

v=0
o=root 1768313542 1768313542 IN IP4 111.222.333.44
s=Asterisk PBX 1.6.2.22
c=IN IP4 111.222.333.44
t=0 0
m=audio 11022 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
c=IN IP4 111.222.333.44

Here in Invite the parameter c is set to public IP instead of clients IP. Hence the packets are fwd to public IP insted of client’s IP.

Could you please tell me why the c parameter in SDP is set to Public IP and not to client’s IP ? I am using Asterisk PBX 1.6.2.22

Thanks and Regards
SD

Note : I have tried following configuration parameters in sip.conf

  1. nat = yes
  2. externip = public ip
  3. localnet = 192.168.1.0/24

[user1]
;videosupport=yes
type=friend
context=from-sip
host=dynamic
secret=mysecret
;insecure = invite, port
canreinvite=no
nat = yes
qualify=yes
;directrtpsetup=no
;directmedia=no
disallow=all ; you have to explicit allow h264, else video will not work in your client!!
allow=ulaw
allow=alaw
allow=h263p
allow=h264

[mcuWeb]
;videosupport=yes
type=peer
host=127.0.0.1
port=5070
canreinvite=no
nat = no
;directrtpsetup=no
;directmedia=no
disallow=all
allow=ulaw
allow=alaw
allow=speex
allow=h263
allow=h263p
allow=h264

From my knowledge of the problem I would seriously think you had a nat problem. You should not be getting a local ip out of nat.
Just go through the basics of nat. This guide has clear diagrams.
cognitiveanomalies.com/cisco-nat-how-nat-works/
The other option I can think of is that you have a problem with inspect on the firewall/router doing the nat.
If using Cisco I would check on the setup again.
cisco.com/en/US/tech/tk648/t … 3f31.shtml
It is also very likey that you have a problem with fixup/inspect. If the packets embed this ip in the payload and you are seeing the ip address 192.168.1.6 on the far end that is your problem. It can not travers the internet otherwise.