Configure SIP in FreePBX: 2027 SIP Trunk Setup Guide
Learn how to configure SIP in FreePBX: add a chan_pjsip trunk, check the default SIP and RTP ports, set NAT and route inbound and outbound calls.
By Arkay · Updated · Published
What is SIP trunking on a PBX?
SIP trunking on a PBX connects your own phone system to a provider over the internet, so it can make and receive outside calls. RFC 3261 defines SIP as an application-layer control (signaling) protocol for creating, modifying, and terminating sessions with one or more participants.
Should you use chan_pjsip or chan_sip in FreePBX 17?
Use chan_pjsip. The Asterisk 21 What's New page says chan_sip was deprecated in Asterisk 17 and is now removed. Sangoma says nobody should be using chan_sip and that tools are available to convert chan_sip trunks and extensions to pjsip.
How do you add a SIP trunk in FreePBX?
Trunks are located under Connectivity. The Vega Gateways guide shows how to add one:
- Click Connectivity, then Trunks.
- Click 'Add SIP (chan_pjsip) Trunk' to add a new trunk.
- On the General tab, enter the Trunk Name, Outbound CallerID and Maximum Channels. Maximum Channels is the maximum number of simultaneous outbound calls on the trunk.
pjsip settings
Next, enter the details your provider gives you:
- In simple mode, enter the Username and Secret (SIP password), plus the SIP Server and SIP Server Port.
- Fill in Outbound Proxy, Contact User, Context and Transport. Context is where inbound calls are sent.
- Check the codecs you want. Only checked codecs are used, and you can drag them to reorder.
- Set the registration timers: Expiration (seconds), Retry Interval, Forbidden Retry Interval (used after a 403 Forbidden), Max Retries, Permanent Auth Rejection and Qualify Frequency.
Advanced mode adds Client URI, Server URI and AOR Contact. Sangoma's Trunks module user guide gives no default values for these fields, and your provider supplies the server, port and credentials.
What defaults does FreePBX use for SIP and RTP?
These are published defaults for new FreePBX installs. We compiled them from Sangoma's FreePBX documentation and the Asterisk project's documentation on November 14, 2026. They were not tested on a live system.
| Port | Use | Exposure advice |
|---|---|---|
| 5060 UDP | chan_PJSIP signaling | Not recommended to open to untrusted networks |
| 5061 | chan_PJSIP secure (TLS) signaling | Not recommended to open to untrusted networks |
| 5160 UDP | chan_SIP signaling | Not recommended to open to untrusted networks |
| 5161 | chan_SIP secure signaling | Not recommended to open to untrusted networks |
| 10000-20000 UDP | RTP (call audio) for SIP | Safe to open; most SIP carriers require it because RTP can come from anywhere |
| 4569 UDP | IAX | Not recommended to open to untrusted networks |
The Ports used on your PBX page, last updated November 24, 2025, says these are defaults for new installs and that most can be changed after installation. Keep the signaling ports closed to untrusted networks, and open the RTP range.
How do you set the external address and local networks behind NAT?
In Asterisk SIP Settings, the External Address should show your public IP address. Select 'Detect Network Settings' to have the PBX detect its External and Local networks, as the Asterisk SIP Settings User Guide describes.
Local Networks are entered as an IP address with a subnet mask. For example, network address 192.168.1.0 with subnet mask 255.255.255.0. The RTP port range defaults to 10000-20000, with at least 4 ports for each possible call.
How do you route calls in and out through the trunk?
Outbound Routes tell FreePBX which numbers your phones may call and which trunk to send those calls to.
Inbound Routes tell your PBX where to send incoming calls based on the phone number (DID) dialed. An inbound route can send calls to an extension, ring group, queue, IVR, time condition, feature code, DISA or conference.
More guides in Open-Source PBX and SIP Servers.
Related guides
Frequently asked questions
- Can I still use chan_sip with FreePBX 17?
- Sangoma strongly discourages it. To run chan_sip on FreePBX 17, Sangoma says to downgrade Asterisk to version 20 or earlier, then set the SIP Channel Driver drop-down to 'both'.
- What details do I need from my SIP trunk provider?
- Your provider supplies the server, port and credentials, including the SIP username, SIP password, SIP server and SIP server port. The Trunks module guide gives no default values for these fields.
Sources
- SIP (Session Initiation Protocol) is defined in RFC 3261 as a signaling protocol for creat (www.rfc-editor.org)
- The chan_sip channel driver was deprecated in Asterisk 17 and removed in Asterisk 21. (docs.asterisk.org)
- Sangoma says nobody should be using chan_sip and that tools exist to convert chan_sip trun (sangomakb.atlassian.net)
- In FreePBX, trunks are found under the Connectivity menu. (sangomakb.atlassian.net)
- Port 5060 is the standard port for chan_PJSIP signaling on a FreePBX system, and Sangoma d (sangomakb.atlassian.net)
- In Asterisk SIP Settings, the External Address field should show the PBX's public IP addre (sangomakb.atlassian.net)
- Outbound Routes tell FreePBX which numbers phones may call and which trunk to send those c (sangomakb.atlassian.net)
- Inbound Routes tell FreePBX where to send incoming calls based on the phone number (DID) d (sangomakb.atlassian.net)