Thanks for responding.
The only SIP settings I'm using on the phone are to use port 5060 and server address of 10.11.12.1 (i.e. the VPN).
On FreePBX's extension setup I'm using NAT=YES. Nothing that I see points to the public IP.
Should I be using the following commands:
push "redirect-gateway def1"
push "remote-gateway 10.11.12.1"
push "dhcp-option DNS 8.8.8.8"
(I think 8.8.8.8 is google) from my googling.
Clearly I'm doing something wrong since the PBX is pushing packets to the users public IP.
See below - MY_NONVPN_IP is correct since I don't use the VPN on my phone due to account conflicts. REMOTEIP should be 10.11.12.38 (or whatever .x)
pbx*CLI> [2014-09-15 16:04:07] DEBUG[3557][C-00000053]: res_rtp_asterisk.c:3513 ast_rtcp_read: RTCP NAT: Got RTCP from other end. Now sending to address REMOTEIP:11781
pbx*CLI> > 0xb7411270 -- Probation passed - setting RTP source address to MY_NONVPN_IP:11800
[2014-09-15 16:04:07] DEBUG[3557][C-00000053]: res_rtp_asterisk.c:3967 ast_rtp_read: RTP NAT: Got audio from other end. Now sending to address MY_NONVPN_IP:11800
Got RTP packet from MY_NONVPN_IP:11800 (type 00, seq 000000, ts 3221661647, len 000160)
pbx*CLI> Sent RTP packet to 10.11.12.38:11780 (type 00, seq 059320, ts 3221661640, len 000160)
pbx*CLI> > 0xb5775080 -- Probation passed - setting RTP source address to REMOTEIP:11780
[2014-09-15 16:04:08] DEBUG[3557][C-00000053]: res_rtp_asterisk.c:3967 ast_rtp_read: RTP NAT: Got audio from other end. Now sending to address REMOTEIP:11780
Got RTP packet from REMOTEIP:11780 (type 00, seq 000000, ts 1638191900, len 000160)
pbx*CLI> Sent RTP packet to MY_NONVPN_IP:11800 (type 00, seq 003404, ts 1638191896, len 000160)
> 0xb7411270 -- Probation passed - setting RTP source address to MY_NONVPN_IP:11800
Got RTP packet from MY_NONVPN_IP:11800 (type 00, seq 000001, ts 3221661807, len 000160)
Sent RTP packet to REMOTEIP:11780 (type 00, seq 059321, ts 3221661800, len 000160)
pbx*CLI> > 0xb5775080 -- Probation passed - setting RTP source address to REMOTEIP:11780
pbx*CLI> Got RTP packet from REMOTEIP:11780 (type 00, seq 000001, ts 1638192060, len 000160)
Sent RTP packet to MY_NONVPN_IP:11800 (type 00, seq 003405, ts 1638192056, len 000160)
pbx*CLI> Got RTP packet from MY_NONVPN_IP:11800 (type 00, seq 000002, ts 3221661967, len 000160)
Sent RTP packet to REMOTEIP:11780 (type 00, seq 059322, ts 3221661960, len 000160)
pbx*CLI> Got RTP packet from MY_NONVPN_IP:11800 (type 00, seq 000003, ts 3221662127, len 000160)
Sent RTP packet to REMOTEIP:11780 (type 00, seq 059323, ts 3221662120, len 000160)
pbx*CLI> Got RTP packet from REMOTEIP:11780 (type 00, seq 000002, ts 1638192220, len 000160)
Sent RTP packet to MY_NONVPN_IP:11800 (type 00, seq 003406, ts 1638192216, len 000160)
pbx*CLI> Got RTP packet from REMOTEIP:11780 (type 00, seq 000003, ts 1638192380, len 000160)
Sent RTP packet to MY_NONVPN_IP:11800 (type 00, seq 003407, ts 1638192376, len 000160)
pbx*CLI> Got RTP packet from MY_NONVPN_IP:11800 (type 00, seq 000004, ts 3221662287, len 000160)
The phone registers as expected:
<--- Transmitting (NAT) to 10.11.12.38:5062 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.11.12.38:5062;branch=z9hG4bK678706115;received=10.11.12.38;rport=5062
From: "USERNAME" <sip:1040@10.11.12.1>;tag=1936430616
To: "USERNAME" <sip:1040@10.11.12.1>;tag=as57b9e839
Call-ID: 1771037218@10.11.12.38
CSeq: 2 REGISTER
Server: FPBX-2.11.0(11.12.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 3600
Contact: <sip:1040@10.11.12.38:5062>;expires=3600
Date: Mon, 15 Sep 2014 23:03:01 GMT
Content-Length: 0
Calls OUT are killed with:
<--- Transmitting (NAT) to 10.11.12.38:5062 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.11.12.38:5062;branch=z9hG4bK678706115;received=10.11.12.38;rport=5062
From: "USERNAME" <sip:1040@10.11.12.1>;tag=1936430616
To: "USERNAME" <sip:1040@10.11.12.1>;tag=as57b9e839
Call-ID: 1771037218@10.11.12.38
CSeq: 2 REGISTER
Server: FPBX-2.11.0(11.12.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 3600
Contact: <sip:1040@10.11.12.38:5062>;expires=3600
Date: Mon, 15 Sep 2014 23:03:01 GMT
Content-Length: 0
pbx*CLI> Sent RTP packet to MYCELLIP:25070 (type 00, seq 022064, ts 53074296, len 000160)
pbx*CLI> [2014-09-15 16:06:40] WARNING[1576]: chan_sip.c:4024 retrans_pkt: Retransmission timeout reached on transmission 204452674@10.11.12.38 for seqno 2 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 10175ms with no response
[2014-09-15 16:06:40] WARNING[1576]: chan_sip.c:4053 retrans_pkt: Hanging up call 204452674@10.11.12.38 - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
The PBX ACCEPTS all traffic from 10.11.12 through IP tables.
I'm puzzled.
Andrew