Upgrade 3CX to v18 and get it hosted free!

Asterisk Email to Fax Service

Author image

Asterisk Email to Fax

What is Email to Fax?

Email to fax is a service where you send an email to an internal or an external mail server, and it gets converted to a fax and goes to the relative fax number. Ie [email protected] . Some service providers also allow attachments to be added, they convert that into a fax and send it out.

Email to Fax Services

Fax over IP

Codecs Required:
Across the Internet even a G.711 codec fax transmission is unpredictable. 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.

I had a customer enable the SHAW QoS option for his cable modem. We were able to fax using a LinkSys ATA using G.729.

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.

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, 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.

Summary:
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

Can I fax over a call with GSM codec compression?

You’re not going to get that working because GSM Codec is a lossy Codecs. It is able to get extreme savings in size, because it optimizes out parts of the sound that most humans don’t hear. However, that same bandwidth that humans don’t hear is exactly the bandwidth that the fax application uses to transmit valuable portions of the image.

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

High-end (?) fax machines with the memory to store page data often 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

  • Fax over IP – T.38 anyone ?
  • The closest source of information so far is this post http://lists.digium.com/pipermail/asterisk-users/2003-July/015303.html. Please add more details if you have a positive experience with setting up a virtual fax for Asterisk.

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, 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.

Fax to email

HylaFax and Asterisk

Another solution is the Hylafax software. capi4hylafax and chan_capi will gladly coexist. 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.

Asterisk 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:

[default]
; 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})

See Also

Fax to Email
Fax to Fax

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.