(VoIP)
Kundan Singh
Columbia University
Agenda
Introducing VoIP
What does it take to build simple audio
telephony?
Inside Session Initiation Protocol (SIP)
What are the main features of SIP
VoIP services using SIP
How do we implement various services like
call transfer, auto-attendant, voicemail?
Introduction to VoIP 2
Audio Packet Transfer
Introduction to VoIP 3
Sampling, Quantization, Encoding
+127
10101111…01101101
-127
Sample at twice the Round off samples to one
highest voice frequency of 256 levels (introduces
2 x 4000=8000 Hz noise)
(interval of 125 µsec)
Introduction to VoIP 4
Problems with UDP
timeline
Sender
1 2 3 4 5 6 7
(a)
(b)
1 2 3 5 7 6
Receiver
Unreliable UDP
• Packet loss
• Out-of-order (very rarely)
• Jitter (delay variation)
Introduction to VoIP 5
Receive buffer
(playout buffer or circular buffer)
read 20 ms
sendto(remote IP:port)
packet
microphone
write 20 ms get
packet
speaker
put Received
recvfrom()
while (true) { packet
sendto(remote, buf);
… while (true) {
buf = recvfrom(...); // blocks
buf = get(20 ms);
write(au, buf); put(buf);
}
}
Introduction to VoIP 6
Receive buffer
(playout buffer or circular buffer)
Receive buffer: to absorb jitter
Tradeoff in buffer size
Adaptive delay adjustment
Sender
Sequence number: to detect packet loss; Just ignore the loss!
1 2 3 4 5 6 7 8 9 0 1 2 3 4
1 2 3 5 7 6 8 9 0 2 3 4
Receiver
3 1 2 7
2 1 2 5 7 8 9 0 2 3
1 1 2 3 5 6 7 8 9 0 2
Introduction to VoIP 7
Timestamp vs sequence number
Silence suppression
Variable length packets
Sender t1 t2 t3 t4 t5 t6 t7 t8 t9
1 2 3 Silence … 4 5 6 7
1 2 3 4 5 6 7
Receiver
Introduction to VoIP 8
Real-time Transport Protocol (RTP)
8 bits 8 bits 16 bits
IP header
V PX CC M Payload type Sequence number
UDP header
Timestamp (proportional to sampling time)
RTP Header
Source identifier (SSrc)
Introduction to VoIP 9
RTP-based conference
ssrc=5263 ssrc=7182
224.1.2.3:8000
Introduction to VoIP 10
RTP-based conference
Mixer mixes multiple streams, Transcoder converts one
and puts rtp.ssrcs of encoding to another. Typically
contributors in the mixed packet to accommodate
as rtp.csrc heterogeneous bandwidth links.
G.729
µ-law µ-law
Introduction to VoIP 11
Why do we need signaling?
8 000
1 6 . 4 9. 27:
2.
29 at 20
d G. 7 OK
w an us
in g µ-la ing
ra cal l us µ-l
a wa
INVI TE fo t1
28
. 59
. 19
Bob= re .1.
he92
W>1 Alice?
is 2.3 Alice=> . 19
1 28. 59 . 1 4
9.194
128.59.19.194
Bob 2 Alice
He
1
202.16.49.27 2. 1 128.59.19.194
nr
8 .3
y=
4. 2
>1
15
25
am
.3
S
3.
2.
81
Sam 1. Locate destination user Henry
154.28.32.112 2. Negotiate session parameters 125.33.2.81
Introduction to VoIP 12
Session Initiation Protocol (SIP)
Address similar to email sip:alice@home.com
Two stage lookup:
DNS: uses naming authority pointer and service
office.com records
Database or service logic: within a domain
Bob
home.com
Alice
columbia.edu 128.59.19.194
yahoo.com
Jane
128.59.19.61
$ dig –t naptr columbia.edu
columbia.edu. 3600 IN NAPTR 1 0 "s" "SIP+D2U" "" _sip._udp.columbia.edu.
columbia.edu. 3600 IN NAPTR 2 0 "s" "SIP+D2T" "" _sip._tcp.columbia.edu.
$ dig –t a cocoa.cc.columbia.edu
cocoa.cc.columbia.edu. 3600 IN A 128.59.59.199
Introduction to VoIP 13
SIP message format
Request
Response
SIP/2.0 200 OK
From: “Bob” <bob@office.com>
To: “Alice” <alice@home.com>
Subject: How are you?
...
Introduction to VoIP 14
Session Description Protocol (SDP)
INVITE alice@home.com
I can support µ-law and G.729
Bob Send me audio at 202.16.49.27:6780 Alice
202.16.49.27 128.59.19.194
OK; I can support µ-law
Send me audio at 128.59.19.194:8000
ACK
RTP
To port 8000
RTP
To port 6780
Introduction to VoIP 15
SDP message format and offer answer
Request
Introduction to VoIP 16
Agenda
Introducing VoIP
What does it take to build simple audio
telephony?
Inside Session Initiation Protocol (SIP)
What are the main features of SIP
VoIP services using SIP
How do we implement various services like
call transfer, auto-attendant, voicemail?
Introduction to VoIP 17
SIP is…, SIP is not …
SIP = core protocol for establishing sessions
in the Internet (peer-to-peer)
Transports session description information
from
SIP initiator (caller)
applications typically to
fall receiver (callee)
in following categories:
•Allows
setting change
up voice-over-IP calls
of parameters in mid-session
• setting up multimedia conferences
•Terminate session
event notification => IM and presence
•NOT for general
text and distribution of multimedia data
messaging
• signaling transport
NOT suitable for media gateway control
...
Introduction to VoIP 18
Addressing
Personal mobility:
yahoo.com
alice24@yahoo.com tel:12125551234
alice@columbia.edu
1234@columbia.edu
Alice.Smith@columbia.edu columbia.edu
tel:19172223333
pc12.columbia.edu
Examples:
“Alice Smith” <sip:alice@columbia.edu>
sip:alice@128.59.19.194:5070
sip:alice@columbia.edu;user=phone;transport=tcp
Introduction to VoIP 19
SIP message format
Very similar to HTTP/1.1 Requests:
Text-based, request-response INVITE, ACK, BYE, CANCEL: related
Request method operates on the to call setup and tear down
resource/entity identified in URI OPTIONS, INFO, COMET, PRACK,
Headers: SUBSCRIBE, NOTIFY, PUBLISH,
REFER, …
To, From, Call-ID, CSeq: transaction
identification Responses:
Via: response traverses the reverse Provisional: 100 Trying, 180
request path Ringing, 183 Session progress, …
Content-Length, Content-Type: Success: 200 OK, 202 Pending, …
message body information Redirection: 301 Moved
Syntax: permanently, 302 Moved
temporarily, …
White-space doesn’t matter except
in first line
Request failure: 400 Bad Request,
401 Unauthorized, 404 Not found,
Lines can be folded 480 Not available, 486 Busy here, …
Multi-valued header fields can be Server failure: 500 Internal server
combiled as a comma-list error, 501 Not implemented, …
Global failure: 600 Busy
everywhere, 603 Decline, …
Introduction to VoIP 20
Building blocks
SIP user agent Maintaining state
IP phone, PC, conference bridge,… stateless: each request and each
SIP redirect server response handled independently
Fast load balancing proxies; robust
returns new location for requests
(transaction) stateful: remember a
SIP stateless proxy whole request/response transaction
routes call requests Enterprise servers, . . .
SIP (forking) stateful proxy call stateful: remember a call from
routes call requests beginning to end
Billing, NAT traversal, . . .
SIP registrar
accepts name to address mapping
Location server
maintains name to address mapping
Introduction to VoIP 21
Message routing
Response follows the reverse request path
Via header in SIP message records the request path
Via: c.yahoo.com
Via: b.example.com Via: b.example.com
Via: a.home.com Via: a.home.com Via: a.home.com
Introduction to VoIP 22
Example call setup
(9) ok Alice
@residence.net (8)
(10)
@visiting.com
(13)
(6)
unavailable (7) (6)
(5)
(3) invite (4) moved
@school.edu
(12) ok
Bob
(6)
(2) moved
@home.com (11) cancel
(1) invite
@lab.school.edu
@yahoo.com
Introduction to VoIP 23
Transport
SIP can operate on any Transport reliability
packet network, reliable or Request retransmissions,
unreliable exponential back-off interval
UDP: most common INVITE different than other
Low state overhead methods
Retransmit INVITE
But small max packet size response after provisional
TCP: response was sent
Use with SSL
Connection setup overhead
Head of line blocking for
trunks (use SCTP instead)
Introduction to VoIP 24
NAT traversal
Problem: Solutions:
Smart servers
iptel.org (open)SER allows detecting
nodes behind a NAT
INVITE alice@
Use application level gateway
and media-proxy
SIP Signaling
Symmetric response routing
E=128.59.19.194:8123 for UDP (rport)
Connection reuse for TCP/TLS
(sip-outbound)
Media
REGISTER alice@iptel.org
STUN: Simple traversal of UDP
Contact: sip:alice@10.1.2.3:5060
through NAT
...
TURN: Traversal using relay
NAT
ICE: Interactive connectivity
establishment
L=10.1.2.3:5060
Introduction to VoIP 25
NAT traversal (ICE)
STUN server
1. Address gathering
stun01.sipphone.com 2. Negotiation
R=192.1.2.3:7002 3. Connectivity check
example.net
INVITE (offer)
OK (answer)
E=128.59.19.194:8123
L=10.1.2.3:8000 192.168.1.2:6000
10.1.2.3:8000
Introduction to VoIP 26
Agenda
Introducing VoIP
What does it take to build simple audio
telephony?
Inside Session Initiation Protocol (SIP)
What are the main features of SIP
VoIP services using SIP
How do we implement various services like
call transfer, auto-attendant, voicemail?
Introduction to VoIP 27
IP telephony services (PSTN)
Call routing services: pre- Multi-party features
call, one party call waiting
speed dial
call transfer (blind, consultative)
conference call
call forwarding
call park
“follow me” call pickup
call filtering/blocking music on hold
(in/out) call monitoring
do not disturb
distinctive ringing
Call handling features
autoanswer
Introduction to VoIP 28
IP telephony services (Internet)
Presence-enabled calls
place call only if callee is available
Presence-enabled conferencing
call conference participants when all are online and not busy
IM conference alerts
receive IM when someone joins a conference
Unified messaging
receive email, IM alert for new voicemails
Programmability of services
Introduction to VoIP 29
Where do the services reside?
Double ringing
sound when
Enter your
boss calls…
authentication
PIN for billing…
Make call
when boss is Proxy/registrar
online …
Endpoint
Forward to office phone
during day, and home
phone during evening…
Introduction to VoIP 30
Endpoint call control
Language for End System Services (LESS) for endpoint
service creation
Direct user interaction, direct media control
Handle converged information, e.g., call, presence, email
<less name="online_call"
require="generic presence ui">
<notification status="online" priority="0.5">
<address-switch field="origin">
<address is=“alice@home.com">
<call />
<alert sound=“ring.au"
text="Calling …" />
</address>
</address-switch>
</notification>
</less>
Introduction to VoIP 31
Network call control
Common gateway interface --
Priority.pl
SIP-CGI (RFC 3050)
SIP_FROM CGI-PROXY-REQUEST
Call processing language --
SIP_TO stdout CPL (XML-based, allows GUI)
stdin
SIP servlets (Java)
Introduction to VoIP 32
Voicemail
Call transfer
A B REFER
Blind/ consultation/
attended
C
active call
REFER C
Referred-By: B
INVITE C
Referred-By: B
BYE A
active call
Introduction to VoIP 33
B2BUA and third-party call control
Back-to-back UA B SIP
A SIP C
Incoming call triggers
outgoing call
Services INVITE
Calling card OK (SDP1)
Anonymizer ACK
INVITE (SDP1)
OK (SDP2)
ACK
INVITE (SDP2)
OK
ACK
Introduction to VoIP 34
Voicemail Endpoint based
alice@vmail.yahoo.com
SIP_FROM CGI-PROXY-REQUEST
SIP_TO stdout
stdin
Introduction to VoIP 35
Interactive voice response
using VoiceXML
Gateway VXML Browser
PSTN Internet
Telephone
Voice gateway VXML HTML Internet user
• Voice and telephony functions
• VoiceXML browser
Web server
IVR platform
• Voice and telephony functions • Service logic (CGI, servlet, JSP)
(ASR, TTS, DTMF)
• Service logic (application specific)
Introduction to VoIP 36
VoiceXML contd.
<form>
<field name=‘id’>
<form action=“url”> <prompt>
Enter your Id: Your ID, please.
<input name=‘id’> </prompt>
<input type=‘submit’> </field>
</form> <block>
<submit next=“url”/>
</block>
</form>
Introduction to VoIP 37
DTMF
PSTN Internet
SIP INFO
D
RTP/ RFC2833
Introduction to VoIP 38
Interworking with telephone network
+1-415-123-4567 sip:bob@home.com
Telephone to IP IP to telephone
Static mapping
Gateway
Telephone knows the SIP server
Telephone SIP/PSTN SIP server IP endpoint
subscriber network gateway
1-212854xxxx=>@gw1.columbia.edu
<sip:4567@gateway2.example.com
;user=phone> Gateway information is dynamic:
ENUM – Translating
audio
E164 numbering (µ-law/A-law)
(using Overlapping networks
Multiple providers
DNS) Translating signaling (PRI/T1,ISUP)
Load balancing
+1 2129397042 =>
Overlap signaling
2.4.0.7.9.3.9.2.1.2.1.e164.arp
Telephony routing over IP (TRIP)
Advanced features in
a => sip:hgs@cs.columbia.edu SIP are
lost in
Route PSTN
advertisement
Suitable for relatively “static” contacts Can be implemented in outbound proxy
Translating identifiers (phone number)
Suitable for current hierarchical network
Introduction to VoIP 39
Summary
Introducing VoIP
Basic audio transfer, why we need RTP and
SIP/SDP?…
Inside SIP
Message format, addressing, building blocks,
routing, transport, NAT traversal, …
VoIP services using SIP
Types of services, programmability, call transfer,
third-party, voicemail, interactive voice response,
telephone interworking, …
Introduction to VoIP 40
VoIP activities
IETF working groups: sip, sipping, mmusic, xcon,
p2psip, simple, impp, iptel, enum, ecrit, avt, sigtran,
midcom, …
Elsewhere: 3GPP, ITU-T, W3C, Jabber/XSF, ETSI-
Tiphon, IMTC, sip-forum, VON, …
Introduction to VoIP 41
References
SIP: RFC 3261-3265 http://www.cs.columbia.edu/sip
RTP: RFC 3550, 3551, http://www.cs.columbia.edu/~hgs/rtp
My thesis: http://www.cs.columbia.edu/~kns10/publication/thesis.pdf
(part III: Enterprise IP telephony)
Open source SIP server: http://www.openser.org
Free SIP accounts: http://iptel.org
Introduction to VoIP 42