An Asterisk fax server uses the SpanDSP library and T.38 protocol to send and receive faxes over IP networks. Asterisk handles the signaling and media, SpanDSP does the fax modem emulation, and T.38 provides the real-time transport layer. The result: standard fax behavior without physical phone lines or fax machines. Setting it up correctly requires understanding each layer — and where raw Asterisk needs additional tooling to become a production-ready fax platform.

How Asterisk Handles Fax Internally

Asterisk supports two distinct fax modes, and choosing the wrong one is the most common source of fax reliability problems.

T.38 passthrough is the preferred method for fax over IP. When both endpoints support T.38, Asterisk negotiates a direct T.38 session between them. The fax data travels as UDP packets using the T.38 protocol, which is specifically designed for fax retransmission and error correction over lossy IP networks. This is the mode you want for production deployments.

SpanDSP audio fax is what Asterisk uses when T.38 isn’t available at both ends. SpanDSP emulates a fax modem in software, converting fax tones to digital audio carried over standard RTP. This works but it’s sensitive to jitter, packet loss, and codec transcoding. G.711 (ulaw/alaw) is the only safe audio codec for fax — any compression codec will corrupt the signal.

Asterisk’s fax handling is provided by the res_fax module, which in turn requires either the res_fax_spandsp backend (open source, included with Asterisk) or the res_fax_digium backend (commercial). For open source deployments, you’re using SpanDSP exclusively.

What SpanDSP Actually Does

SpanDSP is a DSP (digital signal processing) library that implements fax modem emulation entirely in software. It handles the T.30 fax protocol — the handshaking, negotiation, and data transfer that fax machines speak — and exposes it to Asterisk via the res_fax_spandsp module.

When Asterisk receives an inbound fax call, SpanDSP:

  • Detects the CNG (calling fax) tone
  • Completes the T.30 handshake with the sending fax machine
  • Receives the fax data stream
  • Converts the received data to a TIFF or PDF file
  • Returns the result to Asterisk’s dialplan

For outbound faxes, the process reverses: Asterisk calls the destination number, SpanDSP handles the T.30 negotiation as the calling side, and transmits the document.

SpanDSP is mature and widely deployed. The main limitation is CPU load at scale — software modem emulation is more processor-intensive than hardware fax cards, which matters when you’re handling dozens of simultaneous fax channels.

T.38: Why It Matters for Fax Over IP

Standard audio codecs are compressed and optimized for voice, which tolerates some data loss. Fax modems produce a precise analog signal that breaks immediately if even a few packets are dropped or arrive out of order. Running fax over a G.729 or Opus voice path is a reliable path to failed transmissions.

T.38 solves this by defining a dedicated real-time transport protocol for fax data. Key features:

  • Redundancy: Each T.38 packet carries a copy of the previous packet’s data, so a single dropped packet doesn’t break the transmission
  • Error correction: T.38 includes its own error correction layer separate from what the underlying IP network provides
  • Timing independence: T.38 doesn’t require the precise timing synchronization that audio fax does

ICTFax is built on FreeSWITCH with full T.38 protocol support — both T.38 passthrough for endpoint-to-endpoint sessions and T.38 termination for converting between T.38 and audio fax. This matters if your SIP trunks or fax machines don’t uniformly support T.38.

Setting Up Asterisk for Fax: What You Need

A working Asterisk fax server requires several components beyond a base Asterisk install.

SpanDSP library: Most package managers include libspandsp-dev. If you’re compiling Asterisk from source, you need SpanDSP installed before running ./configure so that res_fax_spandsp gets built. Check menuselect during the Asterisk build to confirm the module is selected.

res_fax module configuration: /etc/asterisk/res_fax.conf controls fax behavior globally — ECM (error correction mode), minimum/maximum transfer rates, modem type (V.17, V.29, V.27ter), and whether T.38 is preferred over audio. For most deployments:

[general]
ecm=yes
minrate=2400
maxrate=14400
t38timeout=5000

Dialplan integration: Fax detection and handling happen in extensions.conf using the ReceiveFax() and SendFax() applications. A minimal inbound fax handler looks like:

exten => 1234,1,Answer()
exten => 1234,n,ReceiveFax(/var/spool/fax/${UNIQUEID}.tiff)
exten => 1234,n,Hangup()

SIP trunk with T.38 support: Your SIP provider needs to support T.38 re-INVITE (the negotiation that switches a voice call to T.38 when fax tone is detected). Not all SIP trunks do this. Confirm T.38 support before choosing a provider for a fax-heavy deployment.

The Asterisk 18 installation guide on ictfax.org covers the full setup process including SpanDSP compilation, PJSIP configuration, and fax channel setup for Ubuntu/Debian systems.

Raw Asterisk vs. a Complete Fax Server

Asterisk with SpanDSP handles the transport layer — it can receive a fax call, convert it to a TIFF file, and write it to disk. That’s where the built-in functionality ends.

A production fax server also needs:

  • User management — assigning DID numbers to users, access controls, send/receive quotas
  • A web interface for sending faxes, viewing received faxes, and managing accounts
  • Email delivery — sending received faxes to user email addresses as PDF attachments
  • Fax-to-email and email-to-fax gateways
  • Audit logs and delivery status tracking
  • REST API for integration with other systems
  • Multi-tenant support if you’re serving multiple organizations or customers

Building all of this on top of raw Asterisk is a substantial development project. That’s exactly the gap that purpose-built open source fax servers fill.

ICTFax: FreeSWITCH-Based Open Source Fax Server

ICTFax is an open source fax over IP server built on FreeSWITCH and SpanDSP. It adds the complete application layer that raw Asterisk is missing: a web interface, user management, email-to-fax and fax-to-email gateways, REST API, multi-tenant support, and DID management.

The architecture uses FreeSWITCH for all media handling — fax detection, T.38 negotiation, SpanDSP modem emulation via mod_spandsp — while ICTFax handles the user-facing layer on top. You get the reliability of FreeSWITCH’s fax stack with a deployable, maintainable application rather than a collection of dialplan scripts.

Key capabilities of ICTFax on top of FreeSWITCH:

  • Send and receive faxes via web interface or email
  • T.38 and audio fax support (auto-detects per call)
  • SIP trunk integration with major providers
  • Multi-tenant with per-tenant DID numbers and user accounts
  • REST API for programmatic fax sending and status polling
  • PDF/TIFF conversion and email delivery of received faxes
  • HIPAA-compatible deployment options for healthcare environments

ICTFax is available as a community edition (open source, free) and a commercial edition with additional features and support. The installation guide covers the full setup process on Ubuntu 20.04/22.04 and CentOS/RHEL.

Common Asterisk Fax Problems and How to Fix Them

Faxes fail consistently on specific routes: Usually a T.38 negotiation failure. Check whether your SIP trunk supports T.38 re-INVITE. If not, force audio fax mode in res_fax.conf and use G.711 on those trunks — never G.729 or any compressed codec.

High failure rate on long-distance or international faxes: Latency and jitter on long-distance routes exceed what audio fax tolerates. T.38 with a trunk that supports it solves this in most cases. If T.38 isn’t available, lowering maxrate to 9600 or 7200 bps in res_fax.conf improves reliability on marginal connections.

Faxes detected as voice calls: The fax detection timer in extensions.conf may be too short. Increase the faxdetect timeout in your dialplan, or use Asterisk’s FAXOPT(faxdetect) channel variable to extend the detection window.

res_fax_spandsp.so not loading: SpanDSP wasn’t installed when Asterisk was compiled. Either recompile Asterisk with SpanDSP present, or install the asterisk-res-fax package if your distribution provides it.

Received TIFF files are corrupted: Usually indicates a codec mismatch mid-call — a transcoding step is mangling the fax audio. Confirm that the entire path from SIP trunk to Asterisk uses G.711 ulaw or alaw, with no intermediate transcoding to a compressed codec.

Asterisk Fax vs. Commercial Fax Servers

The operational difference between Asterisk-based fax servers and commercial SaaS fax services comes down to control versus convenience.

Commercial services like eFax or RingCentral Fax handle the infrastructure for you — you pay per page or per month, and faxes just work. The cost scales linearly with volume, and you have no control over data routing or storage location.

Asterisk-based solutions require more setup but give you complete control: your data stays on your servers, your transmission costs are fixed (SIP trunk rates, not per-page fees), and you can integrate fax into any internal workflow via the REST API. For regulated industries — healthcare, legal, finance — the data sovereignty argument is often decisive.

For organizations sending or receiving hundreds of faxes per month, the TCO calculation typically favors self-hosted. The top open source fax server comparison covers this analysis across the leading alternatives.

FAQ: Asterisk Fax Server

Does Asterisk support fax natively?

Yes. Asterisk includes the res_fax module which, when paired with the res_fax_spandsp backend, provides full fax send and receive capabilities. T.38 passthrough is also supported for end-to-end T.38 sessions. Fax support is built into Asterisk and doesn’t require any third-party add-on.

What’s the difference between T.38 and SpanDSP fax in Asterisk?

T.38 is a network protocol specifically designed for fax over IP, offering built-in redundancy and error correction. SpanDSP is a software library that emulates a fax modem and enables audio fax (T.30 over RTP). When both endpoints support T.38, Asterisk uses T.38 passthrough. SpanDSP is used when T.38 isn’t available at one or both ends.

Can Asterisk send fax to email automatically?

Not directly out of the box — Asterisk receives faxes as TIFF files and writes them to disk. You need additional tooling (a dialplan AGI script, or a full fax application layer like ICTFax) to convert TIFF to PDF and deliver it to a user’s email address. ICTFax handles this automatically as part of its core feature set.

Is ICTFax free to use?

ICTFax is available as an open source community edition at no cost. The source code is publicly available and can be deployed on your own Linux server. A commercial edition with additional features and professional support is also available. Both editions use the same FreeSWITCH/SpanDSP core for fax handling.

What Linux distributions does Asterisk fax support run on?

Asterisk with SpanDSP runs on any mainstream Linux distribution. Ubuntu 20.04 and 22.04 LTS and CentOS/RHEL 7/8 are the most common production environments. Ubuntu is generally easier for initial setup because SpanDSP packages are available through the standard apt repositories without manual compilation.

How many simultaneous fax channels can Asterisk handle?

This depends on the server CPU rather than any hard Asterisk limit. SpanDSP fax modem emulation is CPU-intensive — a modern 4-core server can typically handle 20-50 simultaneous fax channels comfortably. For higher volumes, distributing load across multiple Asterisk instances is the standard scaling approach.

Related Resources