⬆️ ⬇️

Fax in the City (T.38)

If on some terrible day you are faced with sending faxes over an ip-network, then, I hope, my first article will help you a little. In it I will try to consider the logic of sending faxes and some problems that I and my colleagues had to face. I would also like to see the valuable comments of the communicators and the amendments, in case of my inaccuracy.



image


We will look under the cat:



1. What is fax?

2. What is faxing?

3. What is faxing to IP?

4. What to do if faxes do not go



First, let's see what a fax is.

')

Fax, facsimile (not facsimile) is a technology for transmitting still images over a telephone line. The method is equally suitable for transmitting both graphic and alphanumeric information.


The principle of faxing



A fax machine (fax) is a rather complicated device. But the principle of its operation is quite simple and similar to the principle of operation of the TV. The transmitting fax machine has light-sensitive elements. They fall on the image. But these elements read a very narrow strip of the document - a string. Electronics converts the signals from this light-sensitive element and transmits to the line.



The transfer is carried out by pages, and the page is transferred line by line, and the line is not a string of characters, but a row of pixels (points). The transmission uses hardware data compression, which allows to reduce the size of the transmitted data by 80-90%, and thus reduce the cost of transmission.



There are several compression algorithms — the classical (one-dimensional) modified Huffman method, the R algorithm (two-dimensional), and the MMR algorithm — a modification of the R algorithm.



The error is most often caused by a burst of noise on the line. In the absence of error correction, only the number of points (pixels) is controlled, which should be fixed.



If the length of the received string is non-standard, it is considered that an error has occurred. If errors are rare - output the string "as is".



At the other end of the line, the receiving machine decrypts the message that it received from the transmitting device and puts dots on paper where necessary. Then the next line of the image is transmitted and this is repeated until the entire document is completely transmitted.



Faxing is based on digital signal processing and transmission. These devices transmit black and white images at speeds up to 14,400 bps through analog channels of the public telephone network. For data transmission over the line, faxes use different types of modulation (V.21, V.17, V.29ter), hence the different fax transmission rates. All protocols operate in half duplex data transfer mode, since the main data stream is transmitted only in one direction. Modulation is a change in a high frequency signal — a low frequency one.



The most common recommendations (modulations) for fax modems are presented in the following table:



image


The V.21 protocol is applied only at the communication establishment stage. Further, other protocols begin to work: V.17, V.27bis, V.27ter or V.29. These protocols allow the reception or transmission of a fax message in half duplex mode. It is necessary for the fax modem to support, besides V.21, at least one recommendation for data transmission over telephone lines.



Currently, almost all sold faxes are regulated by standards T.4 and T.30. Recommendation CCITT T.4 defines various parameters of fax machines: the size of a sheet of a transmitted document, resolution, direction of scanning a document, compression algorithms of transmitted graphic information. Recommendation CCITT T.30 regulates the procedure for establishing a connection, the coordination of communication parameters, the transfer of the image of the document and the completion of communication.



The figure shows the logic of the facsimile connection.



image


In the T.30 specification, the fax transmission process is divided into 6 phases, but I have simplified it to 4. I will provide basic information on the T.30 specification message at the end of the article.



Phase A. Call Establishment

The calling device transmits a CNG (Calling Tone) tone to the called device. This signal identifies the calling device as a fax machine. CNG is a repeating tone frequency signal of 1100 Hz, which is generated for 0.5 seconds and then interrupted for 3 seconds.



The called device transmits a dial tone identifying the called CED (Called Tone) device that identifies the called device as a fax machine. CED is a 2100 Hz tone, which has a duration of 2.6 to 4 seconds.



Phase B. Preliminary Reporting Procedure

In this phase, the parameters and speed of the facsimile session are determined. When the fax wants to send a new message, it first sends Preamle, lasting for 1 second. The preamble serves to improve the condition of the line. At this stage, the DIS (Digital Information Signal), and DCS (Digital Command Signal) messages are first exchanged. The DIS states the connection parameters, and the DCS acknowledges. Then the transmitting side transmits the training sequence (TCF - a sequence of zeros in 1.5 s) on a matched modulation. A CFR (Confirmation to Receive) response should be received for the sequence, if the TTF (Failure To Train) response was received for the sequence, the fax tries to lower the data rate and sends the sequence again.



Phase C. Information transfer

The phase may differ, depending on the method of transmission using ECM (error correction method) and without it. During transmission in the error control mode information is divided into blocks. These page blocks contain high-level data link control protocol (HDLC) frames that have a Frame Check Value (FCS) value that can be checked to ensure data integrity on that partial page. During transmission, the high-speed data of T.4 pages (without ECM) is transmitted one line at a time.



Phase D. End of transmission and confirmation

After each page is sent, the sending fax must notify the other fax that the sending of information is complete and is awaiting confirmation.



EOP (End Of Procedure) - end of procedure - this signal indicates that the transfer of pages is completed and that there are no more pages to transmit. The EOP should receive an MCF acknowledgment from the receiving device and send a DCN.



MPS (MultiPage Signal) - indicates the end of the page of fax information and that the recipient is ready to accept the following pages.



Now we will consider how faxes work on ip-networks



For fax transmission, either the G.711 codec or the T.38 protocol is usually used. Sending faxes using the G.711 codec corresponds to sending a fax using the T.30 protocol, as if the fax is being sent over a normal telephone line, but the analog signal from the line is digitized over alaw. This is also called Inband T.30 fax transmission.



T.38 is a protocol that describes the procedure for sending a fax over an ip network. The T.38 protocol is described by the RFC 3362 standard, and defines the procedure for the device to transmit fax data.



image


Next, the figure shows the standard sip session, where re-invite contains the transition to the T.38 codec.



image


After establishing a voice connection, the subscribers decide to send a fax. A T.38 session occurs between the 200 OK SDP (t38) and 200 OK SDP (q711A) packages when a return to vote is approved.



In the sip-packet transfer to the facsimile session (INVITE (t38) and 200OK (t38)) we are interested in the successful agreement of the T.38 parameters and the protocol itself. We look at all the parameters in the SDP (Session Description Protocol) header, for example, T38FaxVersio, T38MaxBitRate, T38FaxMaxBuffer, and so on. If the parameter is not specified, then most likely it is taken by default. The presence of an important parameter VBD (Voice band data) is also possible. In VBD mode, the gateway turns off the voice activity detector (VAD) and the comfort noise generator (CNG), which is necessary when establishing a modem connection, in short, prepares the line for data transmission over the channel. It is important that a port and a network address be assigned to receive udptl packets from each side. At this stage, the g711A codec for transmitting faxes in voice can also be announced.



image


After a successful T.38 negotiation, the facsimile session already familiar to us is available with the possibility of analysis. HDLC (High-Level Data Link Control) is used in fax protocol control messages.



Next, I will provide an example of a T.38 connection on a working network. The connection is retransmitted faxes, that is, the T.30 tones are converted into special HDLC frames on the transmission (demodulation), the reverse process (modulation) occurs at the reception. For this traise from one shoulder, it can be seen that the far side has proposed to transmit information to the DIS in V.27ter or V.29 modulation. The sending fax agreed to a 9600 speed with V.29 modulation. The maximum speed of establishing a facsimile connection and the time of packetizing T.38 packets can be set on voice gateways. Then the unsuccessful sending of a prennigovy sequence from one zeros, at a speed of 9600, followed by a distant fax cursed with an FTT message. The sending fax is forced to reduce the speed to 7200 bps, which is followed by a successful page transmission.



T.38 is a real-time fax protocol over IP networks (FAX over IP).



image


The procedure ends with EOP, MCF and DCN, which indicates a positive page submission. Some fax machines make conclusions about the successful sending of these messages without recognizing them, may give an error, although in fact the page was transferred.



I strongly recommend disabling support for ECM mode on devices or voice gateways, since it can lead to data transfer loops. ECM can only be defeated by a good line. Whether the ECM participates in a session can be determined by the parameter in the DCS packet or by the presence of accompanying packets.



The T.38 protocol makes it possible to analyze traces, unlike the transmission in the G.711A codec, where only visual analysis of frequencies is possible and it is not possible to select individual T.30 messages without the use of special tools (analyzers).



T.38 is a very generalized specification. Most modern specifications of modem protocols are really trying to clarify what should happen in the equipment. T.38 leaves a huge room for solutions during deployment in devices.



From experience, I recommend using access gateways and FXS gateways of AudioCodes and Eltex vendors.



What to do if faxes do not go?



For starters, of course, it is recommended to localize the problem. Problems may be in the banal availability of subscribers. Try to call from the subscriber A to the subscriber B, or remove the alarm debug. Check your voice quality by ear and, if possible, ping voice gateways or default gw.



It is necessary to achieve good audibility on both sides without noise - adjust the gain and attenuation at the gateway port, as well as test the line on the FXS port (capacity, resistance, etc.) and check the number of slips on E1.



What settings should be touched on voice gateways?



On the gateways, first check the relevance of the software! Almost all gateways can be configured to send faxes on the selected codec. If it is possible to choose the T.38 + G.711A fax transmission mode, then it is better to set it up, so 488 (SIP / 2.0 488 Not Acceptable Here) errors will not occur if the far side does not know the codec.



It is also possible to limit the maximum fax transmission speed, the amount of redundancy included in UDPTL packets, the packetization time, and buffer sizes. In some gateways, there is a shutdown of ECM and NSF - disable.



Support the VBD parameter check with the provider. If there is no support, disable VAD, CNG and echo cancellation.



If there is a problem of one-sided audibility when transferring a call, and a invitation to T.38 appears in the traces from somewhere, then, most likely, your music while waiting for the transfer coincided with the frequency of the fax signal. In this case, you need to correctly set the detection of faxes.



Analysis of the traces is recommended to consider from two shoulders, since the path of the packet passage itself may make changes. If shamanism with T.38 did not help, then, as an option, try to transfer faxes to pass-through. When sending faxes in voice (pass through), I recommend watching the loss of RTP packets on the channel, the level of their amplitude and jitter (it can be adjusted in most gateways).



But even the most expensive reliable and customizable gateways do not give a hundred percent guarantee of sending and receiving faxes in all directions. Why so? Quite simply, VoIP is designed for high-quality voice transmission and only that. Therefore, for a more or less acceptable transmission without distortion, codecs with a low compression ratio of G.711 are suitable only. Well, or T.38.



Moreover, not only a physical fax machine can participate in connections, but anything, for example, Asterisk, where you can set up receiving faxes directly to the mail.



Thank you for your attention, I wait in the comments for tips and comments.



Related Links



"Fax, Modem, and Text for IP Telephony", by David Hanes and Gonzalo Salgueiro

»FAX-VoIP-FAX (FoIP) T.38 fax session organization mechanism and pass-through - Ignat Kudriavtsev

" IP telephony: from copper wires to digital signal processing

» Knowledge Base

» Fax Relay Troubleshooting Guide



General T.30 specifications
CED (Called Terminal Identification) is a 2100 Hz signal transmitted by a terminal fax machine in response to a fax call. This signal temporarily disables the echo cancellers that are present in the connection in order to prepare the data line.



CFR (acknowledgment of acceptance) - the answer, which confirms that the previous exchange of messages and training completed, and that the transfer of the page by fax can be started.



CNG (ringing tone) —A tone of 1100 Hz that turns on for half a second and turns off for three seconds. This signal identifies the fax terminal as a non-voice device. The signal also indicates that the sending fax terminal is waiting for the DIS signal from the receiving fax terminal.



CRP (command replay) - a response that indicates that the previous command was received with an error and requires repetition. (Optional)



CSI (Called Subscriber Identity) - can be used to ensure the definition of the called fax terminal by international phone number. (optional)



DCN (Disconnect) - ends the fax call and does not require any response.



DIS (digital identification signal) - defines the capabilities of the called fax terminal.



DTC (Digital Transmission Command) is the response to the capabilities defined by the DIS signal. Here the calling terminal of the fax checks the compliance of its capabilities provided in the DIS message of the called fax terminal.



EOM (end of message) - defines the end of the page of information sent by fax.



EOP (end of procedure) - identifies the last page sent by fax and the absence of other pages to be sent. Transition to the phase of disconnecting a fax call.



FTT (tuning failure) —is used to reject the tuning signal and to request re-tuning (the need for re-tuning usually occurs at low modulation speeds).



MCF (message acknowledgment) indicates that the message was successfully received.



EOP (multi-page signal) - determines the end of a completed page sent by fax and the recipient’s readiness to receive additional pages.



NSF (non-standard tools) - can be used to define special features or requirements that are not defined in the T-series specifications. (Optional)



RTN (Setup Failure) indicates that the previous message was not successfully received. Reconfiguration is necessary to continue working (usually at low modulation rates).



RTP (setting accepted) — Indicates that a complete message has been received and that additional messages can be sent.



TCF (check settings) - send through a system with a high modulation rate of T.4 (compared to 300 kbit / s with the V.21 modulation used to send T.30 signals) to check the settings and establish the possibility of receiving fax pages for this transfer speeds.



TSI (Transmitter Identification) - identifies the fax terminal making the call. (optional)

Source: https://habr.com/ru/post/309920/



All Articles