Thursday, October 29, 2009

Introduction to Digital Circuits

Digital circuits have the chief advantage of allowing a much higher density of calls on a given physical connection; an analog circuit can handle only one call at a time, whereas a digital circuit can handle many.

There are two main types of digital circuits: Common Channel Signaling (CCS) and Channel Associated Signaling (CAS). CAS circuits are available in two speeds: Tl at 1.544Mbs supports 24 calls, and El at 2.048Mbs supports 30 calls. (For these values, we are assuming the calls are not compressed; more on this later). CCS circuits are designated as PRI T l , PRI E l , and BRI. A PRI Tl can support 23 calls, a PRI El 30, and a BRI only 2.

The use of a digital circuit by definition implies that the voice signal must be digitized; the conversion from analog to digital is performed by a codec. The following sections discuss the conversion of analog to digital.


Digitizing Analog Signals

There are four steps in the process of digitizing analog sound:

1. Sample the analog sound at regular intervals
2. Quantize the sample
3. Encode the value into a binary expression
4. Optionally compress the sample

Sampling could be done any number of times per second; the more samples taken per second, the higher the audio quality, but the amount of digital data produced is much larger. Nyquist's theorem states that the sampling interval should be 2x the highest frequency of the sample to produce acceptable audio quality during playback. Because the highest frequency in human speech that we want to reproduce in telephony is around 4000 Hz, the sampling rate for standard tollquality digital voice is 8000 intervals per second. By contrast, CD music audio, which must encode both much higher and much lower frequencies, samples at about 192,000 times per second.


Quantizing refers to making a digital approximation of an analog waveform. Imagine drawing an arc on a chessboard; if you had to define the arc using only the square it was in for each row (segment) and column (interval), you would end up with a stepped pattern that was sort of close to the original arc but not exact. This is exactly the process that happens with quantization: the codec chooses a segment value that is as close as possible to the analog value at the interval it was sampled, but it cannot be exact. To make the quantization more accurate, each sample is divided into 16 intervals that are adjusted to more closely match the sampled wave. Furthermore, the segments are actually more fine-grained at the origin than at the high and low ranges. This is because most of the human speech we are trying to capture accurately is in this center range of the scale; there are fewer sounds at the very highest and lowest values.


Encoding the signal is a simple process. We have a single 8-bit code word to identify whether the analog signal was a positive or negative voltage, what value the signal was quantized to (which segment), and finally, which interval is represented by the code word. The first bit identifies either positive voltage (1) or negative (0). The next three bits represent the segment. There are eight segments in the positive range and eight segments on the negative range, so three bits provide the necessary encoding for the quantization. The last four bits identify the interval. A code word example is shown next:

1 0 0 1 1 1 0 0

In this case, the first 1 indicates a positive voltage; the next digits of 001 indicate this is the first segment (on the positive side), and 1100 indicates the twelfth interval.

The code word is 8 bits; we generate a code word 8000 times per second (the sample rate). This gives us a bitrate output of 8 x 8000 = 64,000 bps (64 kbps). The process we just described is known as Pulse Code Modulation (PCM) and is the standard for uncompressed digital voice in telephony. One voice stream thus requires 64k of bandwidth for transport.

Compression is not a required step, but it is often done to save bandwidth in VoIP environments. The two main types of compression we are concerned with are the following:
  • Adaptive Differential PCM (ADPCM): This method does not send entire code words, but instead sends a smaller code that represents the difference between this word and the last one sent. This is not commonly used today, because it produces lower voice quality and compresses down only to about 16 kbps.
  • Conjugate Structure Algebraic Code Excited Linear Prediction (CS_ACELP): As the name suggests, this is more complex compression. Based on a dictionary or codebook of known sounds made by a standardized American male voice, the digital sample is analyzed and compared to the dictionary. The dictionary code that is the closest to the sample is sent. The codebook is constantly learning. The output of this compression is typically 8 kbps—withvery little degradation of voice quality. This compression is widely used in VoIP.

Time Division Multiplexing (TDM)

TDM is the primary technology used in traditional digital voice; it is also extensively used in data circuits. The basic premise is to take pieces of multiple streams of digital data and interleave them on a single transmission medium.


T1 Circuits

On a Tl circuit, there are up to 24 channels available for voice. 64k from conversation 1 is loaded into the first Tl channel, then 64k from the conversation 2 is loaded into the second channel, and so on. If not enough conversations exist to fill the available channels, they are padded with null values. The 24 channels are grouped together as a frame. Depending on the implementation, either 12 frames are grouped together as a larger frame (called SuperFrame or SF), or 24 frames are grouped together (called Extended SuperFrame or ESF). T l s are typically full duplex, with two wires sending and the other two wires receiving.


E1 Circuits

An El is very similar to a T l . There are 32 channels, of which 30 can be used for voice. (The other two are used for framing and signaling, respectively.) The 32 channels are grouped together as a frame, and 16 frames are grouped together as a multiframe. El circuits are common in Europe and Mexico, with some El services becoming available in the United States.


Channel Associated Signaling (CAS)—T1

Although the 64 k channels of a Tl are intended to carry digitized voice, we must also be able to transmit signaling information, such as on-hook and off-hook, addressing, and so forth. In CAS circuits, the least significant bit of each channel in every sixth frame is "stolen" to generate signaling bit strings. SF implementation takes 12 frames and creates a SuperFrame. Using one bit per channel in every sixth frame gives two 12-bit signaling strings (known as A and B) per SuperFrame. The A and B strings are used to signal basic status, addressing, and supervisory messages. In ESF, 24 channels are in an Extended SuperFrame, which gives A, B, C, and D signaling strings. These can be used to signal more advanced supervisory functions.

Because CAS takes one bit from each channel in every sixth frame, it is known as Robbed Bit Signaling (RBS). Using RBS means that a slight degradation occurs in voice quality because every sixth frame has only 7 instead of 8 bits to represent the sample; however, this is not generally a perceptible degradation.


Channel Associated Signaling (CAS)—T1

El signaling is slightly different. In an El CAS circuit, the first channel (channel 0 or timeslot 1) is reserved for framing information. The 17th channel (channel 16 or timeslot 17) contains signaling information—no bits are robbed from the individual channels. Timeslots 2-16 and 18-32 carry the voice data. Each channel has specific bits in timeslot 17 for signaling. This means that although El CAS does not use RBS, it is still considered CAS; however, the signaling is outof-band in its own timeslot.


Common Channel Signaling (CCS)

CCS provides for a completely out-of-band signaling channel. This is the function of the D channel in an ISDN PRI or BRI implementation. The full 64 k of bandwidth per channel is available for voice; instead of generating ABCD bits, a protocol known as Q.931 is used out-of-band in a separate channel for signaling. An ISDN PRI Tl provides 23 voice channels of 64 k each (called Bearer or B channels) and one 64 k D (for Data) channel (timeslot 24) for signaling. An ISDN PRI El provides 30 B channels and 1 D channel (timeslot 17); an ISDN BRI circuit provides two 64 k B channels and one D channel of 16 k.

Saturday, October 17, 2009

Introduction to Analog Circuits

Analog (in contrast to digital) circuits are still the most common telephone connections worldwide. The phone line to a North American home is most commonly an analog loop circuit, although more and more digital phone services are being installed. Cisco gateways must connect to various analog services to place calls to the PSTN; the analog circuits that Cisco supports are Foreign Exchange Station (FXS), Foreign Exchange Office (FXO), and Earth and Magneto (E&M). This section examines the components of an analog telephone and the signaling methods used by analog circuits.


Components of an Analog Phone

An analog phone includes the following components:
  • Receiver: The handset speaker
  • Transmitter: The handset microphone
  • 2-wire/4-wire hybrid: Converts 2-wire from the CO to 4-wire in the phone
  • Dialer (tone/pulse): The dialing keypad or rotary dial
  • Switch hook: The switch that closes/opens the circuit (off-hook/on-hook)
  • Ringer: Sounds to indicate inbound call

Foreign Exchange Station

An FXS port connects directly to an analog phone or fax machine. Switches (including CO switches and PBXs) and Cisco gateways will have FXS ports to connect an analog phone. The switch or FXS gateway port must provide power, call progress tones, and dial tone to the analog device. An FXS port on a gateway is also the direct connection to the VoIP network and consequently also contains a coder-decoder (Codec) to convert the analog signal to digital for packetization. Alternatively, a Cisco Analog Telephony Adapter can serve as a remote FXS-to-Ethernet converter to connect an analog station to the VoIP network.

Foreign Exchange Office

An FXO port connects to the PSTN CO switch. If you want to connect your gateway router to the phone company over standard analog lines (that you could plug your analog phone into), you use FXO ports. These ports allow the gateway to place and receive calls to/from the PSTN. FXO ports also include a codec.


Loop-start signaling is commonly associated with local loop circuits (such as an analog line to the PSTN); it is seldom seen on trunk connections. A local loop is a two-wire service that uses very simple electrical signaling; remember that this technology has been in use and substantially unchanged for 100 years!

Following is the loop-start process:

1. A phone that is on-hook breaks the electrical circuit; we say opens the circuit. No electricity can flow because of the open circuit.

2. When the receiver is lifted, the circuit closes and electricity flows. This current is -48V DC. The CO switch that is connected to the local loop detects the current flow and interprets this as an attempt to place a call—we say "seize a circuit." The CO switch plays dial tone down the line to the phone as an indication that it is prepared to collect digits.

3. If the phone is on-hook and the CO switch has a call inbound for it, the CO switch applies 90V AC current to the open circuit; because it is AC, the current can be applied even on the open circuit. By the way, this is why you should not have an analog phone near the bath. The DC voltage won't do much, but you will definitely know it if the phone rings and you get zapped by the AC voltage.

Loop-start works very well for homes or other lightly used circuits, but if it is in constant use, a problem known as glare can occur; this refers to both ends of the circuit being seized at the same time, so that you pick up the phone and there is a caller on the line at the same moment, by coincidence.


Ground-Start Signaling

Ground-start signaling is an adaptation of loop-start. Instead of the circuit being closed only at the phone end, both ends of the circuit have the capability to detect current, and both ends can request and confirm the use of the circuit. This is achieved by both ends being able to ground one of the wires in the circuit. These wires (or leads) are referred to as Tip and Ring. These terms date back to the use of 1/4-inch jacks with a positive contact at the tip and a negative conductor in the ring. The advantage is that it makes glare much less likely, and consequently ground-start is appropriate for trunk connections that are heavily used. However, it is very rare to see a ground-start trunk in a VoIP network or indeed in any new trunk deployment.

The ground-start process as it occurs on a trunk between a PBX and the CO switch is described next; refer to the diagram for each step:

1. The PBX has a call that it must send to the PSTN. It signals to the CO switch that there is an inbound call by grounding the ring lead.

2. The CO senses the ring lead as grounded and grounds the tip lead to signal the PBX that it is ready to receive the call.

3. The PBX senses the tip ground and closes the loop between tip and ring in response; the PBX also removes the ring ground.

4. The voice circuit is complete, and communication can begin.


E&M Signaling

Variously called "Ear and Mouth," "RecEive and TransMit," and "Earth and Magneto," E&M analog trunks were typically used to interconnect PBXs (tie-trunks). E&M connections have separate leads for signaling and voice; the signaling leads are known as the E and M leads.

In an E&M connection, one side is called the trunk side; this is usually the PBX side. The other side is called the signaling-unit side; this is the CO, channel-bank, or Cisco gateway E&M interface. The E lead is used to indicate to the trunk side that the signaling-unit side has gone off-hook; conversely, the M lead is used to indicate to the signaling-unit side that the trunk side has gone off-hook.

Five types of E&M signaling exist, numbered Type I through Type V. In a Cisco Gateway application, Types II and V can be connected back-to-back and Type I cannot be. Cisco does not support Type IV.

Three main techniques are employed in E&M circuit signaling:
  • Wink Start: The terminating side (for example, a Cisco Gateway) uses a brief off-hook-on-hook "wink" to acknowledge that the originating side (for example, a PBX) has gone off-hook. Upon receipt of the wink, the originating side begins sending digits. When the far-end device answers the call, the terminating side goes off-hook and the voice circuit is then set up.
  • Immediate Start: The originating side goes off-hook, waits a set time (perhaps 200ms), and then begins sending digits whether or not the terminating side is ready.
  • Delay Dial: Assume that a PBX is placing a call outbound to the PSTN: First, the PBX goes off-hook. The CO then goes off-hook until it is ready to receive digits; it then goes on-hook. (This time period is the delay dial signal.) The PBX sends digits. When the far-end device answers the call, the CO goes off-hook (called Answer Supervision), and the voice circuit is then set up. The advantage of Delay Dial is that some equipment is not ready to receive digits instantly, even though it has sent the wink; the delay compensates for this.

Tuesday, October 6, 2009

Understanding Traditional Telephony

The PSTN, or Public Switched Telephone Network, is made up of Central Office switches to which subscriber lines are connected. The CO switch is programmed so that it knows which phone number (subscriber line) is attached to a particular port. If the number called is not on the local switch, the call is routed over an interoffice trunk to another switch, which may have the called subscriber line connected directly to it or may in turn route the call to other CO switches. Telephone numbering plans are organized so that calls are routed efficiently through the switch system to the correct destination switch.

Note that for our purposes, a line connects to a single phone number and supports one call at a time, whereas a trunk interconnects two switches and supports multiple calls at a time.


Business Telephony Systems

Businesses have more elaborate requirements of the telephone beyond simply placing calls. Over time, two main types of business systems have evolved: the PBX and the Key System. Both have their place, and both offer calling features that make it easier to carry on business both internally and externally with staff, customers, and suppliers.


Business telephone systems often use a Private Branch Exchange (PBX) switch, usually located in their building. The PBX is configured in much the same way as the PSTN CO switch: it holds the dial plan for all numbers within the business, and external calls are routed over a CO trunk to the PSTN CO switch if the called number is not on the PBX. As a business grows, it is common to install another PBX in another location or building and set up a special trunk (called a tie-line or tie-trunk) between the PBXs so that calls to the remote location are still internal numbers (typically 4- or 5- digit numbers) instead of PSTN calls.

A PBX consists of a control plane (the "brain"), a terminal interface that connects phones to the features they want to use, a switching engine that determines which port to route a call out, line cards to connect to phones, and trunk cards to connect to the PSTN or to tie trunks to other PBXs. PBXs come in a variety of sizes, supporting from 10 to 20,000 phones. All PBXs offer basic calling features, with additional advanced features optional based on hardware capability and licensing. These features typically include Hold, Transfer, Conference, Park, Voice Mail, and so forth.

Key Systems
Smaller businesses will sometimes use a key system. A key system is like a PBX in that it controls a group of local phones, but key systems tend to have fewer features than PBXs. One characteristic of key systems that many businesses specifically request is distributed answering from any phone; that is, all the phones ring at once, and whoever is able to pick up Line 2 (for example) can push the Line 2 button on any phone and take the call. PBXs don't normally do this; they have a central answering point (a receptionist or Auto Attendant) and Direct Inward Dial numbers (DIDs) if needed.


Telephony Signaling

Telephony signaling refers to the messages that must be sent to set up and tear down a phone call—that is, anything other than the actual voice. Following are the three types of telephony signaling:

  • Supervisory: Communicates the current state of the telephony device. There are three types of supervisory signals:
  • On-Hook: The phone is hung up. Only the ringer is active in this state. (Note that if the speakerphone button is pressed, this is the same as being off-hook.)
  • Off-Hook: The phone receiver is out of the cradle. This signals the phone switch (PSTN, PBX, or Key) that the phone wants to make a call; the switch sends a dial tone to indicate that it is ready to receive digits.
  • Ringing: The switch sends voltage to the phone to make it ring, alerting the user that there is an inbound call. The other end of the call hears a ringback tone.

  • Address: Communicates the digits that were dialed. Address signaling is most commonly done using Dual Tone Multi Frequency (DTMF) tones, commonly known as TouchTone dialing. The combination of tones tells the switch what number was pressed. Older systems also support pulse dialing, which is what the old-fashioned rotary dial phones used. Pulse dialing works by repeatedly opening and closing the circuit to the phone switch; the switch counts the number of pulses and interprets that as the number dialed. You might have seen in really old movies when someone picks up the phone and taps the receiver cradle repeatedly; this was how you got the attention of the operator.

  • Informational: Communicates the call status to participants in the call. Informational signals include dial tone, ringback tone, and reorder tone. These tones, and others not mentioned here, will vary from country to country. In England, for example, ringback tone sounds very different from what would be heard in North America.

Signaling System 7 (SS7)

SS7 is a global telephony standard that allows a phone call to be routed between CO switches, between long-distance carriers, and even between national telephone providers in other countries. SS7's primary role is to complete the setup and teardown of phone calls; this is quite a distinct process from the actual transport of the voice signal. In fact, the call control information in an SS7 network must traverse an entirely separate network from the voice path. The capabilities of SS7 have allowed the introduction of relatively complex value-added services, such as call screening, number portability, and prepaid calling cards.

PSTN Call Setup

To make a PSTN call, several steps occur that the caller is unaware of. The following steps refer to Figure 7.


1. The calling phone goes off-hook, closing the circuit to the local CO switch.

2. The local CO switch detects that current is flowing over the closed circuit and sends a dial tone to the calling phone.

3. Address signals (DTMF or pulse) are sent as the calling party dials the called number.

4. The local CO switch collects the digits and makes its routing decision; in this example, it uses an SS7 lookup to locate the destination CO switch.

5. Supervisory signaling indicates to the far-end trunk that a call is inbound.

6. The PBX determines which internal line the call should go to and causes the connected phone to ring.

7. The ringback tone is heard at the calling party end.

8. The called party goes off-hook, and a voice circuit is established end-to-end.

The fact that all this happens with very high reliability billions of times every day is pretty impressive. It also provides some insight into how complex it is to duplicate these functions in a VoIP system. More on that later.