« Believing the impossible | Main | The Secret Project »
August 27, 2005
Fax facts
As VoIP becomes more prevalent as a replacement for traditional PSTN connections, the issue of how to handle fax traffic becomes more and more of an issue. Fax imposes special demands on VoIP networks because the standards used for fax transmission are designed to exploit features of switched circuits that do not fit within the parameters of most VoIP equipment.
A fax terminal works by scanning the source image and converting it into a stream of pixels that are transmitted to the remote terminal using a data protocol called T.30. This protocol defines how the pixel data is compressed, and how to attach additional meta-data to the transmission like the source terminal number, resolution, number of pages etc. T.30 is an interactive protocol that is composed of commands and responses that allow the terminals to negotiate capabilities at run-time.
T.30 is transmitted over a switched circuit voice line by converting the bitstream into modulated tones. This is the familar warbling that you hear when you accidentally pick up on a fax call. But these tones are merely the modulation technique used to transmit the T.30 data over a fixed bandwith communications channel. The actual payload is the underlying T.30 fax commands transmitted at baud rates between 300 and 19200 baud - the tones themselves are not really important. In this regard, a fax machine is exactly the same as a data modem, except that T.30 defines the higher protocol layers rather than just providing a raw bit stream like a data modem.
T.30 tone modulation is designed to work over a circuit switched voice connection, which these days is usually a 64 kbps voice channel sampled 8000 times a second. This approximates the previous generation analogue phone technology that used a copper wire pair with an approximate bandwidth of 3100 hz. These circuit switched connections have low (and constant) latency, have no jitter, but may experience loss or dropouts. The T.30 modulation is designed for this environment - it exploits the full bandwidth of the circuit switched connection (well, as far as the modulation technology of the era allowed), and the T.30 protocol implements error detection, and error correction, to solve the drop-out and signal noise problems
Given all of this, it might seem that T.30 could be used over a G.711 VoIP connection, because these are intended to emulate ye olde analogue copper wire circuit connection just like a BRI. After all, fax is just audio tones and G.711 is (by definition) the same audio modulation used on PSTN for BRI or PRI lines. But as many people will tell you, fax over G.711 only works reliably over a LAN network, and becomes very unreliable if used over the public Internet.
So why is this?
Nobody uses G.711 for long haul VoIP because it is very susceptible to jitter due to the heavy load on the underlying network. Voice calls tend to break up unless every hop in the underlying network can easily handle the raw 64 kbps data rate, which is actually closer to 80 kbps if a frame size of 30 msec is used.
The circuit switched networks for which T.30 was designed don't have jitter, and the modulation techniques and protocols specified by T.30 contain no provision for dealing with it. Unsuprisingly then, T.30 simply can't deal with the variable jitter of a VoIP connection, although it tries (and fails) valiantly.
The problem is made worse if a codec other than G.711 is used, because most compressed codecs are based on a psycho-acoustical analysis of human speech and remove portions of the signal that, although not important to human voice communication, are vital for modulated data signals. This is the same reason why in-band DTMF tones don't work over compressed codecs, by the way.
The obvious solutions to this problem is to ensure the underlying network can support G.711 calls that are of sufficient quality to allow fax calls to work. Presumably this is what the Vonage network does, as they used to use G.711 (and may still) and they also advertised full fax functionality.
At this point, it's worth reviewing what happens when sending a fax over a VoIP connection using T.30 audio tone modulation.
The source image is converted into a stream of bits which is encoded into a stream of T.30 commands. This bit stream is then converted into an analog waveform that corresponds to an audio frequency tone with specific modulation characteristics. An approximation of this waveform is then created by sampling it 8000 times per second using a non-linear encoding (G.711), and the samples are grouped into 30ms chunks of audio data, and then transmitted over an IP network. The receiver re-assembles the received samples to recreate the analogue waveform and then demodulates it to retreive the original T.30 bit stream. The image data is then extracted from this bit stream.
In other words, the analog image is converted into T.30 digital data which is converted into an analogue waveform, which is then digitised, sent as digital data over an IP network, converted *back* into an analogue wavform, converted yet back yet again into a T.30 digital bit stream to display an approximation of the original analog image. Analog to digital to analog to digital to analog to digital to analog again. How crazy is that? I think it is amazing that it works at all!!
Fortunately, other engineers have also looked at this Rube Goldberg chain of technology and quickly understood that there is an obvious solution. Given that the T.30 command stream is already digital data, it can be sent it over an IP network as is. No need to convert it into analogue tones - just send the raw T.30 data inside IP packets. The standard that defines how this is done is the well-known, but often misunderstood, ITU T.38 standard.
In one stroke, T.38 solves most of the problems with sending fax over an IP network. A T.38 fax call uses 20% of the bandwidth than the modulated audio approach because it is now a stream of bits at an average speed of 14400 bps rather than a stream of audio samples at 64000 bps.
Reliability is now greatly increased because the portion of the decode chain that was susceptible to jitter (the analogue demodulator) is no longer needed. To increase it even further, T.38 allows for the inclusion of redundant data to prevent errors caused by the occasional loss of packets when using a transport with non-guaranteed delivery, like UDP.
As far as implementation is concerned, T.38 does not require any analog modulation or demodulation, because it is only concerned with encapsulating and de-encapsulating a raw T.30 bit stream. As such, it requires much less CPU horsepower than the audio tone approach.
T.38 should not be confused with the similar-sounding T.37 which uses a totally different approach. Whereas T.38 is intended for realtime fax transmision using an encapsulated T.30 data stream, T.37 is intended for "store and forward" applications. It requires the fax data to be converted into TIFF format and then encoded using base64 into a text message and then transmitted using SMTP.
Hopefully this article has helped dispel some of the mystery surrounding fax over IP. Efficient fax transmission over an IP network is acheived by understanding that a fax call is not about sending and receiving modulated audio tones - these are simply the legacy of the old analog phone network and it far more efficient to simply deal with underlying bit stream and send that over the IP data network instead.
Posted by CraigS at August 27, 2005 11:20 PM
Comments
WTF IS A BLOG?
Posted by: Steve McMahon at September 2, 2005 08:50 PM
Thanks for the nice explanation. Can you elaborate a little on the practical application of T.38?
If I migrate my office from analog to VoIP, how will the users be able to continue using their old fax machines that they are used to? These machines would presumably not be compatible with T.38, right? What is the standard solution to this problem?
The simplest approach that I can think of would be to replace fax altogether with a scanner and e-mail. So what is T.38 useful for in real life?
Posted by: Marcus Better at September 12, 2005 10:03 PM
Existing fax machines are intended to operate over analog phone lines, so they are not T.38 enabled. To use them with a VoIP network, you will need something that talks analog fax tones over a phone line. There is no *standard* solution to this - the solution will depend on your needs.
As described in the original article, T.38 is useful for transporting fax over an IP network.
Posted by: Craig at September 15, 2005 01:38 AM