Fax & Voip – Part 2/3 – From Vad to Clock……

fax-machineCodec Translation
I have already mentioned before. In the path caller->called codecs can change several times, and every transformation can introduce distortion and delay.

To minimize fax issues all the legs involved must be using the same codec to avoid codec translation. It is really important the kind of codec: you must use in all the path alaw or ulaw !

VAD Voice Activation Detection (VAD)
VAD is a system that detect the absence of audio and conserve bandwidth by preventing the transmission of RTP silent packets over the network.

In every device involved in the path trunk → fax device you have to disable VAD (Voice activity detection).

Real example using Patton Smartnode
…..
profile voip VOIP
codec 1 g711alaw64k rx-length 20 tx-length 20 no-silence-suppression
…..

RTP Frame size
For the voice usually the correct frame size in RTP packet is 20 mS: for the fax is preferable to use 10 mS.

Att.: Also in this case is preferable that all the path involved use the same RTP Frame size.
Att.: In general smaller packet sizes would use more bandwidth, but decrease the latency.

Echo
It is always preferable disable echo cancellation for fax calls: this decrease the signal distortion !

If it is possible you can disable echo cancellation on your gateway for fax calls.

i.e. using Cisco SPA-3102
Network Settings
Network Jitter Level = Very high
Jitter Buffer Adjustment= Disable

Audio Configuration

Preferred Codec= G711a
Use Pref Codec Only= Yes. Silence Supp Enable= No
Echo Canc Enable=No
Echo Supp Enable=No
FAX Passthru Codec=G711a
FAX Passthru Method=ReINVITE
FAX Enable T38=Yes

Fax pass-through
If it is possible to have separated/dedicated gateway for the all the path involved in the fax device, you can configure every devices with alaw, 10 mS RTP frame size and echo canc disabled etc etc.: everything I wrote above.
But… and if this is simply impossible ? How can you reconcile the fax calls with voice calls ? Infact some config are incompatible with voice calls (i.e. disable echo can increase the fax quality, but decrease the voice call).

i.e.: Your system use only one gateway ISDN-SIP connected to PSTN trunk. How can optimize codec, echo canc, etc only for fax calls and not for voice calls ?

If you are in a situation where there is one or more “shared” device between voice and fax, this devices must be able to have different configuration items to apply for voice or fax communication.

This can be obtained via the fax pass-through: many not-cheap voip devices support this feature.

In fax pass-through mode, device involved in the call initially do not distinguish a fax call from a voice call. When the device detect “fax noise” the characteristics of voip calls carrying audio signal (RTP Protocol) are changed (codec, frame size, no VAD and no echo cancellation) for the duration of the fax session.

I.e. Patton SmartNode devices.

profile voip default
codec 1 g711alaw64k rx-length 20 tx-length 20 no-silence-suppression
dtmf-relay rtp
dejitter-max-delay 200
media detection-timeout 10
fax transmission 1 relay t38-udp
fax transmission 2 bypass g711alaw64k rx-length 10 tx-length 10
fax redundancy low-speed 2 high-speed 1
fax dejitter-max-delay 100
fax bypass-method v150-vbd

In voice calls the device will be using the next part.

codec 1 g711alaw64k rx-length 20 tx-length 20 no-silence-suppression
dtmf-relay rtp
dejitter-max-delay 200
media detection-timeout 10

In fax calls the device will be using the next part, without any cho cancellation.

fax transmission 1 relay t38-udp
fax transmission 2 bypass g711alaw64k rx-length 10 tx-length 10
fax redundancy low-speed 2 high-speed 1
fax dejitter-max-delay 100
fax bypass-method v150-vbd

Packet Loss
In communications over IP networks, dropping packets is still common: here we can see a stark contrast between voice and fax communications over IP underscoring why a Voip PBX work well for voice and other types of communication, but not nearly as well for fax.

If a packet drops during an Voip based voice call, the participants will hear dead air, or a cutout for a fraction of a second, and nothing more. The VoIP call will continue, and perhaps the speaker will be asked to repeat a few words or simply does not notice.

A packet loss during a fax transmission, even just a 1 percent loss, can end the entire transmission in failure.

To mitigate this issues you can introduce Qos and/or increase the Jitter buffer in all the device involved.

Qos
To introduce Qos in a Voip system you have to configure not only all the Voip device, but also all the network equipment.
Another solution can be to separate the VoIP network from the data network, using completely different devices.
I’ll write about Qos in future posts.

Jitter buffer
Jitter is defined as a variation in the delay of received packets. At the sending side, packets are sent in a continuous stream of bits: due to network congestion, improper queuing, or others this steady stream can become lumpy, or the delay between each packet can vary instead of remaining constant.

A jitter buffer temporarily stores arriving packets in order to minimize delay variations and reorder packet received out-of-order for network issues.

When jitter of the transmitted packets exceeds what the jitter buffer can do to make up for the missing packets, audio problems are heard. For losses as small as one packet, the device or pbx involved interpolates what it thinks the audio should be: for more losses participants involved in the call will hear “dead air”.

The Voip device can use “adaptive jitter buffer”, that automatically increases and decreases capacity with increases and decreases in the jitter calculation.

A typical jitter buffer configuration is 30mS to 60mS in size. In the case of an adaptive jitter buffer then the maximum size may be set to 100-200mS.

Note that if the jitter buffer size exceeds 100mS then the additional delay introduced can lead to conversational difficulty in voice-call (in other words increase the echo and latency – (no problem for fax-call). If a jitter buffer is too small then an excessive number of packets may be discarded, which can lead to call quality degradation.

You can use packet analyzer (like Wireshark) to check if the call suffer from too much jitter, or simply you can increase the buffer jitter for fax-call (200 mS or more): like in RTP frame size case what’s good for voice-call (low jitter buffer) is not good for fax-call (high jitter buffer to avoid packet loss), but if you are lucky you can configure fax pass-through

I.e. Patton SmartNode devices.

profile voip default
codec 1 g711alaw64k rx-length 20 tx-length 20 no-silence-suppression
dtmf-relay rtp
dejitter-max-delay 40
media detection-timeout 10
fax transmission 1 relay t38-udp
fax transmission 2 bypass g711alaw64k rx-length 10 tx-length 10
fax redundancy low-speed 2 high-speed 1
fax dejitter-max-delay 200
fax bypass-method v150-vbd

Here for voice call the device will use an adaptive jitter buffer with a max value of 40 mS: for fax-call this max-value will be 200.

ISDN Clock
Sometimes happens that faxes issue are related to Clock Sync issue between TSP line and SIP-ISDN Gateway (BRI or T1/E1), named bit-slips.

To solve this issue you have to check the device log, searching for error related bit-slips or clock nonaligned.

i.e. in Patton SmartNode you can check using bit-lipts counter using the next commands.

show port e1t1 detail 5
show isdn status detail 5

…and check Bit Slips value.

Bit Slips (local clock too fast):     0
Bit Slips (local clock too slow):     43966

The only universally applicable solution to this problem is to have the ISDN gateway connected to a reference clock: this clock usually come from a PSTN connection (but you have to configure the device correctly) or other sources.

Previous Post: Fax & Voip – Part 1/3
Next Post: Fax & Voip – Part 3/3