Title: Voice over Internet Protocol VoIP
1- Voice over Internet ProtocolVoIP
- (An application of Distributed Systems)
- Barry Cheetham
2Distributed system
- Hardware software system with more than one
processing or storage element, concurrent
processes, or multiple programs running
collaboratively. - Functionality split up into parts that run
simultaneously on multiple computers
communicating with each other. - Communication may be over packetised network
links. - Varying latencies unpredictable failures occur.
- Each computer is performing many tasks in
parallel - e.g. reading from keyboard, refreshing
screen, reading from/writing to a sound
card.
3Voice
- Voice, like music, is sound.
- Variation in air pressure which travels as a wave
from speaker to listener. - (approx 300 metres per second)
- Produced by vocal cords vibrating or turbulent
flow as air is forced though the glottis and the
mouth. - Wave causes listeners ear-drum to vibrate in
sympathy - Vibration patterns processed by the brain.
- Microphone converts pressure variation to voltage
variation (analogue of pressure variation
conveyed along wires).
4Sound waveform
- Graph of voltage (representing air pressure)
against time.
- Not a sine wave.
- Sum of many sine-waves of frequency f, 2f, 3f,
4f, 5f, ..... - f is fundamental frequency in Hertz (Hz -
cycles/second) - If f 500, have sine waves of 500, 1000, 1500,
2k, 2.5kHz, ..... - How high do we need to go?
5Bandwidth
- Assumed that humans can hear up to 20 kHz.
- Recorded music on CDs has bandwidth 50 Hz to 20
kHz - In principle, speech has same bandwidth.
- Telephone quality (narrow-band) speech
filtered to 300Hz - 3.4 kHz. - Loss of naturalness but not intelligibility.
- Wideband speech filtered to 50 Hz -7.2 kHz
sounds better. - Bandwidth means frequency range - not
bit-rate!!
6Plain old fashioned telephone System (POTS)
- Originally, analogue transmission.
- Wires carried speech voltage waveforms
- Connected, by switch-board operators.
- Negligible delay ? 1 ms per 100 miles (1 ms
1/1000 second) - Circuit set up - remained connected until end of
call. - This is circuit switching it is connection
orientated. - Voice digitisation exchange to exchange
digital transmission began in 1960s. - Most telephone speech now transmitted digitally.
- Concept of circuit switching with low delay
remains in telephony. - Analogue transmission still used for last mile
from exchange to home.
7Digitisation of speech music
- Take regular samples convert to binary.
- Sampling Theorem tells us that if signal
bandwidth is 0 to B Hz, must sample at more
than 2B sample/second (Hz). - Music (50-20k Hz) sampled at 44.1 kHz with 16
bits per sample (stereo) - CD quality - Narrow-band telephone speech (300- 3.4 kHz)
sampled at 8 kHz with 8 bits per sample - 64 kb/s
log-PCM (ITU-G711) - Pulse code modulation with logarithmic
compression (small samples digitised more
accurately than larger ones) - ITU-G711 is very famous standard for speech
digitisation. - Universally used in wired telephony VoIP.
8Other standards for speech digitisation
- 64 kb/s too high for mobile telephony often for
VoIP. - Other ITU standards G726 (32 kb/s), G728
(16kb/s),
G729 (8kb/s), G723.1 (5.3kb/s), etc. - Speech compression/decompression applied by
distributed processing. - Compression is lossy (not like zip or rar).
- Mobile phones use a 9.6 kb/s speech digitisation
standard. - VoIP often uses the ITU standards.
9PC to PC voice link
- Assume 2 PCs are linked by an ideal connection
allowing voice samples to be sent in either
direction.
10PC to PC voice link first thoughts
- Assume that on each PC, an A to D converter (on a
sound card) samples speech from a microphone to
provide a single 16-bit sample when requested by
the CPU. - CPU requests samples at intervals of 1/8000
second, compresses sends off each sample via
the connection. - Both CPUs do this simultaneously.
- Each CPU receives samples, at intervals of 1/8000
s, from other side. It decompresses sends
them directly to the D to A converter to produce
sound. - Simple, but probably not viable.
11Why?
- Use of CPUs at either end to control timing of
sampling DAC processes is impractical because
they have many parallel tasks to perform. - Applies to normal operating systems such as
Linux, WIN, etc. - Use of real time operating system (RTLINUX) may
help.
12Buffers
- In practice, sound cards control their own
sampling rates - Independent crystal controlled clocks.
- Have buffers to store their inputs outputs.
- Array filled by CPU emptied by sound card, or
vice versa. - Like a leaky bucket being filled by a water
tap.
Filling with water from CPU
- Or vice versa.
- Being a little late or early not critical
now. - Transfer in blocks (use a
cup) - Bucket must not empty or overflow
Bucket with a hole in bottom
Emptying into sound card
13Accuracy of sampling rate
- Sampling rates controlled by crystals accurate to
0.01 - Nominally 8000 Hz sampling rate could be 8001 or
7999 Hz. - We would never hear difference, so why worry
about it?
8001 Hz
7999 Hz
14Lack of synchronisation
- System with slower clock receives 2 extra samples
per second. - 1200 samples in 10 mins
- Accumulates 150 ms delay could cause buffer
overflow. - System with slower clock will run out of samples
(buffer underflow). - A fundamental problem with real time distributed
systems. - Any ideas how to solve this one?
- This is real time processing.
15Connection via a network
- Replacing ideal connection by a network
link introduces new problems.
- Computer networks convey data in packets.
- Delays imperfections in link must be expected
- The person I want to speak to may be far away.
- I may not know where.
- Need a way of setting up communications (SIP).
- These are the problems of VoIP.
- Firstly, lets revisit the concept of protocol
layers.
16TCP/IP Protocol Layers
Application
Application
Transport
Transport
Network (IP)
IP layer
IP layer
IP layer
Data Link
Data Link
DLL
DLL
Link layer
Physical
Phy
Phy
Phy layer
Host 1
Routers
Host 2
17 7-layer OSI reference model
Open Systems Interconnection, by
International Standards Organisation 1983
7) Application Layer
7) Application Layer
6) Presentation Layer
6) Presentation Layer
5) Session Layer
5) Session Layer
4) Transport Layer
4) Transport Layer
3) Network Layer
3) Network Layer
2) Data Link Layer
2) Data Link Layer
1) Physical Layer
1) Physical Layer
18TCP/IP compared with OSI Ref Model
195-layer TCP/IP Reference Model
- As seen in some text-books
20Examples of protocols in each layer
- Application layerhttp, POP3, SMTP, DHCP, DNS,
IMAP4, TELNET, FTP, SIP. - Transport layer TCP, UDP, RTP, RTCP
- Network layer IP (Versions 4 6),
- Data-link layer Ethernet, IEEE802.11, etc.
- Physical layer Ethernet for wired LANs,
IEEE802.11 for wireless LANs,
PPP for modems, RS232, etc
21Network layer Internet Protocol (IP)
- Deals with addressing routing of IP packets
(datagrams)
Header (? 20 bytes)
Data (Variable length)
Version number (4 or 6) Header length datagram
length Time to live Check-sum for
header Source IP address Destination IP
address Etc.
Our payload
Note No check-sum for data. No
sequence number No time-stamp
No port numbers in header
22Check-sum CRC
- Extra bits to allow receiver to detect occurrence
of bit-errors. - Checksum sometimes means Cyclic redundancy
check (CRC) - It could mean the number of 1s but this is not
such a good idea. - In IP packets, the 16-bit checksum is the ones
complement inverse of the ones complement sum of
all 16-bit words. - What on earth could this mean?
- Consider three 8-bit numbers
- 10110101 10101010 00110011
- Normal sum of 8 bit nos 110000010
- Add in carry 10000011 (this is 8-bit
checksum) - Same idea for IP header except have 16 bit words
23Cyclic redundancy check (CRC)
- To illustrate the concept suppose header is
decimal number 139. - Divide by 7 in integer arithmetic express
remainder in binary. - Gives 19 with remainder 6 or 110 . Use 110
as check-bits. -
- Same division done at receiver.
- If we get different remainder, we know that an
error has occurred. - Exactly 3 check bits always produced.
- Generator number 7 agreed in advance
carefully chosen. - Not all combinations of bit-errors are detectable
by this method. - Any combination that adds or subtracts multiple
of 7 not detected.
2416-bit checksum in IP header
- CRCs actually use a much higher number than 7
dont divide in normal decimal arithmetic, but
in excusive or arithmetic. - But idea is similar to that illustrated on
previous slide. - 16-bit checksum allows error in IP header to be
detected at routers receiver. - If errors occur, datagram is discarded.
- Errors surprisingly rare in wired networks but
they do occur. - Bit-errors occur frequently in wireless networks.
25Network (IP) layer
- IP provides connectionless service where
datagrams are conveyed independently by routers
towards destination IP address. - Unreliable as there are no guarantees.
- Datagrams may be delayed, damaged, lost or arrive
out of order. - Different routes may be taken to same
destination. - No payload CRC or checksum for bit-error
checking. - IP is fundamental interconnect mechanism of the
Internet many private networks
26Data-link Phy layers
- Phy layer sends voltage pulses representing 1s
0s along wires or across wireless connections. - Here is the source of bit-errors that make links
unreliable. - Data link layer has responsibility for detecting,
where possible correcting, bit-errors. - Also for medium access control (MAC) when
connections are shared among many users. - Ethernet can share one wire between many users
using an elegant carrier sensing multiple
access (CSMA) mechanism implemented within the
data-link layer. - IEEE802.11 does a similar thing for a wireless
channel.
27Transport layer
- Has protocols which use the IP layer below to
achieve packetised data - transfer in a way which is suitable for
particular application layer - protocols.
- The most important are
- - TCP transmission control protocol
- - UDP user datagram protocol
- Two others, strongly related to UDP but adapted
to real time - applications, such as VoIP, are
- - RTP Real time protocol
- - RTCP Real time control protocol.
- (RTP RTCP sometimes considered to be in
application layer)
28Transport layer protocol TCP
- TCP makes use of IP to provide connection-oriented
reliable transmission. - Suited to data which cannot tolerate any
bit-errors but can tolerate some delay. - Introduces port numbers for distinguishing data
streams, sequence numbers payload check-sum
within its 20 byte header. - Reliability achieved by a mechanism for
acknowledging correct receipt retransmitting
packets when necessary. - Since this takes incurs delay and increase
congestion, TCP is not ideally suited to VoIP.
29Transport layer protocol UDP
- UDP is simpler, connectionless unreliable.
- Fire and forget
- Encapsulates following UDP datagram in an IP
datagram
Widely used for applications which dont need or
cannot wait for acks retransmissions or
where increased congestion caused would be
unacceptable.
30UDP for VoIP
- Voice not as sensitive as data to bit-errors
lost packets. - Redundancy in speech allows packet loss
concealment (PLC).
31RTP RTCP
- UDP introduces some problems.
- Packets may be lost, irreparably damaged or
re-ordered, - Receiver must know when this happens.
- Useful for transmitter to know how many of its
packets are getting through with what delay
variation. - Facilities provided by RTP RTCP.
- Described in RFC1889 Tanenbaum textbook.
- RTP adds a time-stamp to payload of a UDP
packet. - Allows need for PLC to be recognised at receiver.
- Duplicate packets must be recognised
eliminated. - RTCP sends reports to transmitter every 5 s or so
- General idea of percentage of lost packets
jitter.
32Problems discussion points
1.Since IP was designed primarily for data why is
it now being used for VoIP? 2. Why is VoIP
telephony more demanding than streaming audio
(inc. Internet radio? 3. What are the advantages
disadvantages of employing speech bit-rate
compression in (i) VoIP over wired link and
(ii)VoIP over WiFi? 4. Why are mobile VoIP over
WiFi devices traditionally power inefficient? 5.
Two mobile VoIP devices with different speech
sampling rates, 8000 8010 Hz, are communicating
20ms (G711) packets over a WLAN. How could you
avoid distortion due buffer under- and
over-flows. 6. Can VoIP data co-exist on a
WLAN? What problems can occur what solutions
have been proposed?