Tuesday, June 29, 2010

CCNA Voice 04

DSPs are used for a variety of purposes in Cisco Unified Communications. DSPs provide services like:Conferencing - Hardware-based voice conferencing which mixes multiple voice streams into one.
Transcoding - Allows conversion between compressed and non-compressed formats for compatibility.
Voice Media Termination - Acts as a voice termination point between sites.

Before compressed voice data can be sent into the internet, they must be packaged into IP packets. This packaging is done through the UDP-based RTP protocol which packages voice into 10ms samples. Usually two of this samples are packed into an RTP header. RTP stands for Real-Time Control Protocol, and just as its name suggests, is designed for real-time applications such as VoIP. RTP provide fields for:
Payload Type Identification - This identifies the payload the packet carries so it can be properly dealt by their respective applications.
Sequence Numbering - This number increments by 1 for each RTP packet sent (as opposed to each byte in TCP). The receiver can use this information to check for packet statistics.
Time Stamping - For synchronization to a linear clock and to allow jitter calculation.

RTP is typically assigned an even port from a known range between 16384-32766. This facilitates QoS features. But what about the odd numbered parts? They are actually assigned to another protocol known as RTCP. Real-Time Transport Control Protocol is used to provide feedback on the quality of the link. These include: Packet count, packet dela,y octet count, packet loss and jitter. The RTCP session is assigned a port that is 1 higher than the RTP session it's monitoring, which makes the port odd. RTCP packets are sent as a percentage of the actual link bandwidth, and it reports the NTP and RTP timestamps for the RTP session.

A typical RTP packet looks like this:

Up to layer 3, the header size would be 40-bytes (IP 20-bytes + UDP 8-bytes + RTP 12-bytes). Layer 2 would vary depending on the protocol used. Here are the common ones:
Ethernet - 18-bytes
MLP (Multilink Procedure) - 6-bytes
FRF.12 (Frame Relay) - 6-bytes
Multilink PPP - 6-bytes

G.711 and G.729 are the most commonly employed compression methods in Cisco Unified Communications. G.729 is based on the CS-ACELP (Conjugate Structure Algebraic Code-Excited Linear Prediction) compression algorithm. For 20ms worth of G.711 audio, you would need to take 160 samples per second, which results in 160-bytes of payload. G.729 provides an 8-to-1 compression ratio, effectively reducing the bandwidth requirements for 20ms worth of samples from 160-bytes for the G.711 to a mere 20-byte for the G.729.

The original G.729 is a highly complex algorithm but is extremely CPU-intensive. An alternative to G.729 is its Annex A variant which uses a medium-complexity algorithm. This results in a slightly lower audio quality but requires 25% less processing power (measured in MIPS).

Extra features like VAD and CNG can then be added to both original and Annex A variants by adding in Annex B features. The resulting codecs are G.729b and G.729ab. VAD stands for Voice Activity Detection and allows bandwidth to be saved by stopping the transmission of packets whenever there is silence. CNG on the other hand is used to locally generate white noise during times of silence to prevent users from feeling like the call has been dropped.

You'll notice that packets using G.729 codec actually have larger headers (40-bytes) than payloads (20-bytes). This effectively makes the Overhead : Payload ratio a bad 2 : 1. To remedy this, we can make use of cRTP which hashing the entire L3 header up till the payload. This effectively reduces the header size from 40-bytes to 2-bytes.

A calculation example is as follows:
Suppose you're using G.729a over Ethernet. Here is the size of a single packet carrying 20ms of samples:
Ethernet - 18
IP - 20
UDP - 8
RTP - 12
Sample 1 - 10
Sample 2 - 10

That would be a total of 60-bytes per 20ms. Multiply that by 50 to get 1 second, and you have 3000-bytes per second. Multiply that by 8 to get 24000bps.

No comments :

Post a Comment