FreePBX PJSIP RTP Issues with NAT endpoints


I am currently running:
PBX Firmware: 10.13.66-12
Asterisk 13.9.1

I have the PBX in a data center behind NAT. I have a soft phone in my house behind NAT as well.
The extensions registers appropriately but RTP packets are being sent to the wrong IP . The same setup with the chan-sip driver works perfectly. Issue is only happening on pjsip
Here are the traces from the PBX:
<— Transmitting SIP response (948 bytes) to UDP: —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP;rport=55060;received=;branch=z9hG4bK-524287-1—f7a5271d80a5801a
From: “Levi Test” sip:[email protected];tag=be37784f
To: sip:*[email protected];tag=p0yUVCaw91gNVHxUBe.0Iu3RW5T51Q6Z
Server: FPBX-13.0.131(13.9.1)
Contact: sip:
Supported: 100rel, timer, replaces, norefersub
P-Asserted-Identity: “Dial Voicemail” sip:*[email protected]
Content-Type: application/sdp
Content-Length: 276

o=- 1023031690 3 IN IP4
c=IN IP4
t=0 0
m=audio 11166 RTP/AVP 0 8 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

<— Received SIP request (442 bytes) from UDP: —>
ACK sip: SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK-524287-1—04892311eee55c6f;rport
Max-Forwards: 70
Contact: sip:[email protected]:55060
To: sip:*[email protected];tag=p0yUVCaw91gNVHxUBe.0Iu3RW5T51Q6Z
From: “Levi Test” sip:[email protected];tag=be37784f
CSeq: 2 ACK
User-Agent: X-Lite release 4.9.3 stamp 79961
Content-Length: 0

Sent RTP packet to (type 00, seq 004093, ts 000160, len 000160)
Sent RTP packet to (type 00, seq 004094, ts 000320, len 000160)
Sent RTP packet to (type 00, seq 004095, ts 000480, len 000160)
Sent RTP packet to (type 00, seq 004096, ts 000640, len 000160)
Sent RTP packet to (type 00, seq 004097, ts 000800, len 000160)
Sent RTP packet to (type 00, seq 004098, ts 000960, len 000160)
Sent RTP packet to (type 00, seq 004099, ts 001120, len 000160)
Sent RTP packet to (type 00, seq 004100, ts 001280, len 000160)
Sent RTP packet to (type 00, seq 004101, ts 001440, len 000160)
Sent RTP packet to (type 00, seq 004102, ts 001600, len 000160)

As you can see from this the packets are being set to the private IP of my Softphone on the remote network, instead of the public ip.
Researching online did not reveal much info
The following document describes a similar issues that got resolved by an Asterisk Update but I am already running on latest form FreePBX

Here is my networking Set Up
PBX Local IP :

Sofphone Private :
Public DHCP from Comcast : at time of test


RTP Symmetric YES
Rewrite Contact YES
Force rport YES

Any help would be appreciated

This worked in an older version of Asterisk. It stopped working once updates where applied.

Please check Advanced Settings–>General SIP Settings and under NAT settings section, “External Address”.
and then run “Detect Network Settings”

It has been done and also checked and my pjsip.transoporst conf has this in it


Hello, this is an old topic but somehow it still exists as an issue. FreePBX 13 latest update. Were you able to find a work around?

Amazing. I am seeing exactly the same issue here.

The FreePBX server is behind NAT and so are the remote handsets.
external_media and signalling addresses are set to the public IP on the NAT firewall, RTP Symmetric, Rewrite Contact and Force Rport are all set on the extensions but an RTP debug shows that RTP packets are being sent to the internal LAN IP of the remote handset, rather than the public IP.

This issue is only affecting PJSIP extensions - no problem with chan_sip

Does anyone have any ideas on a fix for this please?

Are you receiving audio from the remote extension? If not, confirm that in Asterisk SIP Settings, External Address and Local Networks are correctly set.

If audio is coming in, confirm that Symmetric RTP for the extension is set to Yes…

If no luck, turn on pjsip logger, paste the Asterisk log for a failing call at and post the link here.

Thank you for your reply Stewart1.

I had a brainwave earlier this morning before seeing your reply. (You are definitely correct asking about “Local Networks” though).

A quick overview of the overall scenario again - hoping that this helps others in future:

This FreePBX server is behind NAT at a datacentre, it’s IP is “”.
Phones connect to this system via two methods:

  1. “Locally” from a network. (No NAT involved at all).
  2. Across the Internet, where the phones themselves are behind NAT routers. (So NAT at the FreePBX server and NAT at the endpoints)

The locally attached phones are in the network, so my FreePBX configuration was simple - “Under SIP Settings” (The General SIP settings tab):
“” under “Local Networks”
My server’s external address in “External Address”.

Really straight forward…BUT the local IP address on the FreePBX server itself is so considering that no phones connect to it from the network, I didn’t list it as a “local_net” - which interestingly enough turned out to be the cause of the problem for the PJSIP-based phones.

In summary, it seems that NAT detection and NAT features (chan_pjsip’s “rtp_symmetric”, “rewrite_contact” etc. endpoint parameters), seemed to be ignored for the Internet-based endpoints until I listed the FreePBX server’s own local network as a ‘local_net’ (despite no phones actually being present in that ‘local’ network).

As always - a super simple fix.

As a side note: In this instance, I should have trusted FreePBX’s “Detect Network Settings”, which actually listed “” as a local network, but I had removed manually. :slight_smile:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.