T.38 fax setup — passthrough vs reinvite, MTU pitfalls, per-carrier tips
Fax over VoIP is one of those problems the industry quietly admitted it never fully solved. T.38 makes it work most of the time. This article covers how T.38 actually works, the right way to configure it in FreePBX®, the MTU/fragmentation traps that cause "fax half-completes then fails," and the per-carrier specifics for Telnyx, Flowroute, and VoIP.ms.
Why fax over VoIP is hard
Faxes were designed for analog phone lines: 9600 baud modem tones encoding the page bitmap, exchanged in real time with strict timing. When you carry that over packetized voice (G.711 in particular), even tiny packet loss or jitter desyncs the modem handshake and the fax aborts.
T.38 sidesteps the problem by demodulating the fax tones at the ingress, sending the underlying T.30 fax protocol as TCP/UDP packets with redundancy, and re-modulating at the egress. The network just carries data, not real-time modem tones.
Two operational modes:
- Passthrough — fax tones travel as G.711 all the way. Simplest configuration; works when packet loss is <0.5% and jitter is <20 ms. Fails unpredictably otherwise.
- T.38 reinvite — call starts as voice G.711, fax-tone detection triggers a SIP reinvite to T.38, the rest of the call is data. This is what you want for production.
FreePBX configuration
For each extension that handles fax:
- Fax Configuration in the extension's settings → enable Fax detection.
- Fax Detect Type: typically "incoming" for receive-only.
- Email address for received-fax PDFs.
Globally, under Settings → Asterisk SIP Settings:
- T.38 Pass-Through: Yes (this label is misleading; it means "allow T.38 reinvite," not the passthrough mode above).
- Error Correction Mode (ECM): enable. Catches transient errors mid-page.
- T.38 maximum datagram size: 400 is a reasonable default; lower if you have MTU issues.
For the trunk: enable T.38 on the carrier's trunk configuration AND in FreePBX's trunk settings.
MTU and fragmentation — the silent killer
T.38 datagrams that exceed the path MTU get fragmented or dropped. Symptoms: fax handshake succeeds, first page transfers, then mid-page failure.
Check the path MTU between your PBX and the carrier:
ping -M do -s 1472 sip.<carrier>.com
If 1472 fails, work down (1400, 1300, 1200) until it succeeds. Add 28 to find the path MTU. Set Asterisk's T.38 datagram size to a few hundred below that:
# /etc/asterisk/res_fax.conf or via FreePBX GUI
[general]
maxdatagram = 380
Carriers' typical path MTUs are 1500 unless your provisioning goes over an MPLS or VPN segment with overhead.
Per-carrier specifics
Telnyx
- Enable T.38 on the Telnyx connection (portal → SIP Connections → your connection → Fax Settings).
- Set T.38 Reinvite Source to "Originator" for sending faxes from FreePBX.
- Telnyx also offers a Fax-as-a-Service API if T.38 over SIP is a recurring problem — for low-volume reliable fax, that's often less work than tuning T.38.
Flowroute
- Enable T.38 on the Flowroute portal under your inbound DID settings.
- Flowroute defaults to G.711 ulaw; the reinvite to T.38 happens on tone detect.
- Note: Flowroute's T.38 implementation has historically been ECM-friendly. Leave ECM on.
VoIP.ms
- Per-DID setting: T.38 enabled.
- VoIP.ms also offers a dedicated fax sub-account (separate from voice DIDs) — that's the easier option if fax reliability is more important than cost saving.
Inbound fax handling
When a fax comes in:
- FreePBX detects the CNG tone on the inbound channel.
- The call is routed to the configured fax extension.
- The fax is received as a PDF or TIFF and emailed to the configured address.
- The CDR records the fax success/failure.
Verify with a test fax from a known-good source (a fax-to- email service like Phaxio or HelloFax is convenient for testing because you can trigger faxes via API).
Outbound fax from FreePBX
FreePBX's UCP can send faxes (upload PDF, dial outbound DID). Or use the API:
# sendfax CLI on most FreePBX distros
sendfax -n -d <dest-number> /path/to/file.pdf
For high-volume outbound fax, use a dedicated fax API (Phaxio, Telnyx Fax) instead of T.38 over the regular trunk — better reliability and per-page billing.
If it still doesn't work
Common diagnosis flow:
- Watch
asterisk -rvvvwithfax set debug onduring a test fax. - Confirm the reinvite happens (look for
image/t38in the SDP). - If reinvite never happens, the trunk isn't negotiating T.38. Check both sides' SIP settings.
- If reinvite happens but transmission fails mid-fax, MTU is the prime suspect.
- If transmission succeeds but PDF emails don't arrive, the fax module's email delivery is the issue — check the local MTA and SPF/DKIM. See Voicemail-to-email when it never arrives.
Also Read
Powered by WHMCompleteSolution