Anda di halaman 1dari 42

Introduction to Internet telephony

(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

 Digitization (e.g., sampling at 8kHz, 16 bits per sample,


i.e, 128 kb/s or 320 bytes per 20 ms)
 Real-time compression/encoding (e.g., G.729A at 8 kb/s)
 Transport to remote IP address and port number over
UDP (Why not TCP?)
 Processing on receiver side is the reverse

Introduction to VoIP 3
Sampling, Quantization, Encoding
+127

10101111…01101101

Encode each quantized


sample into 8 bit code word

+0 PCM: 8000 x 8 bits = 64 kb/s

Other techniques (differential


coding, linear prediction)
2.4 kb/s to 64 kb/s

-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

buf = read(au,20ms); //blocks


if (!silence) playout buffer

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

Playout time vs packet loss detection

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)

msg Optional contributors’ list (CSrc)


Encoded
Audio

RTP: media transport


sendto(…, msg, …) RTCP: QoS feedback
recvfrom(…, msg, …)

Introduction to VoIP 9
RTP-based conference

ssrc=5263 ssrc=7182
224.1.2.3:8000

ssrc=2639 Session identified using ssrc=9844


receive IP address + port

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.

µ-law Mixer Transcoder


Σ µ-law
⇔ G.729

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 srv _sip._udp.columbia.edu


_sip._udp.columbia.edu. 3600 IN SRV 10 10 5060 cocoa.cc.columbia.edu.
_sip._udp.columbia.edu. 3600 IN SRV 10 10 5060 eclair.cc.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

INVITE sip:alice@home.com SIP/2.0


From: “Bob” <bob@office.com>
To: “Alice” <alice@home.com>
Subject: How are you?
...

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

INVITE sip:alice@home.com SIP/2.0


...
v=0
o=bob 26172 27162 IN IP4 202.16.49.27
s=SIP call
c=IN IP4 202.16.49.27
t=0 0 Response
m=audio 6780 RTP/AVP 0 8 5
m=video 6790 RTP/AVP 31
SIP/2.0 200 OK
...
c=IN IP4 128.59.19.194
t=0 0
m=audio 8000 RTP/AVP 0 8
m=video 0 RTP/AVP 31

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

Other entities: outbound proxy, back-to-


Typically implemented in a single back user agent (b2bua), application-level-
software or box gateway (ALG), …

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

Via: a.home.com Via: b.example.com Via: c.yahoo.com


Via: a.home.com Via: b.example.com
Via: a.home.com
alice@home.com bob@example.com bob@yahoo.com bob@ip2.yahoo.com

 Request routing decision at each hop


 Usually direct end-to-end transport after initial q=1.0
request ed
mov
 Forcing request path: Record-route and 02
INVITE 3
Route headers. q=0.7
486 busy
 Request forking: parallel vs sequential (use q-
value in Contact)
20
 Caller and callee info: further govern request 0O
K q=0.2
routing

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

Gather addresses (L,E,R) Gather addresses


10.1.2.3:8000 (local) 192.168.1.2:6000 (local)
128.59.19.194:8123 (external) 135.59.22.99:6000 (external)
192.1.2.3:7002 (relay) 192.1.2.4:9004 (relay)

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

IP-telephony can’t win by just providing what PSTN has

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…

Use finger for


locating user…
B2BUA Endpoint

Make call
when boss is Proxy/registrar
online …

Endpoint
Forward to office phone
during day, and home
phone during evening…

Service control on client vs server

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

Example: when buddy is online, make a call

<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)

if (defined $ENV{SIP_FROM} &&


$ENV{SIP_FROM} =~ /sip:boss@mycompany.com/) Urgent
{
SIP proxy Phone
foreach $reg (get_regs())
{
print "CGI-PROXY-REQUEST $reg SIP/2.0\n";
print "Priority: urgent\n\n";
} Low-priority
}

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

Various design alternatives


Redirect after 10s

alice@vmail.yahoo.com

Proxy controls Voicemail acts like a phone


vmail.pl

SIP_FROM CGI-PROXY-REQUEST
SIP_TO stdout
stdin

If no response accept after 15s

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>

Telephony, speech synthesis or audio output, user input and


grammar, program flow, variable and properties, error
handling, …

Introduction to VoIP 37
DTMF

PSTN Internet

Telephone SIP/PSTN Internet user


gateway Audio
D

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 2129397042 =>
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

 Determining transition points


+1 @service.mci.com at 4¢/min
+1212 @nyc.gw.com at 1¢/min
+1212939 @itgw1.columbia.edu free

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

Anda mungkin juga menyukai