The Session Initiation Protocol (SIP)
The Session Initiation Protocol (SIP)
May 2001
hgs/SIP Tutorial 2
Overview
• protocol architecture
• typical component architectures
• addressing and locating SIP entities
• protocol operation and extensions
• reliability
• services, features and caller preferences
• security and QoS
• programming SIP services
May 2001
hgs/SIP Tutorial 3
Introduction
May 2001
hgs/SIP Tutorial 4
Languages/APIs
JAIN CPL voiceXML
Parlay servlets
sip−cgi
QoS Transport
DiffServ IntServ RTP TLS
SCTP
May 2001
hgs/SIP Tutorial 5
application
H.323 SIP RTSP RSVP RTCP
daemon
RTP
transport
TCP UDP
network
IPv4, IPv6
kernel
PPP AAL3/4 AAL5 PPP
link
May 2001
hgs/SIP Tutorial 6
DNS next−hop
SIP SIP
signaling SDP SDP
may sets up
trigger
RSVP RSVP
media RTP RTP
UDP UDP
May 2001
hgs/SIP Tutorial 7
SIP applications
May 2001
hgs/SIP Tutorial 8
SIP addressing
May 2001
hgs/SIP Tutorial 9
Personal mobility
yahoo.com
tel:12128541111
[email protected]
columbia.edu tel:12015551234
[email protected]
May 2001
hgs/SIP Tutorial 10
SIP addressing
May 2001
hgs/SIP Tutorial 11
• also can use tel URLs for telephone numbers, e.g., tel:+12125551212 or
fax:+358.555.1234567
• either global (tel:+1...) or local
(tel:0w003585551234567;phone-context=+3585551234 numbers
• allow post-dialing digits: ;postd=pp32
• also modem:+3585551234567;type=v32b?7e1;type=v110
May 2001
hgs/SIP Tutorial 12
May 2001
hgs/SIP Tutorial 13
Back-to-back UA (B2BUA)
• two (or more) user agents, where incoming calls trigger outgoing calls to
somebody else
• also, “third-party call control” (later)
• useful for services and anonymity
200 OK
200 OK
May 2001
hgs/SIP Tutorial 14
May 2001
hgs/SIP Tutorial 15
May 2001
hgs/SIP Tutorial 16
SIP
redirect server
128.119.40.186
Internet
RTP audio
128.59.19.141
CATV
Ethernet
May 2001
hgs/SIP Tutorial 17
wonderland.com macrosoft.com
REGISTER sip:macrosoft.com SIP/2.0
To: sip:[email protected]
From: sip:[email protected]
Contact: sip:[email protected]
outbound registrar
wonderland.com
INVITE sip:[email protected] SIP/2.0 INVITE sip:[email protected] SIP/2.0
[email protected]
[email protected]
INVITE sip:[email protected] SIP/2.0
May 2001
hgs/SIP Tutorial 18
location server
TRIP
SLP?, TRIP−GW?
sip:[email protected]
sip:1−212−555−1234@domain
SIP
H.248
tel:+1−212−555−1234
outbound proxy
IP
010
May 2001
hgs/SIP Tutorial 19
enum database
DNS
4.3.2.1.5.5.5.2.1.2.1.e164.arpa
SCP enum
INVITE sip:[email protected]
IP
010
May 2001
hgs/SIP Tutorial 20
cs.columbia.edu
? location server
1
4
INVITE
cs.tu−berlin.de INVITE hgs@play 5
hgs@play
henning
[email protected] 2
3
200 OK
200 OK
[email protected]−berlin.de 6
7 play
tune
8
ACK hgs@play
9 media stream
May 2001
hgs/SIP Tutorial 21
ieee.org
? location
server
columbia.edu
1
tu-berlin.de INVITE [email protected] 2
henning
3
5 ACK [email protected]
columbia.edu
6 INVITE [email protected]
7 200 OK
May 2001
hgs/SIP Tutorial 22
May 2001
hgs/SIP Tutorial 23
registrar example.com
REGISTER
[email protected] A@ SQL, LDAP, Corba,
B@ proprietary, ...
Contact: C@
alice@pc17
location server
INVITE
[email protected] INVITE [email protected]
proxy
May 2001
hgs/SIP Tutorial 24
May 2001
hgs/SIP Tutorial 25
May 2001
hgs/SIP Tutorial 26
Outbound proxies
May 2001
hgs/SIP Tutorial 27
May 2001
hgs/SIP Tutorial 28
a.example.com
_sip._udp SRV 0 0 a1.example.com
SRV 1 0 a2.example.com
a1.example.com, a2.example.com
a*@example.com
s1.example.com
s2.example.com b*@example.com
sip:[email protected] sip:[email protected]
s3.example.com
May 2001
hgs/SIP Tutorial 29
May 2001
hgs/SIP Tutorial 30
May 2001
hgs/SIP Tutorial 31
May 2001
hgs/SIP Tutorial 32
SIP syntax
request response
message header
To: user <sip:to_user@destination>
Call−ID: localid@host
CSeq: seq# method
Content−Length: length of body
Content−Type: media type of body
Header: parameter ;par1=value ;par2="value"
;par3="value folded into next line"
blank line
message body
V=0
o= origin_user timestamp timestamp IN IP4 host
c=IN IP4 media destination address
t=0 0
m= media type port RTP/AVP payload types
message
May 2001
hgs/SIP Tutorial 33
SIP syntax
• field names and some tokens (e.g., media type) are case-insensitive
• everything else is case-sensitive
• white space doesn’t matter except in first line
• lines can be folded
• multi-valued header fields can be combined as a comma-list
May 2001
hgs/SIP Tutorial 34
SIP methods
May 2001
hgs/SIP Tutorial 35
May 2001
hgs/SIP Tutorial 36
Tagging To
May 2001
hgs/SIP Tutorial 37
May 2001
hgs/SIP Tutorial 38
SIP responses
May 2001
hgs/SIP Tutorial 39
May 2001
hgs/SIP Tutorial 40
Via: y1.yahoo.com
Via: a.example.com Via: a.example.com
INvITE
Via: a.example.com
Via: y1.yahoo.com
Via: a.example.com
Via: sip.columbia.edu
Via: y1.yahoo.com
Via: a.example.com
Via: sip.columbia.edu
Via: y1.yahoo.com
Via: a.example.com
Via: cs.columbia.edu
Via: sip.columbia.edu
Via: y1.yahoo.com
Via: a.example.com
200 OK
Via: cs.columbia.edu
Via: sip.columbia.edu
Via: y1.yahoo.com
Via: a.example.com
May 2001
hgs/SIP Tutorial 41
SIP spirals
May 2001
hgs/SIP Tutorial 42
May 2001
hgs/SIP Tutorial 43
Request routing
A PA PB B
May 2001
hgs/SIP Tutorial 44
macrosoft.com
INVITE [email protected]
CANCEL bob@c
INVITE carol@c
[email protected]
ACK 200 OK
200 OK
May 2001
hgs/SIP Tutorial 45
q=1.0
2 q=0.7
INVITE
486 Busy here
3
q=0.1
200 OK
May 2001
hgs/SIP Tutorial 46
May 2001
hgs/SIP Tutorial 47
INVITE bob@portal
100 Trying
180 Ringing
200 OK
Contact: bob@home
200 OK
CANCEL bob@work
200 OK (CANCEL)
ACK bob@work
ACK bob@home
May 2001
hgs/SIP Tutorial 48
May 2001
hgs/SIP Tutorial 49
BYE
500 ms
May 2001
hgs/SIP Tutorial 50
INVITE reliability
May 2001
hgs/SIP Tutorial 51
May 2001
hgs/SIP Tutorial 52
May 2001
hgs/SIP Tutorial 53
May 2001
hgs/SIP Tutorial 54
MGCP/SIP architecture
STP
RGW
TGW PSTN
Internet
RTP
RGW
May 2001
hgs/SIP Tutorial 55
Extending SIP
May 2001
hgs/SIP Tutorial 56
May 2001
hgs/SIP Tutorial 57
User identification
May 2001
hgs/SIP Tutorial 58
May 2001
hgs/SIP Tutorial 59
May 2001
hgs/SIP Tutorial 60
draft-ietf-sip-privacy
May 2001
hgs/SIP Tutorial 61
SIP services
May 2001
hgs/SIP Tutorial 62
Invitation modes
signaling media
unicast multicast
unicast telephony multicast session
multicast reach first dept. conference
➠ SIP for all modes, SAP/SDP also for multicast/multicast
May 2001
hgs/SIP Tutorial 63
SIP-based services
May 2001
hgs/SIP Tutorial 64
Call transfer
B1
3 BYE A
1 REFER B2
Referred−By: B1
A
2 INVITE B2
Referred−By: B1
B2
May 2001
hgs/SIP Tutorial 65
A@
B@
C@ SQL, LDAP
SIP SIP UA
REFER VoiceXML
200
VoiceXML
scripts
text
RTP
text
May 2001
hgs/SIP Tutorial 66
RTP
200
200 3
INVITE
2 SDP (from 2) 6
5
ACK
SDP (from 4) 4
INVITE
no SDP 1
SIP ACK
SIP
May 2001
hgs/SIP Tutorial 67
SIP billing/charging
May 2001
hgs/SIP Tutorial 68
Security issues
May 2001
hgs/SIP Tutorial 69
Threats
May 2001
hgs/SIP Tutorial 70
SIP security
May 2001
hgs/SIP Tutorial 71
SIP authentication
May 2001
hgs/SIP Tutorial 72
Basic authentication
• Challenge by UAS:
SIP/2.0 401 Unauthorized
WWW-Authenticate: Basic realm="business"
• client responds with
INVITE sip:[email protected] SIP/2.0
CSeq: 2 INVITE
Authorization: QWxhZGRpbjpvcGVuIHNlc2FtZQ==
where authorization is base64(userid:password)
• usually caller → callee, but challenge can be in request
May 2001
hgs/SIP Tutorial 73
Digest authentication
May 2001
hgs/SIP Tutorial 74
Digest authentication
May 2001
hgs/SIP Tutorial 75
Quality of Service
May 2001
hgs/SIP Tutorial 76
Quality of service
May 2001
hgs/SIP Tutorial 77
PRACK
200 OK (PRACK)
reservation
COMET
200 (COMET)
180 Ringing
PRACK
200 OK (PRACK)
200 OK (INVITE)
ACK (INVITE)
UAC UAS
May 2001
hgs/SIP Tutorial 78
May 2001
hgs/SIP Tutorial 79
Preferences
May 2001
hgs/SIP Tutorial 80
q location preference
class business, residence
description show to caller
duplex full or half-duplex
feature call handling features
language languages spoken
media audio, video, text/numeric, . . .
mobility fixed or mobile
priority “only in case of emergency”
scheme URL schemes (tel, http, . . . )
service IP, PSTN, ISDN, pager, . . .
May 2001
hgs/SIP Tutorial 81
Contact example
May 2001
hgs/SIP Tutorial 82
May 2001
hgs/SIP Tutorial 83
Request-Disposition
• proxy or redirect
• cancel ringing second phone after first picked up?
• allow forking?
• search recursively?
• search sequentially or in parallel?
• queue the call?
Request-Disposition: proxy, recurse, parallel
May 2001
hgs/SIP Tutorial 84
May 2001
hgs/SIP Tutorial 85
presentity
bob
macrosoft.com
presence server
PUA
PA REGISTER
alice@
example.com
SUBSCRIBE
UA PUA
NOTIFY
registrar
PUA
PA
NOTIFY
May 2001
hgs/SIP Tutorial 86
May 2001
hgs/SIP Tutorial 87
subcriber presentity, PA
alice bob
SUBSCRIBE bob
Event: presence
From: alice
To: bob
200 OK
200 OK
200 OK
May 2001
hgs/SIP Tutorial 88
May 2001
hgs/SIP Tutorial 89
NOTIFY sip:[email protected]
To: sip:[email protected]
From: sip:[email protected]
Call-ID: [email protected]
CSeq: 1 NOTIFY
Content-Type: application/xpidf+xml
<?xml version="1.0"?>
<!DOCTYPE presence
PUBLIC "-//IETF//DTD RFCxxxx XPIDF 1.0//EN" "xpidf.dtd">
<presence>
<presentity uri="sip:[email protected];method="SUBSCRIBE">
<atom id="779js0a98">
<address uri="sip:[email protected];method=INVITE">
<status status="closed"/>
</address>
</atom>
</presentity>
</presence>
May 2001
hgs/SIP Tutorial 90
SIP events
May 2001
hgs/SIP Tutorial 91
SUBSCRIBE [email protected]
NOTIFY [email protected]
SIP proxy
SIP user agent DO [email protected] (RGW)
INVITE [email protected]
May 2001
hgs/SIP Tutorial 92
SIP IM
May 2001
hgs/SIP Tutorial 93
May 2001
hgs/SIP Tutorial 94
May 2001
hgs/SIP Tutorial 95
Programming services
May 2001
hgs/SIP Tutorial 96
May 2001
hgs/SIP Tutorial 97
Examples
May 2001
hgs/SIP Tutorial 98
May 2001
hgs/SIP Tutorial 99
May 2001
hgs/SIP Tutorial 100
use DB_File;
sub fail {
my($status, $reason) = @_;
print "SIP/2.0 $status $reason\n\n";
exit 0;
}
May 2001
hgs/SIP Tutorial 101
$destination = $addresses{$to};
if (! defined( $destination )) {
fail("404", "No such user");
}
May 2001
hgs/SIP Tutorial 102
Jonathan Lennox
Columbia University
[email protected]
May 5, 2000
May 2001
hgs/SIP Tutorial 103
Purpose
May 2001
hgs/SIP Tutorial 104
Abstract structure
busy
location proxy timeout
url: sip:jones@ timeout: 10s failure
Call String-switch example.com
field: from
match:
*@example.com
otherwise
location
url: sip:jones@
voicemail. redirect
example.com
merge: clear
May 2001
hgs/SIP Tutorial 105
May 2001
hgs/SIP Tutorial 106
Textual representation
<cpl>
<subaction id="voicemail">
<location url="sip:[email protected]">
<redirect />
</location>
</subaction>
May 2001
hgs/SIP Tutorial 107
Textual representation
<incoming>
<address-switch field="origin" subfield="host">
<address subdomain-of="example.com">
<location url="sip:[email protected]">
<proxy>
<busy> <sub ref="voicemail" /> </busy>
<noanswer> <sub ref="voicemail" /> </noanswer>
<failure> <sub ref="voicemail" /> </failure>
</proxy>
</location>
</address>
<otherwise>
<sub ref="voicemail" />
</otherwise>
</address-switch>
</incoming>
</cpl>
May 2001
hgs/SIP Tutorial 108
Textual representation
May 2001
hgs/SIP Tutorial 109
Switch nodes
May 2001
hgs/SIP Tutorial 110
May 2001
hgs/SIP Tutorial 111
May 2001
hgs/SIP Tutorial 112
May 2001
hgs/SIP Tutorial 113
May 2001
hgs/SIP Tutorial 114
<time timeofday="1310-1425,1440-1555,1610-1725"
day="2,4">
1:10 – 2:25 PM, 2:40 – 3:55 PM, and 4:10 – 5:25 PM, Tuesdays and Thursdays,
every week
<time date="1-7" day="1">
The first Monday of every month, all day
May 2001
hgs/SIP Tutorial 115
Location nodes
May 2001
hgs/SIP Tutorial 116
May 2001
hgs/SIP Tutorial 117
May 2001
hgs/SIP Tutorial 118
Remove locations from the location set, based on caller preferences/callee capabilities.
Has the same effect as a “Reject-Contact” header.
param: caller preference parameters to apply
value: values of parameters specified in “param”
location: caller preference location to apply
May 2001
hgs/SIP Tutorial 119
Proxy the call to the currently-specified set of locations, and automatically select one
“best” final response.
timeout: time before giving up on the proxy attempt
recurse: recurse on redirect responses to the proxy attempt?
ordering: try location in parallel, sequential, first-only
• Outputs: busy, noanswer, failure
• If the proxy attempt was successful, script terminates
May 2001
hgs/SIP Tutorial 120
Redirect the call to the currently-specified set of locations. This has no specific
parameters, and causes the script to terminate.
May 2001
hgs/SIP Tutorial 121
May 2001
hgs/SIP Tutorial 122
May 2001
hgs/SIP Tutorial 123
May 2001
hgs/SIP Tutorial 124
Subactions
May 2001
hgs/SIP Tutorial 125
<cpl>
<incoming>
<location url="sip:[email protected]">
<redirect />
</location>
</incoming>
</cpl>
May 2001
hgs/SIP Tutorial 126
<cpl>
<subaction id="voicemail">
<location url="sip:[email protected]" >
<proxy />
</location>
</subaction>
<incoming>
<location url="sip:[email protected]">
<proxy timeout="8s">
<busy>
</busy>
<noanswer>
<sub ref="voicemail" />
</noanswer>
</proxy>
</location>
</incoming>
</cpl>
May 2001
hgs/SIP Tutorial 127
<cpl>
<incoming>
<address-switch field="origin" subfield="user">
<address is="anonymous">
<reject status="reject"
reason="I don’t accept anonymous calls" />
</address>
</address-switch>
</incoming>
</cpl>
May 2001
hgs/SIP Tutorial 128
<cpl>
<incoming>
<time-switch timezone="US/Eastern">
<time day="1-5" timeofday="0900-1700">
<lookup source="registration">
<success>
<proxy />
</success>
</lookup>
</time>
<otherwise>
<location url="sip:[email protected]">
<proxy />
</location>
</otherwise>
</time-switch>
</incoming>
</cpl>
May 2001
hgs/SIP Tutorial 129
<cpl>
<incoming>
<lookup source="http://www.example.com/cgi-bin/locate.cgi?user=jones"
timeout="8">
<success>
<proxy />
</success>
<failure>
<mail url="mailto:[email protected]&Subject=lookup%20failed" />
</failure>
</lookup>
</incoming>
</cpl>
May 2001
hgs/SIP Tutorial 130
May 2001
hgs/SIP Tutorial 131
3G networks
May 2001
hgs/SIP Tutorial 132
3G and VoIP
• GPRS not suitable for VoIP: low bandwidth, high delay (500-600 ms RTT)
• initially (R4), CS voice to base station, then ATM/IP packets
• later (R5), in Internet multimedia (IM) subsystem ➠ IP to UE (user equipment)
• uses AMR audio codec, with variable rate of 4.75 to 12.2 kb/s, or GSM HR or EFR
• UTRAN delays: see TR 25.932
May 2001
hgs/SIP Tutorial 133
May 2001
hgs/SIP Tutorial 134
3G SIP registration
mobility management
signaling
visited IM domain
May 2001
hgs/SIP Tutorial 135
May 2001
hgs/SIP Tutorial 136
RFCs
May 2001
hgs/SIP Tutorial 137
SIP: http://www.cs.columbia.edu/sip
SDP: http://www.cs.columbia.edu/˜hgs/internet/sdp.html
RTP: http://www.cs.columbia.edu/˜hgs/rtp
Papers: http://www.cs.columbia.edu/IRT
May 2001