FreePBX SIP Trunk Setup for Call Centers, Step by Step
FreePBX SIP trunk setup takes five steps. First, go to Connectivity → Trunks → Add Trunk → Add SIP (chan_pjsip) Trunk. Second, choose IP authentication (Authentication and Registration both set to None, provider IPs in Match (Permit)) or registration (Authentication Outbound, Registration Send, plus username and secret). Third, pick G.711 ulaw on the Codecs tab. Fourth, set your External Address and Local Networks in Asterisk SIP Settings so audio flows both ways. Fifth, build an outbound route for US numbers and an inbound route for each DID. Then test with pjsip show registrations and pjsip set logger on.
This guide uses FreePBX 16 and 17 menus. Every IP, hostname and password below is a placeholder.
Placeholders used in this guide
- Provider signaling IPs:
203.0.113.10and203.0.113.11 - Provider hostname:
sip.provider.example - Your PBX's public IP:
198.51.100.20· LAN:192.168.1.0/24 - Trunk name:
ck-trunk
Before You Start: What to Collect
Ask your SIP trunk provider for these before you open FreePBX:
- Authentication type: IP authentication or registration (username and secret).
- Signaling IPs or hostnames the provider sends calls from, and the SIP server you send calls to.
- Number format: does the provider want 10 digits, 11 digits (
1NXXNXXXXXX) or E.164 (+1NXXNXXXXXX) for outbound calls, and which format arrives on inbound DIDs? - Codecs and DTMF method (usually RFC 4733).
- Channel and calls-per-second (CPS) limits on your account.
Also check your FreePBX and Asterisk versions (asterisk -rx "core show version"). chan_sip was removed in Asterisk 21, so build new trunks on PJSIP.
Step 1: Create the PJSIP Trunk
On the General tab:
- Trunk Name:
ck-trunk. FreePBX uses it as the PJSIP endpoint name, so keep it short. - Outbound CallerID: a DID you own or are authorized to use, in the provider's format.
- CID Options: Allow Any CID lets each outbound route or extension set its own caller ID. Force Trunk CID always sends the trunk's number.
- Maximum Channels: your account's concurrent call limit. A cap also limits damage if an extension is ever compromised.
Leave the Dialed Number Manipulation Rules tab empty for now. You'll handle number format on the outbound route instead.
Step 2: IP Authentication vs Registration
On pjsip Settings → General, the two choices look like this:
| Field | IP authentication | Registration |
|---|---|---|
| Username / Secret | blank | from provider |
| Authentication | None | Outbound |
| Registration | None | Send |
| SIP Server / Port | sip.provider.example / 5060 | sip.provider.example / 5060 |
| Context | from-pstn | from-pstn |
| Transport | 0.0.0.0-udp | 0.0.0.0-udp |
On a call center PBX with a static public IP, IP authentication is usually simpler and sturdier: nothing to re-register and no password to leak. Give the provider your public IP, 198.51.100.20. Use registration when your IP can change.
Either way, open pjsip Settings → Advanced and put every provider signaling IP in Match (Permit):
203.0.113.10,203.0.113.11
FreePBX turns this into a PJSIP identify object that ties inbound INVITEs from those IPs to the trunk. Miss one and calls from that IP are rejected. On the same tab, keep Direct Media at No, RTP Symmetric, Force rport and Rewrite Contact at Yes, and set DTMF Mode to RFC 4733 if IVR digits are missed. Fill in From Domain or From User only if your provider asks.
Then add the provider IPs to the Trusted zone in Connectivity → Firewall → Networks. That way the responsive firewall won't block them.
Step 3: Codecs
On the trunk's Codecs tab, check ulaw and drag it to the top. G.711 ulaw is the standard for US calling and avoids transcoding. Add g729 only if your provider supports it and you have bandwidth limits. Uncheck everything your provider doesn't support. A codec list with no match is the classic cause of 488 Not Acceptable Here.
Step 4: NAT and External IP
Most one-way audio on FreePBX is NAT. Go to Settings → Asterisk SIP Settings → General SIP Settings:
- External Address:
198.51.100.20(click Detect Network Settings to fill it). - Local Networks:
192.168.1.0/24. - RTP Port Ranges: the default is
10000to20000. Forward that UDP range to the PBX, and allow it from your provider's media IPs.
Click Submit, then Apply Config. Turn off SIP ALG on your router or firewall. It rewrites SIP headers and breaks audio and call setup in ways that are hard to trace.
Step 5: Outbound Routes for US Calling
Go to Connectivity → Outbound Routes → Add Outbound Route. Set a Route Name, an optional Route CID, and put ck-trunk first in Trunk Sequence for Matched Routes. On the Dial Patterns tab, add patterns that send the format your provider expects. For an 11-digit provider:
prepend: 1 match pattern: NXXNXXXXXX
match pattern: 1NXXNXXXXXX
If the provider wants E.164, prepend +1 and + instead. Keep patterns narrow. Catch-alls like X. let any extension dial anywhere, including international numbers you never meant to allow.
Set up a separate 911 route that matches 911 and sends each location's emergency caller ID. Confirm with your provider that 911 and the dispatchable address for each site are set up. Kari's Law and RAY BAUM'S Act set 911 rules for multi-line phone systems.
To size channels for your agent count, use our CPS and channel calculator.
Step 6: Inbound Routes for Your DIDs
Go to Connectivity → Inbound Routes → Add Inbound Route. Enter a Description, then the DID Number exactly as the provider sends it. That might be 2025550142, 12025550142 or +12025550142. Not sure? Place a test call with pjsip set logger on running and read the number in the To: header. To catch every number in one route, use a pattern such as _NXXNXXXXXX. Pick a Set Destination: a queue, ring group, IVR or extension. Calls arrive in from-pstn (the trunk's Context) and then match these routes.
Moving DIDs From a PRI
Leaving a PRI? Build the SIP trunk first and test it on one DID. Keep the PRI trunk second in each outbound route's Trunk Sequence so calls fail over during cutover. Then port numbers in batches. Each port request usually needs a signed letter of authorization (LOA), and often a recent bill, with details that match the current account exactly. Our SIP trunk vs PRI comparison covers gateways and when each one fits.
Test and Read the Logs
From the Linux shell, open the Asterisk CLI with asterisk -rvvv and run:
pjsip show registrations # Registered / Rejected / Unregistered
pjsip show endpoint ck-trunk # contact status Avail or Unavail
pjsip set logger on # full SIP messages for each call
sngrep gives a readable call-flow ladder if it's installed. Place one outbound call to a mobile number, one inbound call to each DID, and talk for at least a minute in both directions.
Common FreePBX SIP Trunk Errors
401 Unauthorized and 403 Forbidden
One 401 followed by a second REGISTER or INVITE is the normal digest challenge. Repeated 401 or a 403 Forbidden means wrong username or secret, the wrong Auth username, or (on IP auth) a public IP the provider hasn't allowed. Also check that your caller ID is a number the provider accepts from your account.
404 Not Found and 408 Request Timeout
404 means the provider doesn't recognize the dialed number format. Fix the outbound route's prepend. A 408 or No response received from 'sip:sip.provider.example:5060' on registration attempt means your packets aren't reaching the provider or replies aren't coming back. Check DNS, the SIP Server Port and your firewall.
488 Not Acceptable Here and 503 Service Unavailable
488 is a codec or SDP mismatch, so go back to Step 3. 503 Service Unavailable can mean the provider couldn't route the call or you hit your channel or CPS limit. FreePBX then plays "All circuits are busy now" if no other trunk is left in the sequence. Our guide to reading SIP codes on failed calls covers more responses and hangup causes.
No Matching Endpoint Found
Request 'INVITE' from '<sip:...>' failed for '203.0.113.11:5060' ... No matching endpoint found means an inbound call came from an IP missing from Match (Permit). Add it and apply the config.
One-Way Audio or Calls Dropping at About 30 Seconds
Both usually trace back to NAT: a wrong External Address, a missing Local Network, closed RTP ports or SIP ALG. Our step-by-step one-way audio fix is written for Vicidial, but the same Asterisk NAT checks apply to FreePBX.
Caller ID and Calling Rules (General Info, Not Legal Advice)
A working trunk doesn't change what you're allowed to dial. Send only caller IDs you own or are authorized to use. STIR/SHAKEN helps authenticate those calls but doesn't control spam labels, as our post on how STIR/SHAKEN relates to spam labels explains. For outbound sales calls, the TCPA, the Telemarketing Sales Rule and state rules apply. Scrub against the National Do Not Call Registry and your internal do-not-call list. Get prior express written consent before autodialed or prerecorded marketing calls to cell phones. Call only between 8am and 9pm in the called person's local time, and honor opt-outs quickly. State rules can be stricter. This isn't legal advice, so talk to your counsel.
FreePBX SIP Trunk FAQ
Should I use chan_sip or PJSIP for a FreePBX SIP trunk?
PJSIP. chan_sip was removed in Asterisk 21. In FreePBX, add the trunk with Add SIP (chan_pjsip) Trunk.
Should I use IP authentication or registration in FreePBX?
With a static public IP, IP authentication is usually simpler and sturdier. Set Authentication and Registration to None and list the provider IPs in Match (Permit). Use registration if your IP can change.
Why does my FreePBX trunk show Rejected?
The provider refused the REGISTER, usually because of a wrong username, secret or Auth username. Run pjsip set logger on and look for 401 or 403 replies.
Why are inbound calls to my DID not ringing in FreePBX?
Check that the DID Number in the inbound route matches the format the provider sends (10, 11 digits or +1), that the provider IP is in Match (Permit), and that the firewall trusts it.
Helpful tools: check your outbound caller IDs with our free spam number checker, estimate monthly US minutes with our VoIP cost calculator, and size lines with the CPS and channel calculator.
Get a Trunk Ready for Your FreePBX
Our Tier-1 SIP trunking for call centers runs on US routes with 99.99% uptime, with US DIDs and STIR/SHAKEN-ready caller ID that helps authenticate your calls. Our support team is here Monday to Friday, 9am ET to 9pm PT, to help you fill in the trunk fields above. Tell us about your setup and request a quote. Quotes usually come back the same day.
