Skip to content
Dialer & Setup

FreePBX Codec Selection for Outbound Call Centers

The codec you negotiate determines audio quality, CPU cost, and PSTN compatibility — and most FreePBX deployments ship with a suboptimal default list.

1. Why Codec Selection Is Not a Set-It-and-Forget-It Decision

FreePBX ships with a default codec order that prioritizes G.711 ulaw, then a mix of narrowband and wideband codecs. For outbound call centers dialing PSTN numbers through a SIP trunk, the codec you negotiate affects three things simultaneously: the audio quality the called party hears, the CPU load on your Asterisk server, and whether the call traverses the carrier network without a transcoding step that degrades quality.

On a flat-rate SIP trunk like UnlimCall, you are not paying per minute, but you are sharing CPU across all concurrent calls on your Asterisk server. At 100 simultaneous calls, a misconfigured codec list that forces transcoding on every call consumes 40–60% more CPU than a passthrough G.711 configuration. That headroom matters when your pacing ratio is high.

2. The Codec Stack That Works for PSTN Outbound

For outbound calling to PSTN numbers in US and Canada markets:

Primary: G.711 ulaw (PCMU)

G.711 ulaw is the native codec for the North American PSTN. It requires no transcoding at the carrier boundary, delivers 8 kHz narrowband audio (3.4 kHz effective bandwidth — sufficient for voice), and uses 64 kbps per channel. Your Asterisk server passes audio through without CPU overhead. This is the correct primary codec for any outbound call center dialing US or Canadian numbers through UnlimCall.

Secondary: G.711 alaw (PCMA)

alaw is the European PSTN standard. For UnlimCall markets outside North America — the UK, Germany, France, Netherlands, and others in the 33-market network — alaw should be in your secondary position. Calls to these markets may negotiate alaw rather than ulaw at the carrier boundary; having it in your allow list prevents a transcoding fallback to a compressed codec.

Optional: OPUS

OPUS is a wideband, open codec offering voice quality significantly above G.711. It is appropriate for agent-to-supervisor monitoring paths, call recording streams, or WebRTC endpoints where the audio stays within your network. For outbound PSTN calls, OPUS requires transcoding to G.711 at the carrier gateway — adding CPU load without improving the audio quality the called party hears (PSTN is still 8 kHz at their end). Enable OPUS in your allow list only if your Asterisk server has CPU headroom.

Exclude: G.729

G.729 reduces bandwidth to 8 kbps — about 12% of G.711 — at the cost of a licensed DSP or software license and noticeable audio compression. Unless you are connecting over a severely bandwidth-constrained link (sub-1 Mbps upstream), G.729 adds cost and complexity without a meaningful network benefit on modern broadband or datacenter connections.

3. Configuring the Codec List in FreePBX

Navigate to Admin > SIP Settings > General.

Under Codec Settings, reorder the allowed codecs:

  1. ulaw
  2. alaw
  3. (OPUS — optional, add last)

Remove g729, gsm, and h264 from the allowed list unless your specific use case requires them.

For PJSIP trunk-level codec override, navigate to the trunk's pjsip Settings > Codecs tab and set the same order. Trunk-level codec settings override the global order for calls leaving through that trunk — useful if you have one domestic trunk (ulaw first) and one international trunk (alaw first).

`` ; Resulting pjsip.conf endpoint section (auto-generated by FreePBX): [unlimcall-us] type=endpoint allow=!all,ulaw,alaw ... ``

The !all prefix clears the default inherited list before applying your explicit allow list. Verify this appears in /etc/asterisk/pjsip.endpoint_custom_post.conf after applying config.

4. Codec Negotiation Verification

After applying your codec configuration, verify negotiation on a live call:

`` asterisk -rx "pjsip show channel PJSIP/unlimcall-us-00000001" ``

Look for the Read format and Write format fields. Both should show ulaw for domestic US/CA calls. If either shows slin (signed linear) or g722, Asterisk is transcoding — something in your allow list or the remote end's SDP caused a codec mismatch.

Check the SDP exchange in a SIP trace:

`` asterisk -rx "pjsip set logger on" ``

Then originate a test call and examine the SDP offer (your Asterisk) and SDP answer (UnlimCall's network). The m=audio line and a=rtpmap attributes show which codec was agreed.

5. RTP Port Range and Codec Bandwidth Planning

Each G.711 call uses approximately 80 kbps bidirectional (including RTP overhead). A 100-agent deployment with an average pacing ratio of 3:1 (3 dialed channels per connected agent) might sustain 100–150 simultaneous RTP streams. At 80 kbps each, that is 12 Mbps of outbound RTP — well within a standard 1 Gbps datacenter uplink but worth verifying if your Asterisk server runs behind a shared ISP connection.

Configure your RTP port range in Admin > SIP Settings > General > RTP Port Ranges. A range of 10,000–20,000 (10,000 ports) supports up to 5,000 simultaneous calls — more than sufficient for most FreePBX deployments. Ensure your firewall allows UDP traffic on this range from your Asterisk server's public IP.

Takeaways

For outbound PSTN calling, G.711 ulaw as the primary codec is not a compromise — it is the right choice. No transcoding, no license fees, PSTN-native audio path. G.711 alaw covers international PSTN legs. OPUS belongs on internal paths only. Remove G.729 unless you have a specific bandwidth constraint that justifies the added complexity.

Flat-Rate Outbound on a Network Built for Call Centers

UnlimCall's 33-market SIP network is optimized for G.711 passthrough on domestic and international PSTN calls. Seats from $99/month in US/CA. See /pricing/ and network coverage.