Freepbx is not using public IP in requests

I have an issue with my Freepbx install where it is not detecting external addresses and using the public IP. It is putting the private IP in all headers which, as you can imagine is breaking things quite badly.

Strangely, the public IP is in the SDP component of an INVITE, but the headers all show local IPs. Here is a sample header.

[17:18:46.209] RX from 13.75.xxx.xxx:5060:
INVITE sip:[email protected]:56176;user=phone;transport=TCP SIP/2.0
Via: SIP/2.0/TCP 10.1.0.4:5060;rport;branch=z9hG4bKPj65f510ae-e8fc-4af5-9ad8-d8681ff83059;alias
From: “Mark Dutton” sip:[email protected];user=phone;tag=40ff7e84-a9db-41cd-8802-acfc29a2346b
To: sip:[email protected];user=phone
Contact: sip:[email protected]:5060;transport=TCP
Call-ID: 1f2583f1-78d2-4c7f-a601-5f6505b76caf
CSeq: 14696 INVITE
Allow: OPTIONS, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, MESSAGE, INFO, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: “Mark Dutton” sip:[email protected];user=phone
Max-Forwards: 70
User-Agent: FPBX-17.0.19.23(21.4.1)
Content-Type: application/sdp
Content-Length: 337

I have the correct external IP configured in the settings | Asterisk SIP settings page on the general SIP settings tab. I have also tested in the specific locations within the Sip settings (PJSIP) tab. I only use TCP and TLS SIP.

Here is a (sanitized) snippet of the general tab.

I am at a loss now. I cannot see any specific use NAT, as I have in some other Asterisk UIs, so I assume that it is implicitly set when the correct information is supplied.

This is running on an Azure instance. I have disabled systemd-networkd and I am using ifupdown to keep the network management side happy.

Note that when you change those settings, after Submit and Apply Config you must restart Asterisk. Given the other changes you tried, I recommend rebooting the server.

If the above is not your issue, rule out unwanted modification in the network.
At the Asterisk command prompt, type
pjsip set logger on
make a test call and the sent packet will appear in the Asterisk log.
If it has the correct external address, track down what network element is butchering it.
If the packet as sent is still wrong, we can look at the pjsip config files to see which was incorrectly written.

Thanks for the reply. Yes there have been plenty of reboots and the dialogs are originating from asterisk as they arrive at the client.

I.E. pjsip set logger host 202.90.xxx.xxx shows the incorrect address info.

I installed this from pre release 17 and have been upgrading successfully since. I have since added Teams functionality and possible other plug ins that I don’t remember. It is a semi production system. Only my 2 home extensions and mainly used for testing.

If it’s not a simple setting I’m missing, I’ll rebuild the system from scratch and see how it goes. I have not had these issues with Asterisk based systems before. It is strange that the SDP is all based on public IP , but the header is private.

I am away for a week, but I will check in here when I have an outcome to share.

Not terribly strange. pjsip has separate concepts of external_signaling_address and external_media_address . To start, at the Asterisk command prompt, type
pjsip show transport 0.0.0.0-tcp
and post the output.
If this object doesn’t exist, type
pjsip show transports
find the relevant one and repeat the show transport command with the correct argument.

1 Like

Looking good on that front, except possibly the external signalling port. Should this be 0? I would have thought it would be 5060 in this case, but assuming here that 0 means default?

Transport: 0.0.0.0-tcp tcp 3 96 0.0.0.0:5060

ParameterName : ParameterValue

allow_reload : false
allow_wildcard_certs : No
async_operations : 1
bind : 0.0.0.0:5060
ca_list_file :
ca_list_path :
cert_file :
cipher :
cos : 3
domain :
external_media_address : 13.75.xxx.xxx
external_signaling_address : 13.75.xxx.xxx
external_signaling_port : 0
local_net : 10.1.0.0/255.255.255.0
method : unspecified
password :
priv_key_file :
protocol : tcp
require_client_cert : No
symmetric_transport : false
tcp_keepalive_enable : true
tcp_keepalive_idle_time : 30
tcp_keepalive_interval_time : 1
tcp_keepalive_probe_count : 5
tos : 96
verify_client : No
verify_server : No
websocket_write_timeout : 100

I have the installed FreePBX from scratch and as promised I am reporting back that it is now working as it should be, with external IP addresses in the via and contact fields.

This has been a frustrating exercise, with little to indicate the why, but all good now.