This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Chapter 6: Replacing the Voice Circuit with VoIP
All VoIP systems to date use equal-sized frames of the same fidelity
during each call. You’ll never have a sample rate of 8 kHz change to 12
kHz during a single session the way you could with a variable-rate
MP3, for example.
Voice packet structure
The layered appearance of a VoIP packet is similar to that of other types of net-
worked applications that run within the TCP/IP protocol: the lower layers encapsu-
late the higher layers recursively.
The lowest layer, shown leftmost in Figure 6-3, is the Internet Protocol (IP) packet
header. It contains routing information so that the packet can be handled correctly
by the devices responsible for carrying it across the network. It also contains a flag
that indicates which protocol of the TCP/IP suite this packet is carrying: TCP, UDP,
or something else. Voice packets are almost always UDP. Among other things, the IP
header may include a Type of Service flag that allows routers and switches to treat it
with a certain priority based on its sensitivity to delay. At a minimum, the IP packet
header is 160 bits in length.
The payload of the IP packet is the UDP packet, whose header is 64 bits long. Its first
32 bits contain the source and destination ports of the UDP traffic it carries in its
payload, along with 8 bits for optional error checking and 8 bits for describing the
length of its payload in multiples of 8 bits.
The payload of the UDP packet is the RTP packet, whose header is 96 bits long. It
contains information about the sequence and timing of the packet within the greater
Real-Time Transport Protocol
The Real-Time Transport Protocol (RTP) defines a simple way of sending and receiv-
ing encoded media streams
in connectionless sessions. It provides headers that
afford VoIP systems an easy way of discriminating between multiple sessions on the
same host. Remember that the codec merely describes how the digitized sample is
encoded, compressed, and decoded. RTP is responsible for transporting the encoded
sound data within a UDP datagram. RTP was designed for use outside the realm of
telephony, too: streaming audio and video for entertainment and education are com-
mon with RTP.
RTP supports mixing several streams into a single session in order to support appli-
cations like conference calling. It doesn’t, however, provide adequate controls for
defining multiplexed voice pathways that are normally associated with telephony,
like trunks. This is the responsibility of the softPBX and its signaling protocols.
* When certain signaling protocols, such as IAX, are used, RTP may not be employed to packetize the voice
stream. IAX has its own built-in voice-packetization capability.