Incorrect EXTERNIP going out

Having a real 'mare setting up a SIP trunk with Twilio, FreePBX and pfSense. What seems to be happening is that the outbound request from our PBX and passing the traffic via the local LAN ip address. As such the end point cannot route the traffic back through to our PBX. Has anyone else seen this behaviour? Seems to happen on all SIP trunk we try and setup, So I don’t think it’s Twilio more down to the PBX and the firewall not working well together.

Any ideas?

The term you’re looking for is NAT - network address translation.

Go to Settings > Asterisk SIP Settings to configure your server appropriately. You can also try setting up your PBX to use a STUN server.

HI Overkill,

Thanks for the reply, from everything I have read about SIP trunks the setting on the PBX should be NAT=yes, which is the case. I am pretty sure the problem is with our firewall, but just need to pinpoint what changes are needed.


NAT = yes is part of the equation.

You should also set the internal and external IP addresses from this screen - local networks will be your private IP BLOCK (such as - see also CIDR notation) and the external should detect with no problems.

You also need to make sure RTP ports are set as wide as your provider can handle, and your firewall is allowing the traffic.

Hi Overkill,

This has been bugging me for a long time now, NAT=yes, local networks is set for our internal IP network and the EXTERNIP detects just fine. I have allowed ALL listed IP addresses from our provider through the firewall along with about 1000 RTP ports, though I have tested with the full 10000 range too. In theory this should be nice and simple, but I think that our pfSense firewall may be mangling the RTP packets as they never reach the PBX

:frowning: Are you able to run any sort of packet capture or view logs for dropped packets?