For more on this topic, see our Asterisk VoIP PBX guide.
One hundred years ago, long before it became mainstream to talk about conservation and long before the so-called "carbon profile," a presumably wise engineer decided that voice signals could be carried in both directions of a telephone call over a single pair of wires. The ecological consequence of this is that we have saved uncountable tons of copper in the subsequent one hundred years. But ever since the time when the two-wire interface was introduced into the telephone local loop connection, we have had to deal with reflections in the telephone network.
Echo in the telephone network clearly preceded the introduction of the Asterisk VoIP system. Yet there are some aspects of Asterisk and VoIP in general that differentiate them from traditional telephone systems when dealing with echo.
This article begins with a brief overview of echo in the telephone network. Then we'll turn to echo cancellation as it pertains to Asterisk in particular. Then we will introduce the High Performance Echo Canceller (HPEC) that is now being deployed in Asterisk systems and compare it with the legacy Asterisk echo canceller. While comparing the legacy Asterisk echo canceller with the HPEC, we introduce many terms that need further explanation. The final portion of the article is therefore devoted to describing these features and the echo issues that necessitate the use of these features.
Echo in the telephone network
The reflection of a person's speech back into his or her earpiece is caused by hybrid circuits that convert between two-wire analog interfaces and four-wire analog interfaces, as seen in Figure 1.
(Click to enlarge)
Figure 1. The hybrid circuit in the telephone network that causes the voice signal to be reflected. Also shown is an echo canceller that is used to cancel the reflection.
At the four-wire side of the hybrid, one pair of wires carries voice signals toward the hybrid (sometimes called the receive path), and a second pair of wires carries voice signals away from the hybrid (sometimes called the send path). On the two-wire side of the hybrid, a single pair of wires carries voice signals in both directions. The echo comes about because hybrid circuits are not perfectly matched. As a result, some of the four-wire receive signal is leaked back into the four-wire send signal.
In the early days of telephony, the reflection was not yet an echo. For a person to perceive echo, the reflection must be delayed by more than a trivial amount before reaching the person's ear. As the delay approaches ten milliseconds, it begins to sound like a reverberation sound effect. When the delay exceeds twenty milliseconds, the reflection begins to sound like echo.
Echo during a phone call becomes intolerable very quickly. As the delay increases, it becomes less tolerable. But delay is not the only factor. The level of the echoed signal relative to the level of the person's speech (referred to as ERL or Echo Return Loss) is a second factor. A person may be able to tolerate an ERL of 6 dB if the delay is 15 milliseconds, but at 30 milliseconds, the ERL will have to be much better (higher) to be considered tolerable. (More specifically, ERL is defined to be the ratio of the person's speech to the level of the echo, expressed in dB. An ERL of 6 dB, for example, means that the amplitude of the echo is 6 dB below the level of the original speech.)
Referring back to Figure 1, the solution to the echo problem is the use of an echo canceller. The echo canceller in Figure 1 removes the reflection from the send signal without removing the near end speaker's voice.
Echo in Asterisk systems
For the purpose of this discussion we will discuss six types of phone connections supported by Asterisk:
- FXS – FXS
- FXS – FXO
- FXO – FXO
- FXS – Digital
- Digital – FXO
- Digital – Digital
They are shown collectively in Figure 2.
Figure 2. Asterisk fits into a telephone system with a variety of different interfaces.
Figure 2 shows three types of interfaces: FXS, FXO, and Digital. An FXS (Foreign Exchange – Subscriber) interface is a two-wire analog interface that connects to a telephone. An FXO (Foreign Exchange – Office) interface is a two-wire interface that connects to a telephone company central office. The primary differences between FXS and FXO are:
- FXS sources a battery feed. FXO sinks a battery feed.
- FXS provides ring signal. FXO detects ring signal.
- FXS detects off hook, pulse dialing, hook flash. FXO sources off-hook, pulse dialing, hook flash.
Both the FXS and FXO interfaces are sources of echo because both include a hybrid circuit that performs two-wire to four-wire conversion.