Asterisk fax

Asterisk and fax calls

Fax over IP

Across the Internet even a G.711 codec fax transmission is unpredictable. An excellent discussion of why faxing and modems don't work well over VoIP can be found here. However, people often get perfectly good results on lightly loaded LANs. It still isn't perfect, as a burst of data on the LAN can still upset things, but some people get results they can live with.

Page Contents

Fax-over-Internet T.38 pass-thru functionality within Asterisk has arrived in 1.4, CallWeaver has reliable support for both T38 passthrough and T38 termination; CallWeaver is a fork of Asterisk 1.2. You should also consider Hylafax+ (or HylaFax) which runs outside of Asterisk but can be bridged using IAXModem to Asterisk; this is a robust solution when receiving calls via PRI and forwarding to iaxmodem and hylafax on localhost. Details are explained at the SpanDSP web site.
A commercial alternative is Noojee Fax (aka AsterFax) which allows you to use Asterisk to send and receive faxes normally then converts them to an email message or the other way around (email-to-fax). Another alternative is the web-based fax server from VBS.

In detail:
There are two conceptual methods of carrying virtually real-time fax-machine-to-fax-machine communication across packet networks:

  • Fax relay, in which the T.30 fax from the PSTN is demodulated at the sending gateway. The demodulated fax content is enveloped into packets, sent over the network, and remodulated into T.30 fax at the receiving end.

  • Fax pass-through, in which modulated fax information from the PSTN is passed in-band end-to-end over a voice speech path in an IP network. The following two pass-through techniques are possible:

    • The configured voice codec is used for the fax transmission. This technique works only when the configured codec is G.711 with no voice activity detection (VAD) and no echo cancellation (EC), or when the configured codec is a clear-channel codec or G.726/32. Low bit-rate codecs cannot be used for fax transmissions.

    • The gateway dynamically changes the codec from the codec configured for voice to G.711 with no VAD and no EC for the duration of the fax session. This method is specifically referred to as codec upspeed or fax pass-through with upspeed.

In addition to the methods for real-time fax transmission, a method called store-and-forward fax breaks the fax process into distinct sending and receiving processes and allows fax messages to be stored between those processes. store-and-forward fax is based on the ITU-T T.37 standard, and it also enables fax transmissions to be received from or delivered to computers rather than fax machines.

Yet another Fax-over-IP method is to use IAXmodem and Hylafax on different, distanced machines: You could run IAXmodem on the Asterisk server communicating on the loopback adapter, and HylaFAX would communicate with IAXmodem remotely using a "remote tty" service such as termpkg's termnetd and ttyd programs.

The Noojee Fax (aka AsterFax) method applies a bit of lateral thinking. It allows you to use an Asterisk server which is connected to the PSTN to act as a fax gateway to the IP network. Noojee Fax sits on the Asterisk server and operates as a translater converting the faxes to and from email messages. The fax is then sent over the IP network as an email message which eliminates all the standard problems of Fax-over-IP.
User then can send a fax from their favorite email client and receive it into their in-box. While perhaps not suitable for all usage scenarios this method covers a good percentage of the common use cases and completly eliminates the vagaries of Fax-over-IP.

T.38 relay:
In fax relay mode, gateways terminate T.30 fax signaling by spoofing a virtual fax machine to the locally attached fax machine. Unlike in-band faxing or fax pass-through, fax relay breaks down the T.30 fax tones into their specific HDLC frames (demodulation), sends the information across the voice network using the fax relay protocol (T.38), and then converts the bits back into tones at the far side (modulation). The fax machines on either end are sending and receiving tones and are not aware that a demodulation/modulation fax relay process is occurring.

Fax pass-through is the simplest technique for sending fax over IP networks, but it is not the default, nor is it the most desirable method of supporting fax over IP. T.38 fax relay provides a more reliable and error-free method of sending faxes over an IP network

Using Compressed CODECs (not)

Can I fax over a call with GSM codec compression? What about G.729? Other complex codecs?

See Steve Underwoods excellent document about how fax over IP works. Quoting from the page:
"The commonest problem with sending a FAX over VoIP networks is the easiest to deal with. A low bit rate voice codec is unable to carry a fast modem signal without severe distortion. Would you really expect an 8kbps G.729 codec to convey a 9.6kbps FAX modem signal correctly?"

Therefore, the GSM codec is never going to be appropriate for sending faxes. Besides, if you need low bitrates for your IP connection, you're likely to experience delays in the fax negotiation — which will probably result in a failed fax attempt. If you want to be able to send faxes in this way, then negotiate the fax at one end, and email the resulting TIFF graphics file to the other end.

ECM - error correction mode

Most modern fax machines with the memory to store page data are able to use Error Correction Mode (ECM) for error-free page transmission. When ECM is enabled, a fax page is transmitted in a series of blocks that contain frames with packets of data. After receiving the data for a complete page, a receiving fax machine notifies the transmitting fax machine of any frames with errors. The transmitting fax machine then retransmits the specified frames. This process is repeated until all frames are received without errors. If the receiving fax machine is unable to receive an error-free page, the fax transmission may fail and one of the fax machines may disconnect. On networks that have a packet loss rate greater than 2 per cent, fax transmissions routinely fail when ECM is enabled because of ECM's low tolerance for packet loss.

Virtual Fax - T.38

Some of th newer hardware fax devices support "IAF" (Internet Aware Fax, or smart faxes), meaning that you don't need to first interface an analog fax with an extra T.38 capable telephony adapter (ATA). Examples are "Ricoh 4420NF", "4420L" or "Okidata 5980dl".

Update Mar 2010: Attrafax has been released under GPLv2. It includes a T.38 Gateway and initially comes with a patch for Asterisk (at the time of this writing)
Update Dec 2009: For many many people, FAX over T.38 in Asterisk 1.6.0 and 1.6.1 'just works' now, using the open source solution app_fax (in comparison to the commercial "Fax for Asterisk" solution using res_fax_digium). In Asterisk 1.4 there are a lot of T.38 issues present that were solved by re-writing the negoation code in 1.6.
Update Dec 2008: T.38 gateway patch for Asterisk and 1.6
Update Oct 2008: Asterisk 1.6 implements T.38 pass-through and termination (but not gateway) with the addition of Spandsp. See the Asterisk T.38 page for detailed installation instructions.
Update Jul 2007: For a T.38 gateway you can use Asterisk 1.4's T.38 pass-through support in combination with the new OPAL (Open Phone Abstraction Library) - using t38modem (currently CVS) which now supports SIP (and not just H.323) to terminate T.38 calls. You can also use OPAL and chan_woomera to do essentially the same.
Update Oct 2006: CallWeaver, an Asterisk fork, now supports T38 fax passthrough and T38 termination up to 14400 baud, with or without ECM.
Update Feb 2006: bug/patch 5090 now contains a T.38 pass-thru patch for Asterisk v1.2.4 and SIP.
Now, if we also had a patch for at least one of the Asterisk H323 channels this patch then you could run Asterisk and Hylafax with T38modem by on the same box and terminate T.38 calls.
  • CVS as of Oct. 2005 now has very limited and experimental T.38 pass-through support for SIP (bug/patch 5090).
  • ionidea T.38 code for Asterisk 1.0.7. Be aware that it is trying to do something that is of little value to most Asterisk users. Most people want either passthrough for use with ATAs or a PSTN gateway. This offers neither, instead it provides a TKPT link between a TIFF file on an Asterisk machine, and a remote machine. Very few remote machine support TPKT, and as far as I (steveu) know not a single ATA does.

From the field

Q: Just wondering for anyone using T.38 (with any equipment), how well does it work as compared to a FAX PSTN call?

A: Our experience is that it's only as good as the T.30 implementation in your T.38 gateway, softswitch etc. Since it's really them having a conversation with the remote device, you're relying on their implementation of the fax protocol. We recently had a problem with a customer's T.38 termination service ... they had disabled ECM (Error Correction Mode) as a general policy across their devices, and as a result a lot of our customer' faxes were of degraded quality. The provider claimed that when their network started to drop packets, ECM caused the faxes to take too long to send because of all image data retransmits. Our response - fix your network!

One thing to be aware of when deciding between T.38 and the PSTN is that V.34 fax (speeds above 14,400) aren't possible with T.38, so you'll want to make sure that the money you save from (presumably cheaper) T.38 termination is greater than the money you save from spending less time on the wire. The speed boost from V.34 is larger for multi-page faxes than single-pagers, and penetration of V.34-capable machines varies from country to country and vertical market to vertical market.

ATAs with T.38: So far this biggest time consumption of my development time has been trying to deal with the poor T.38 hardware implementations which are currently available to test with (Apr 2005).

SpanDSP: Sending and Receiving Faxes with Asterisk (free & open source)

This chapter refers to Asterisk as the endpoint of a fax transmission. In these cases Asterisk has to simulate a fax machine and either do something with the just received image, or Asterisk has somehow received an image that then is to be faxed now or later.

To achieve this there are two Asterisk applications: app_rxfax and app_txfax which work on top of a library called spandsp.

AGX Extra Addons for Asterisk contains an enhanced version of app_rxfax and app_txfax for 1.4, no patching is required.

The ast_fax application (stand alone app) provides email-asterisk integration. To make life a lot easier, use the mail2fax and fax2mail bash scripts available from These 2 scripts make it easy to send and receive email (based on app_rxfax. app_txfax, and ast_fax).

Here's an example of a call to fax2mail that will e-mail a PDF version of the fax to

exten => fax,1,SetVar(FAXFILE=/var/spool/asterisk/fax/${CALLERIDNUM}.tif)
exten => fax,n,SetVar(FAXFILENOEXT=/var/spool/asterisk/fax/${CALLERIDNUM})
exten => fax,n,rxfax(${FAXFILE})
exten => fax,n,System('/usr/bin/fax2mail ${CALLERIDNUM} "${CALLERIDNAME}" FaxNum RecipName ${FAXFILENOEXT} p')

Note that 'tiff2pdf' required for converting tiff file to pdf is available in tiff version 3.6.1+

Another choice is - it only needs spandsp/app_txfax to send faxes, and accepst e-mails with PDF and TIFF attachments.

Bakelite is another fax2email / email2fax gateway based on some cron scripts and James embeddable mail server.

See also: app_rxfax mISDN Asterisk 1.4

HylaFax+ and Asterisk (free & open source)

A solution, similar to spandsp but outside of Asterisk, is the Hylafax software (or rather the Hylafax+ fork that is specialised on interoperation with IAXmodem). capi4hylafax and chan_capi will gladly coexist as long as you make sure they are listing on different (!) MSNs/DIDs/DDIs. You just tell asterisk to ignore the DIDs that are used for fax. A maximum of 1 passive card and 4 active cards are supported by Hylafax. With the help of t38modem and OPAL HylaFax can also be T.38 enabled.
RedHat users: Some useful RPM can be found An alternative (or addition) to capi4hylafax is IAXmodem (see below).
Also efax has proven to be a realiable solution.

hylafax-users Hylafax and Asterisk - Configuration report
Hylafax/Asterisk installation example


(Oct. 2005): You can get reliable fax performance with Asterisk by using the Asterisk PBX as a T1 PRI "bridge"... meaning you bring your T1 into your multi-port T1 card on your Asterisk server, and then you send all fax calls back out through a different port which terminates on a T1 faxmodem in your HylaFAX server or on a T1 channel bank that is connected to analog faxmodems.
Note: If your PRI is E1 you will also need a E1 channel bank! E1 uses alaw and T1 uses ulaw therefore if you would try E1->T1 bridging still would not work and Asterisk will transcode the channel.

However, if you don't use fax very often, don't want to use an on-line fax service, don't want to pay for a dedicated fax line, and aren't using T1 lines that the options above aren't really options at all. So for that purpose (and you are not wanting to use txfax/rxfax) I've created IAXmodem.

hardware fax T.30 <-SIP-> SIP ATA <--> Asterisk <-IAX2-> IAXmodem <--> HylaFax
hardware fax T.30 <-IAX2-> IAX ATA <--> Asterisk <-IAX2-> IAXmodem <--> HylaFax

interceptty for a remote IAXmodem

You can run IAXmodem and hylawax on diferent servers (but please do so within the same LAN, and make sure that LAN has no packet loss) using e.g. interceptty.

on PC with iaxmodem: " interceptty -q -s 'ispeed 19200 ospeed 19200' /dev/ttyIAX1 '@0:400' "
on PC with HylaFax: " interceptty -q '@' /dev/ttyIAX0 "


User comment: Sadly the Hylafax/IAXmodem combination isn't a reliable solution. After extensive testing (July/06) the short story is that Digium cards don't do fax. If the remote fax machine supports ECM then IAXmodem works well (even with Digium hardware) however experience shows that most faxes don't support ECM. The only reliable method we have found is to use AsterFax with a card which has an onboard DSP chip.
Check the Asterisk IT site for a list of compatible hardware

Reply: I don't know where that last comment is coming from, but its premise is wrong... as many hundreds of IAXmodem users could attest... and hundreds upon hundreds of thousands of faxes sent and received can substantiate. The person who wrote that was probably dealing with PCI latency issues surrounding the zaptel hardware. The zaptel driver is quite demanding on CPU attention (in order to perform software echo cancellation), and it's rather easy for a hard drive or a network card to disrupt it. On most systems there are ways to work things to give the zaptel driver/hardware the requisite attention.

User Followup: Actually I'm Brett Sutton the creator of AsterFax (now called Noojee Fax). We have between 1000 and 2000 downloads per month of Noojee Fax and run extensive test in our internal lab. Sadly the fact is that any fax service which utilizes SpanDSP is not reliable. Certainly some people get 'lucky', probably because all of the moons are aligned (or at least the timers) but as a general rule if you want to deploy a system that you know works then you cannot rely on SpanDSP or any products that do. Our main business is actually selling Asterisk based PBXs and until June 2008 we had not been prepared to ship our own systems with Noojee Fax due its lack of reliability. Finally we have just released Noojee Fax 2.0 which is the first version to come with a commercial fax driver which our extensive testing and early client experience has show works well. Noojee (formerly Asterisk IT) has held a consistent position with respect to SpanDSP reliability for the last 2 years and nothing has changed.

Developer Followup I wonder if its awfully wise to tell the world you can't get something to work well, when thousands of people can. There are some notes at about the performance that has been proven in real applications of spandsp + iaxmodem + HylaFAX+.

User Followup: Our company (an ITSP) has been using SpanDSP for our customer production fax servers since around 2005, possibly earlier. The reliability rate is good, and with the later versions of Asterisk and SpanDSP, reliability is excellent. We're particularly happy with T.38 using Asterisk 1.6 and SpanDSP. I regularly talk to many users of SpanDSP with high-volume production servers (dozens of concurrent fax calls) who have high success rates. It's not that making fax work with Asterisk is not challenging, but it does work.

Example installation - Click here for article

SIP notify on fax reception with HylaFax

Be aware: faxrcvd will be overwritten during a HylaFax software upgrade, so better move this into the file FaxDispatch or create your own faxrcvd-custom and then adjust "FaxRcvdCmd: etc/faxrcvd-custom" in your modem config

  #We use the Asterisk .call file mechanism to send a SIP MESSAGE
  #Phone model used for this example: ((SNOM 360)) with a line/identity "intercom" set up to auto-answer
  #Instead of a .call file we could make use of the tool ((sipsak)) and send a "Desktop" message
  if [ -f $FILE ]; then
      (echo "Channel: SIP/intercom"
       echo "MaxRetries: 0"
       echo "Application: SendText"
       echo "Data: HylaFax received a fax from $CIDNUMBER stored as: $FILE!"
      ) > /tmp/
      cp /tmp/ /var/spool/asterisk/outgoing/

ICTFAX , an open source Fax over IP solution

ICTFAX is an open source (GPL v 3), multi-user and web based FOIP software solution suitable for SMBs and service providers based on Spandsp, Drupal, Callweaver / Freeswitch and Astbill with advance billing capabilities , It is email to fax, fax to email gateway and supports T.38 origination and termination, T.30 origination, termination and gateway , G.711 Foip origination, termination and gateway capabilities

It is FOIP solution contrary to open source Hylafax which is based on IAXmodem technology therefore ICTFAX is free from all issues and limitations related to old modem technology

for more information please visit this ICTFAX home site

Released new version of ICTCore V 0.7.5 on March 12, 2017 with following improments
Twig based template added for gateway configurations and Application data
Data and Token libraries updated
Sip, SMTP and SMPP added as provider sub-type
Multi tasking support improved for Task and Schedule
Namespaces and PSR-4 based auto-loading support added
PhpUnit support added for unit testing

Can Asterisk act as a fax/voice switch?

The answer is simple: Yes, it can. If you Answer() the call before you Dial() an extension, Asterisk will listen for fax beeping. If the call is an fax, it will automatically jump into the fax extension IF your fax call comes in thru a ZAP channel (i.e. not a CAPI channel).

Background info: It's not the card that detects the fax. Its the builtin code in asterisk that does it (dsp.c). chan_zap.c is currently the only channel driver that uses the faxdetection but in theory it could be enabled/used in other channel drivers as well.

Sample code to receive a fax:

; Answer the line and listen
exten => s,1,Answer
; Dial an extension, let asterisk give a ringtone
exten => s,2,Dial(IAX2/3987,40,r)
; Hangup if nobody picked up within 40 seconds
exten => s,3,Hangup

; Did we get a fax?
exten => fax,1,SetVar(FAXFILE=/var/spool/asterisk-fax/${UNIQUEID}.tif)
exten => fax,2,rxfax(${FAXFILE})

Downside of this solution: The moment that somebody calls you, Asterisk picks up and it will cost him, like with any other fax/voice switch.

Sample code to send a fax:

MaxRetries: 0
WaitTime: 20

save the above into a call file then move this file to /var/spool/asterisk/outgoing

Converting a pdf to an asterisk txfax compatible TIFF:

gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg3 -sOutputFile=output.tif -f input.pdf

Zap fax detection (now DAHDI)

If you're having trouble getting fax detection on a Zap channels to work it might be because the faxdetect option in zapata.conf defaults to off. These are the valid options for faxdetect:


If you still see that the zaptel card doesn't turn of echo cancellation, then you might want to try to add a Wait(5) command in your extensions.conf after your Answer() statement and before your further fax processing.
The initially dialed extension is stored in the channel variable FAXEXTEN, which allows for individual fax2mail routing and the like.

Receive fax from remote voice menu (IVR)

It is possible to receiving fax while making an outbound call from sip/zap client -> asterisk -> remote number ie. bank voice menu, weather service etc. which say something like "press 1 for operator, press 2 to receive fax,...". If you press 2 and want spansp to receive fax while you are on the phone, use the following configuration

; zap channel that make the outbound call

;outbound call
exten => _0xxxxxxxx,1,Dial(Zap/2/${EXTEN})

; auto receive fax during outbound call
exten => fax,1,rxfax(/path/to/faxfile)

Zap and Digium card issues

April 2006: Officially, fax communications is not supported with Digium cards, because the precision of the timing and jitter is not sufficient for clean enough transmission of the fax signalling to offer 100% reliable performance. That being said, faxing generally works over bridged TDM connections. The problem you are likely having is one or both of the following:

1. The timing sync of the cards is not going to work as desired: You are taking timing from the telco (assumably) on one card, and in order for the fax bridge to work properly, you'd have to re-send that timing signal out the other card. The timing coming out of the other card (the pri_net span) is not synced to the other span — it is being generated by the internal clock on the card itself. Due to this, the timing sync is not making it from the telco to the other PBX. It is possible to sync spans across cards only with the 2 and 4-span cards using a timing cable between them. It is also possible to sync timing if you had a single dual-span card servicing both the E1s instead.

2. Less likely: the bridge across the spans is traversing the PCI bus, and system resource contention might be tainting the signal, introducing jitter, or possibly dropping frames.

Sending a fax to a SIP device

You can send faxes to SIP extensions, too. Make sure you are using g.711 (Alaw or ulaw) as your codec! Be aware that user reports show mixed results for fax machines connected to ATA devices, for some folks it works, for others it works only 50% of the time. One important aspect is to have an ATA that is able to recognize a fax and immediately turns off its internal echo cancellation routine. Next to that you might have to reduce fax speed from 9600 bit/s to 4800 bit/s in order to produce reliable results. Finally do note that Digium does not claim that Asterisk plays along well with fax transmissions...
Something like this will detect the fax and send it to your SIP device:

exten => s,1,Answer
exten => s,2,Dial(SIP/201&SIP/202)
exten => fax,1,Dial(SIP/203,30)
exten => fax,2,Congestion
exten => fax,102,Congestion

First it answers the line to allow Asterisk to listen for fax tones, then it rings our normal phones. If, however, fax tones were detected, it will go to the "fax" extention which dials our SIP device with the fax machine on it. Finally, if the fax extension is in use or doesn't answer in 30 seconds, play the congestion tone.

Success stories with SIP and IAX

(Sep. '05, Germany)
We have a lot of clients reporting that faxing through our asterisk gateway works very well. Our clients are VoIP providers, thus the typical setup is:

fax <-analog-> ATAbox <-SIP-> asterisk1 <-IAX-> asterisk2 <-PSTN-> remotefax
asterisk1_with_spandsp <-IAX-> asterisk2 <-PSTN-> remotefax

asterisk1 is the machine of the providers, which use our termination service. asterisk2 is our gateway.

We have one customer, whose customers are SOHOs with typical small PBXs, supporting 2 or 4 lines. He now puts the FritzboxFon between PSTN and their PBXs, in order to take the outbound phone traffic via VoIP, including fax. He is using as internet connectivity KabelBW, a regional cable TV provider. His setups are success stories.

Emailing a fax based on DID

For an incoming fax you can lookup the email address to send to based on the DID. Although it is possible to do a mysql lookup or even a DBGet the following example queries Active Directory for the email address via the LDAPGet Asterisk application.


exten => _123495XX,1,SetVar(NumberCalled=${EXTEN})
exten => _123495XX,2,Answer
exten => _123495XX,3,Ringing
exten => _123495XX,4,Wait(3)
exten => _123495XX,5,Macro(StdExten,${EXTEN:4})

exten => fax,1,Goto(fax,666,1)

exten => 666,1,Macro(faxreceive)
exten => h,1,system(/usr/sbin/mailfax ${FAXFILE} ${EMAILADDR} ${CALLERIDNUM})

exten => s,1,SetVar(FAXFILE=/var/spool/asterisk-fax/${UNIQUEID}.tif)
exten => s,2,LDAPGet(EMAILADDR=cidmail/${NumberCalled})
exten => s,3,rxfax(${FAXFILE})
exten => s,103,SetVar(
exten => s,104,rxfax(${FAXFILE})

What happens here is that we set the variable NumberCalled to the DID so that we can look it up in AD in macro-faxreceive. We then answer the line, generate a ringing tone and wait 3 seconds for a fax tone. If a fax is detected then we jump to the fax extension and goto the fax context. In the [fax] context we call macro-faxreceive where we use the Asterisk LDAPGet application to search for an email address associated with the DID. If there is no email address then we set a default email address although we could forward it to a hardfax with a little bit more work. Once we exit macro-faxreceive we now need to actually send our fax to the email recipient and for this we use the hangup extension exten -> h to call a shellscript. Our change of contexts ensures that the shellscript only runs after receiving a fax and not after every call.

In order for LDAPGet to do its work we need to define our query in ldap.conf:

host =
user = cn=asterisk ldap,ou=services,ou=logins,dc=somecompany,dc=com
pass = secret
base = ou=users,ou=logins,dc=somecompany,dc=com
filter = (&(object
attribute = mail

And finally the shell script used to convert the tiff to PDF and email it to our user:
If you live in an A4 country then edit /usr/bin/ps2pdfwr to add '-sPAPERSIZE=a4' to the ghostscript command line, else your received faxes will have extra whitespace added to the top and be cut short at the bottom of each page.

  1. !/bin/sh


tiff2ps -2eaz -w 8.3 -h 11.7 $FAXFILE |
ps2pdf - |
mime-construct --to $RECIPIENT --subject "Fax from $FAXSENDER" \
--attachment fax.pdf --type application/pdf --file -

Thanks to Scott Laird at for the majority of the stuff here that is not LDAP related.

If you have problem running mime-construct, you can also use uuencode instead
tiff2pdf -p letter -f $FAXFILE \
| uuencode `basename $FAXFILE .tif`.pdf \
| /usr/sbin/sendmail -f $FAXSENDER $RECIPIENT

chan_capi with active CAPI cards with on-board DSP

This is a very reliable way to send/receive faxes as all the fax negotiation and data handling is done directly by the active (!) BRI/PRI card, not the CPU. This method allows you to handle faxes up to 33.6kbits. The main drawback is the price of such cards (ex. Diva Server PRI/E1 with 30 voice/fax channels can be found at 7000 Euro. Beware, some models supports only 8 simultaneous faxes and others are voice only).

Please note that newer chan-capi versions from don't need any patches like the one below, because sending and receiving faxes is implemented just by using capicommand(sendfax|receivefax). Details can be found in the README of the chan-capi package.

AFAXD for HylaFax print client with CAPI but without HylaFax

Afaxd is written in Perl
Hylafax client accepts and faxes sent through Asterisk via SendFAX. The retrieval of received faxes is also possible.
afaxd is a first try to get hylafax-clients such as JHylaFAX ( or sendfax ( to work with the Open Source PBX Asterisk ( It implements parts of the hylafax protocol to realize this.


  • hylafax-like user authentification
  • sending faxes using chan_capi and txfax by writing call files for Asterisk
  • viewing of received faxes
  • send notification mails

This The HowTo gives in depth explanations

capiAnswerFax patch by Carl Sempla

For those of you who have a CAPI card with an on-board DSP (like some of Eicon/Dialogic Diva Server cards), this patch allows you to receive faxes. If you want to answer a channel in fax mode, use capiAnswerFax() instead of Answer() If you use Answer(), you will be in voice mode. If the hardware DSP detects a fax tone, you can switch from voice to fax mode by calling capiAnswerFax().

Example of use:
line number 123, play something, if a fax tone is detected, handle it
line number 124, answer directly in fax mode

exten => 123,1,Answer()
exten => 123,2,BackGround(jpop)
exten => 124,1,Goto(handle_fax,s,1)
exten => fax,1,Goto(handle_fax,s,1)

exten => s,1,capiAnswerFax(/tmp/${UNIQUEID})
exten => s,2,Hangup()
exten => h,1,deadagi,fax.php // Run sfftobmp and mail it.

The output of capiAnswerFax is a SFF file. Use sfftobmp to convert it. With a Diva Server card the following features are available: fax up to 33600, high resolution. Color Fax /JPEG Compression is disabled (I can't test it).

You can download the patch at :

A fix for a dead lock issue is also included (Oct 22 18:06:00 WARNING[11275]: channel.c:472 ast_channel_walk_locked: Avoided initial deadlock for 'CAPI[[contr1/173720007]/7', 10 retries!)

Sangoma cards and fax

Until recently users of Asterisk and other PC-based systems with T1/E1 connections needed a separate external analog line at an additional cost if they wanted reliable fax service. Fax machines connected to a PBX using T1/E1 connections would run inconsistently at best because the analog interface supporting the fax machine was not synchronized with the PSTN timing.

Sangoma's latest AFT hardware & firmware revisions include an option for the analog card to receive its clocking from a T1/E1 or BRI card via a simple two-wire jumper cable.

Read more: Wanpipe faxing

mISDN issues

mISDN has timing issues and is therefore not a good choice for fax operation.

SIP/IAX fax detection

If you are trying to detect faxes over IAX, SIP, or for that matter any type of channels, Newman has created NVFaxDetect and updated BackgroundDetect as NVBackgroundDetect for that purpose. We have had near perfect results on decent IAX connections using ULAW/ALAW. Fax detection utilizes Asterisk DSP and works in the same way. Once detected, faxes are sent to the fax extension — look at Zap fax detection above.

Sending faxes via e-mail

If you want to be able to send an email to a phone number without generating a call file, or logging into your Asterisk server, check out Asterisk Fax for a package which accepts e-mails with attached fax images to phone number addresses.

Even better choice is email2fax, which accepts e-mails with attached PDF or TIFF files, and faxes them to fax numbers specified in the e-mail's subject.

Yet another solution is perlfax, this is similar to email2fax, with exception that a machine other than asterisk server can used for image processing and email parsing. It can be useful if there are difficulties with installing additional software to asterisk server.

Other approaches

How about:

Commercial Fax solutions for Asterisk

AAA+ Rated Freevoice Virtual Fax Full feature fax system with broadcasting up to a million fax numbers, delivery receipts record storage and many more features. West coast, Central and East coast Hubs $29 for 10 fax lines / 1¢ minute receiving/ 3.9¢ Sending No contracts or setup fee’s. Live US Support. Call 24/7 to 800-834-8999

ICTBroadcast Fax Broadcasting Software Based On Asterisk

ICTBroadcast is a bulk fax broadcasting software solution, it can blast thousands of faxes within a minute.ICTBroadcast has built-in support for pdf and tiff document but can be easily upgraded to support any other document format. ICTBroadcast supports both T.38 fax protocol and traditional G.711 protocol.

Call4Smile Fax Broadcasting Hosted Software

Call4Smile provide a fax blasting and broadcasting services to a wide range of customers from small self employed people wishing to target local areas with a few thousand pages, to larger campaigns sending hundreds of thousands to a wider area.

Cloud ICTinnovations Hosted ICTFax Solution

Cloud ICTinnovations provide hosted ICTFax solution.It can send fax from Email to fax , web to fax and fax to email.

Highly customizable fax2email & email2fax solution

Enterprise-grade Fax Center
  • A lot of functions with installation, integration and customization services with low price (starts from $999)
  • Enterprise features, integration with other software (ERP, CRM, DocFlow, 1C), ready vertical solutions for Banks, Medical Institution and Public Sector
  • Works with such DB as Oracle DB, Microsoft SQL, MySQL, PostgreSQL
  • Queuing and simultaneously delivery with full logging and control though DB
  • Detailed and customizable reporting by email or in DB

Sipwise sip:provider PRO (commercial)

  • Class5 soft-switch with integrated iaxmodem/hylafax
  • Optionally HW-based solution with Dialogic Cards and Patton GW for T.38 support
  • Fax to email
  • Sendfax via hylafax clients (standalone, printer drivers etc) source & commercial)

  • Virtual Fax with t.38 support
  • Dedicated fax line
  • Online web gui to send and recieve faxes
  • Fax to email

Noojee Fax (aka AsterFax) (open source & commercial)

Noojee Fax, is an Email to Fax gateway capable of sending and receiving faxes without requiring any client side installation.

Noojee Fax can be installed on any Asterisk server and integrates directly with Asterisk using the Manager API.
The commercial version of Noojee Fax now supports a commercial fax driver which provides reliable fax transmission on any Asterisk supported hardware.
The open source version supports Steve Underwood's SpanDSP libraries (not considered reliable) and with support for hardware based DSP boards (100% reliable).

Noojee Fax is able to recieve a fax, convert it to a PDF before delivering the fax to a users inbox using DID combined with an ODBC, LDAP or a simple configuration file to map DID numbers to email addresses.

On the transmission side Noojee Fax suppport the conversion of simple email message as well as a large variety of file formats including:
  • Tiff
  • PDF
  • Postscript
  • MS-Word
  • MS-Excel
  • All OpenOffice file formats

Transmission of a fax is simple:
  • Compose an email message using your favorite mail client
  • Enter a 'to' address in the format <phone number>@asterfax.local
  • Type a message in the body of the email which will be used as the cover sheet
  • Optionally attach any files (MS-Word etc) which are to be transmitted after the coversheet.
  • Click Send
  • A delivery receipt will be sent to your inbox

The set of supported files can also be easily extended via a simple configuration file and appropriate third party software.
The great thing about Noojee Fax is that you can send a fax directly from MS-Word without installing any client software.

Noojee ( is pleased to a announce the release of the source for Noojee Fax - Email to fax gateway for Asterisk

If you would like to get on board and start contribution to the effort now is your chance. This is a great project which has a rapidly growing list of interested users.

June 2008 Noojee Fax 2.0 release with support for a reliable commercial fax drivers.
Noojee Fax 2.0 supports any hardware supported by Asterisk (Digium, Sangoma etc).

June 2008 AsterFax renamed Noojee Fax

April 2006 AsterFax verision 1.0 beta rc1 released
All major features are now complete. Remaining work is just identifying any remaining bugs and improvements to the installation process.

AsterFax works with both Digitial and Analog cards but for 100% reliable faxing a hardware based DSP is required (or a simple faxmodem).

We are pleased to announce the release of AsterFax 1.0 rc2.

AsterFax provides an Email to Fax gateway for the transmission of faxes using Asterisk. AsterFax builds on the services provided by Asterisk to provide a full fledged email based Fax Gateway. With AsterFax you can send and receive faxes directly from your existing email client without installing any desktop software.

AsterFax can translate a normal email message into a fax message. You simply enter the destination phone number in the 'To' address, compose your email message and click send. Its that easy.

For more formal correspondence AsterFax also supports a growing number of file formats such as PDF, Tiff, Postscript, MS-Word and OpenOffice Writer. You can either attach the file to your email message or for applications such as MS-Word and OpenOffice you can fax directly from the application by using the 'Send Email' option. The resulting email is sent as a fax message.

For incoming faxes AsterFax support routing of emails based on a Direct In Dial (DID) number. Which means that every person in an organization can have their own private fax number. AsterFax DID to email address mappings can be stored in a simple configuration file or be pulled from an LDAP repository or virtually any Database.

This release includes a number of install process improvements and minor bug fixes. The install process now creates all the working directories.

The compression scheme used in creating TIFF images has been changed to group 4 compression improving the ability to preview faxes using third party TIFF viewers.

The DefaultFaxHandler has been fixed to handle both inbound and outbound faxes.

Future releases will further improve the install process, provide an init script. We're also looking at providing the RPMs in a public yum repository.

You can download AsterFax from sourceforge at and click the 'Downloads' link on the right hand side.

The AsterFax Team

17th June 2006: AsterFax coming to Trixbox

The AsterFax team is currently working with Andrew Gills of Trixbox
(formerly Asterisk @ Home) to include AsterFax as an optional component in
Trixbox. There is still a bit of work to do but we are hoping to get it
included in the next release.

VBS Fax broadcasting or single fax system

VBS Fax Server

  • Branding for Resellers along with 50% commission!

  • Easy to use web-based GUI
  • Works as a fax broadcast system or send single fax
  • Supports multi-user mode
  • Supports both T30 and T38 FoIP
  • Installs as a Webmin module
  • Tested with the Thirdlane product (both Asterisk 1.4 and 1.6)
  • Tested with Trixbox CE (both Asterisk 1.4 and Asterisk 1.6)
  • Tested with FreePBX and PBX in a Flash
  • One of the most full-featured and easiest to use interfaces available.
  • MySQL-based product allows for scalability and rock-solid performance
  • Upload either .csv or Excel .xls spreadsheet
  • Automatically receive inbound faxes via e-mail.
  • Maintain an inbound fax DID to email address lookup table
  • Allows for unlimited fax lists with unlimited phone numbers per list
  • Advanced scheduling for daily, weekly, and monthly broadcast with start-fax and stop-fax time
  • Automatic retries for busy line, no answer, or line occupied
  • Easy setup for dialing rules. Automatically adds a dialing prefix and remove local area code from fax list
  • Automatic retries for busy line, no answer or line occupied
  • Automatically scrub duplicate numbers
  • Has a system-wide do-not-fax list
  • Has a per-user do-not-fax list
  • View existing fax queue and optionally delete selected faxes
  • View existing fax queue and optionally edit any parameter for a specific fax
  • Manage fax files.
  • Manually edit an existing fax campaign
  • Has an online help system using bubble tool-tips
  • View and edit the information associated with an existing fax file
  • The ability to start and stop the fax system with a single click
  • Start and stop the fax system on a system-wide or a per-user basis
  • The number of faxes daily is only limited by the number of phone lines allocated
  • Resumes faxes automatically next day if a fax list is unfinished in previous day
  • Deliver to an email address, a fax machine, or an extension
  • Has both a backup and a restore utility
  • Give each user either full admin privileges or on a limited per feature basis
  • Manage both sent and received fax documents
  • System-wide blacklist to block inbound fax spammers
  • Send an inbound fax to a SIP device
  • Send an inbound fax to an IAX2 device
  • Uses the system syslog facility to log events
  • Supports both Digium's FFA (commercial) and SpanDSP (open source) modules
  • Supports Digium's open source FFA modules
  • Send confirmation emails
  • Support up to 12 locally attached fax machines as destination devices
  • Assign multiple inbound fax DID's to a single user
  • Assign a user an account code to more easily track faxes and fax usage
  • Set fax header information on a per user basis
  • All inbound and outbound fax transmissions are logged
  • manually create and edit existing fax lists

Sending Faxes with Windows GUI

A program allowing a user to print to a windows printer and then fax the document through Asterisk by FTP. The printed documents can also be written to PDF or TIF.


The commercial version of the software. More information on FaxTrek


The free open source version provided as-is written in VB6. More details on Print2File

Faxing over the Internet Success using Zap + IAX2

We are successfully faxing inbound and outbound using g726 with 20ms - 60ms ping times over the internet!
I am using Asterisk 1.2.0 as a gateway to carry voice traffic and faxes over the internet to the PSTN

{fax machines} --> {pbx} --> Zap(pri) --> IAX2(Internet) --> Zap(pri) --> PSTN

I have only been able to achieve this with g726. It works and it works well.

Note: G.726 is the only lowish bit rate in common use that can handle FAX at all. It is, however, limited to 9600bps. The V.17 rates higher than 9600bps (14,400 and 12,000), and 33,600bps V.34 FAXing will not work. Even 9600bps FAX performance suffers in reliability, as it will only function if the signal coming in from the analogue sections of the call path is clean.

See also

Created by: oej, Last modification: Wed 28 of Feb, 2018 (22:37 UTC) by tahiralmas
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+