SIP and VoIP Protocols Overview
SIP and VoIP Protocols Overview
SIP Advanced
Page 2
Pressing Buttons Is Fun!
http://apis-ms.participoll.com/
Page 3
Answer on the Poll!
Apis-ms.participoll.com
C. About average
E. I suck at driving
A B C D E F 0
Page 4
Answer on the Poll!
Apis-ms.participoll.com
B. I see it regularly
D. I have heard of it
(2) (2)
A B C D E 4
Page 5
1.1.1.1 2.2.2.2
Page 7
VoIP One-domain solution
Applications
TCP UDP
IP
L2 / L1
Alice1.1.1.1
Bob 2.2.2.2
Alice one.com
Bob
1.1.1.1 2.2.2.2
IP address
Port number
Codec information
Page 8
VoIP Multi-domain solution
1.1.1.1 2.2.2.2
IP address
Port number
Codec information
Page 9
The Actual Audio Packet
Voice G.711
RTP-header
min 12 bytes
UDP-
header
8 bytes
A. TCP
B. UDP
C. SCTP
D. RTCP
A B C D 0
Page 11
Answer on the Poll!
Apis-ms.participoll.com
A B C D 0
Page 12
Answer on the Poll!
Apis-ms.participoll.com
A. TCP
B. UDP
C. SCTP
A B C D 0
Page 13
A. Code
B. Comment
C. Configuration
D. Change
A B C D 0
Page 17
SIP - Components
Location
Service
DNS
Dialog
Session
UAC UAS
Page 18
Registration to a Location Service
Bob
I´m Bob’s phone and I am located at IP address 10.1.2.4
Hi, Bob’s phone. Now I know that you are at IP address 10.1.2.4
10.1.2.4
SIP Registrar
Page 19
SIP Basic Call
telenor.com=1.1.1.1
telia.com=2.2.2.2
Location
Location Service
Service DNS
Where is Where is bob?
bob=1.2.3.4
telia.com?
alice=5.6.7.8
2.2.2.2!
SIP
”REGISTRATION”
SIP
Proxy Proxy
IP: 1.1.1.1 SIP IP:2.2.2.2
Signalling
telenor.com telia.com
Calling ”[email protected]”
Bob Hanging up
sip:[email protected] sip:[email protected]
IP: 5.6.7.8 IP: 1.2.3.4
Media (e.g. Audio/Video)
A B C D 0
Page 21
SIP Requests and Responses
Location
Service
SIP
Registrar
SIP SIP
Proxy Proxy
200 OK
REGISTER
200 OK
INVITE
ACK
• Several others
Page 23
ACK requests
Alice Bob
• ACK – A three way handshake INVITE
ACK
Conversation
Page 24
SIP Response Codes
Basic Methods
◦ INVITE UAC Proxy Proxy UAS
◦ ACK INVITE
INVITE
◦ BYE
INVITE
◦ OPTIONS
◦ REGISTER
◦ CANCEL 180 Ringing
180 Ringing
Response Codes 180 Ringing
◦ 1xx, Provisional
200 OK
◦ 2xx, Success 200 OK
200 OK
◦ 3xx, Redirect
◦ 4xx, Client mistake ACK
◦ 5xx, Server Failure
◦ 6xx, Global Failure
Page 25
Transactions
200 OK
• May be several transactions within a
dialog
Page 26
Dialog and Transactions
UAC UAS
INVITE
One request
100 Trying
Transaction
Any number of provisional
180 Ringing responses
200 OK
One final response
Dialog ACK
-Call-ID
Exchange
Transaction
BYE
200 OK
Page 27
The Inheritance
Request-URI
o INVITE <sip:[email protected]> PSTN
o OPTIONS <sip:[email protected]>
Address-of-Record
o To: Paul <sip:[email protected]>
o From: Isac <sip:[email protected]>
SIP-URI
o sip:100.1.2.3
o sip:[email protected];transport=tcp
o sip:[email protected]?subject=SipCourse
o sip:ip-s.se;method=REGISTER?to=taisto%40ip-s.se IP
o sip:[email protected];user=phone
o sips:[email protected]
o sip:user:password@host:port;uri-parameters?headers
Page 30
Answer on the Poll!
Apis-ms.participoll.com
A. sip:10.0.120.15
B. sip:[email protected];user=phone
D. sip:[email protected]
h46h.bw446y466y567bjvbj5bw75bj5wv5.sl 60%
(3)
20% 20%
(1) (1)
A B C D 5
Page 31
Simplified SIP Message Syntax
Request-URI
“METHOD” In a Request In a response
INVITE sip:[email protected]
SIP/2.0 200 OK
SIP/2.0
SDP
Page 32
Message Headers
Request-Line and Status-Line
SIP/2.0 200 OK
Proxy Request
Alice Request Via: Proxy Bob
Via: Alice Via: Alice
Response
Via: Alice Response
Via: Proxy
Via: Alice
The To: and From: headers have the same syntax that consists of
- Display name (optional)
- URI that identifies the caller in the From: header
- URI that identifies the callee in the To: header
Page 35
Message Headers: Call-ID
Alice Bob
Call-ID: X
Alice Charlie
Call-ID: Y
Page 36
Message headers - CSeq:
Command Sequence
- Sequence number for requests
- Contains a CSeq number and CSeq method
eg. CSeq: 1 INVITE
Alice Bob
• Max-Forwards:
INVITE
– Starts at 70 INVITE
MaxF:70 INVITE
– Reduce by one for each proxy MaxF: 69
MaxF: 0
• Via header checking 483 Too Many Hops
483
– Each hop MUST add its own via 483
on top of the previous.
– If it does it might be a loop!
Page 38
Basic Call Handling
[email protected]
192.1.2.3
INVITE Bob?
ACK
INVITE [email protected]
200 OK
200 OK
ACK
Page 40
Answer on the Poll!
Apis-ms.participoll.com
67%
(4)
33%
(2)
A B C D 6
Page 41
The Invite Dialog
Caller Callee
INVITE
• Call–ID
• From–tag
• Record–Route
ACK
• Route
MESSAGE/200 OK
In–Dialog • Route
Requests
Re–INVITE/200 OK/ACK
• Route
UPDATE/200 OK
• Route
BYE
• Route
INVITE
100 Trying
Early Dialog
180 Ringing
200 OK
Confirmed Dialog
Page 43
Answer on the Poll!
Apis-ms.participoll.com
A B C D 0
Page 44
SIP/2.0 200 OK
Via: SIP/2.0/UDP pc12.lab1.sip:5060
From: Alice <sip:[email protected]>;tag=X
To: Alice <sip:[email protected]>;tag=Y
Call-ID: [email protected]
CSeq: 1 REGISTER
Contact: <sip:[email protected]> ;expires=86400 ;q=1.0
Contact: <sip:[email protected]> ;expires=7200 ;q=0.7
Content-Length: 0
Page 47
Answer on the Poll!
Apis-ms.participoll.com
A. To and From
D. Contact and To
A B C D 0
Page 48
Message Forwarding
Page 49
Reaching the Destination
Location
DNS Service
Policy Routing
Policy Routing
INVITE [email protected]
INVITE sip:11.12.13.14
zee.com
Page 50
DNS searching
DNS
smallserver.ip-s.se
Proxy.caller.se
Bigserver.ip-s.se
Page 51
Selecting Transport Protocol
yes**
MUST use
reliable proto size > 1300?
No NAPTR lookup!
no
Follow NAPTR data Example address
sip: sip.lab1.sip
Page 53
Step Two - Selecting IP Address
sip: sip.lab1.sip:<maybe>
IP-Address in URI
no yes
sip: sip.lab1.sip
PortNr in URI?
no
yes
Get AAAA or A
sip: 10.1.2.3:<maybe>
no for <host>
Use that IP
Get SRV for
;transport=<proto>
Use IP:Port
NAPTR result
sip: 10.1.2.3: 5064
name:port x n PortNr in URI?
yes
no
sip:
sip.lab1.sip;transport=<proto>
sip: <10.1.2.3>
A B
INVITE
UDP INVITE
TLS INVITE
TCP
200 OK
200 OK
200 OK TCP
TLS
UDP
INVITE
TCP
BYE
UDP
200 OK
UDP
Page 55
The Via Header – Sent-By
INVITE
INVITE
Via: Pc12 INVITE
Via: Proxy1 INVITE
Via: Pc12 Via: Proxy2
Via: Proxy1 Via: Proxy3
Via: Pc12 Via: Proxy2
Via: Proxy1
Via: Pc12
200 OK
200 OK 200 OK
200 OK Via: Proxy3
Via: Proxy2 Via: Proxy2
Via: Proxy1
Via: Pc12 Via: Proxy1 Via: Proxy1
Via: Pc12
Via: Pc12 Via: Pc12
Page 56
The Via header – ;received
Good for NAT traversal
Proxy1 Proxy3
Proxy2
INVITE
Via: 10.2.1.19:5060 INVITE
Via: Proxy1 INVITE
Via: 10.2.1.19:5060 Via: Proxy2 INVITE
Via: Proxy1;recv=IP1 Via: Proxy3
Via: 10.2.1.19:5060 Via: Proxy2; recv=IP2
Via: Proxy1;recv=IP1
Via: 10.2.1.19:5060
Page 57
Answer on the Poll!
Apis-ms.participoll.com
A. Call-ID
B. DNS
C. Packet size
D. URI parameters
A B C D 0
Page 58
Simple Loop Detection
INVITE
INVITE
MaxF:70 INVITE
MaxF: 69
MaxF: 0
483 Too Many Hops
483
483
Page 59
Special Loops
INVITE carol
INVITE carol
INVITE carol
INVITE bob
INVITE bob1
INVITE bob1
.........
INVITE bob2
INVITE bob2
482 Loop
482 Loop
.........
Page 60
Forcing traffic a certain way
INVITE bob
Route: Proxy1 INVITE bob
INVITE bob
Route: log.lab1.sip, INVITE bob
sipfw.lab1.sip Route: sipfw.lab1.sip
200 OK
200 OK
200 OK
200 OK
Page 61
Recording PATHs
REGISTER
Contact: IP:Port REGISTER
REGISTER lab1.sip
Contact: IP:Port
Path: lab2.sip;lr Contact: IP:Port
Path: <fw.lab1;lr>
Path: <lab2.sip;lr>
200 OK
200 OK
200 OK Path: <fw.lab1;lr>
Path: <fw.lab1;lr> Path: <lab2.sip;lr>
Path: <fw.lab1;lr> Path: <lab2.sip;lr>
Path: <lab2.sip;lr>
INVITE
INVITE sip:IP:Port
INVITE
Route: <fw.lab1;lr>
INVITE Route: <lab2.sip;lr> Route: <lab2.sip;lr>
Page 62
Forced Routing: Recording Routes
UAC-A PA PB UAS-B
• Record-Route:
INVITE INVITE INVITE
Record-Route: Record-Route:
<PA;lr> <PB;lr>,<PA;lr>
• Route:
200 OK 200 OK 200 OK
Record-Route: Record-Route: Record-Route:
<PB;lr>,<PA;lr> <PB;lr>,<PA;lr> <PB;lr>,<PA;lr>
ACK sip:pa.carrier.se
Via: SIP/2.0/UDP alicepc.lab1.sip:5060; branch=z9hG4bK87
From: sip:[email protected];tag=55a66b
To: sip:[email protected]
Call-ID: [email protected]
Route: <sip:pb.carrier.se>, <sip:[email protected]>
CSeq: 1 ACK
A. REGISTER
B. BYE
C. CANCEL
D. INVITE
100%
(5)
A B C D 5
Page 65
Session Management
Page 66
Session setup - SDP Usage
180 Ringing
ACK
Audio Exchange
Page 67
Session setup - SDP Usage
INVITE ()
180 Ringing
Audio Exchange
Page 68
An Offer/Answer Model with the SDP
INVITE
200 OK
ACK
Media Exchange
ACK
SIP/2.0 200 OK
Via: SIP/2.0/UDP proxy12.lab2.sip
UACUAS ;branch=z9hG4bKnashds8;received=192.0.2.3
Via: SIP/2.0/UDP proxy42.sip.lab1.sip
INVITE sip:[email protected] SIP/2.0
;branch=z9hG4bK77ef4c2312983.1;received=192.0.2.2
Via: SIP/2.0/UDP pc33.lab1.sip;branch=z9hG4bKabcde
Via: SIP/2.0/UDP pc33.lab1.sip
Max-Forwards: 70
;branch=z9hG4bKabcde ;received=128.3.4.5
From: Alice <sip:[email protected]>;tag=1921111774
From: Alice <sip:[email protected]>;tag=1921111774
To: Bob <sip:[email protected]>
To: Bob <sip:[email protected]>;tag=a6c85cf
Call-ID: [email protected]
CSeq: 314159 INVITE Call-ID: [email protected]
Contact: <sip:[email protected]> CSeq: 314159 INVITE
Content-Type: application/sdp Contact: <sip:[email protected]>
Content-Length: 142 Content-Type: application/sdp
Content-Length: 131
v=0 v=0
o=alice 53655765 2353687637 IN IP4 128.3.4.5 o=bob 4858949 4858949 IN IP4 192.1.2.3
c=IN IP4 128.3.4.5 c=IN IP4 192.1.2.3
m=audio 3456 RTP/AVP 0 3 4 5 m=audio 5004 RTP/AVP 0 3
A. 200 OK
B. ACK
C. 100 Trying
D. 180 Ringing
(3)
20% 20%
(1) (1)
A B C D E 5
Page 72
Session Description Protocol
• Session Description
Terve? Guten tag?
How should we communicate?
Negotiates/describes media sessions
• Information Exchanged:
IP Address
Media information
Etc.
DNS
Dialog
Session
UAC UAS
Page 74
Session Description Protocol
• Generic Info
- Title
SDP “Text file”
- Contact info, and similar
• Type of Media
- Audio, Video, Data v=0
o=
Session Description
• Transport protocol
c=IN IP4 1.1.1.1
- RTP
- H.320/3 t=
r= Timing Description
- ATM
• Media Format m=audio
Media Description
- mpeg, gsm, anything
• Transport addresses m=video
- Multi/Unicast, Ports Media Description
• Start and stop times
- Reoccurring sessions m=application
c=IN IP4 1.1.1.2
Media Description
Page 75
Session Description Protocol
v=0
o=mhandley 2890844526 2890842807 IN IP4 212.112.175.4
s=SDP Seminar
i=A Seminar on the session description protocol
t=2873397496 2873404696
r=7d 1h 0 25h
u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps
[email protected] (John Doe)
p=+46-8-244266
c=IN IP4 239.1.1.24/15
m=audio 49170 RTP/AVP 0
m=video 51372 RTP/AVP 31
Page 76
Session Description Protocol
…
m=audio 12346 RTP/AVP 0 8 96
a=rtpmap:96 AMR
Alice Bob
a=fmtp:96 mode-set=0,2,5,7
m=video 9006 RTP/AVP 97 98
a=rtpmap:97 H263
a=fmtp:97 profile-level-id=0
a=rtpmap:98 MP4V-ES
Bob returns the answer that will be the valid SDP for this media session.
• In his answer Bob may remove codecs he does not like or support.
• He is not allowed to remove “m=“ lines, but he may set the media port to “0”
for media lines he does not like or support.
…
m=audio 22446 RTP/AVP 96
a=rtpmap:96 AMR
a=fmtp:96 mode-set=0,2,5,7
m=video 0 RTP/AVP 97 98
a=rtpmap:97 H263
a=fmtp:97 profile-level-id=0
a=rtpmap:98 MP4V-ES
Page 78
Answer on the Poll!
Apis-ms.participoll.com
A B C D 0
Page 79
State Handling
Page 80
Stateful or Stateless
Stateless Proxy
INVITE
Lost
INVITE
Lost
T1x64
INVITE
Lost
…
Give up!
Stateful Proxy
INVITE
Lost
500ms 100 Trying
Lost
T1x64
Lost
408 Timeout
Give up!
ACK
Page 81
Dialogs and Transactions
• SIP Dialog
– A “session” established by a INVITE- From: Alice <sip:[email protected]>;tag=1921111774
similar METHOD, creating an active
To: Bob <sip:[email protected]>;tag=a6c85cf
Call-ID: [email protected]
“dialog” between to endpoints
– Defined by Call-ID, and To: & From: -tags
SIP Core Layer
• SIP transaction
– Request and response SIP Transaction Layer
– Stateless proxies haven’t got a
Transaction Layer SIP Transport Layer
– We have INVITE and non-INVITE
transactions
• ACK-handling is a little tricky
INVITE
200 OK
Transaction State
Page 82
Transaction Lifetime
• What is a transaction
Start Line
SIP Headers
1 Request
– A request and all the associated SDP Payload
Copy Mandatory
Headers
responses
– And maybe the ACK
• Depends on the INVITE response
• Different kinds of transactions ~Txn Multiple Provisionals Response Line
StartLine or ResponseLine
1 Final Response
Via: SIP/2.0/TCP Host:portnr
From: sip:[email protected] ;tag=X
To: sip:[email protected] ;tag=Y
Max-Forwards: 70
Call-ID: <random>@Ipaddr ACK ?
CSeq: <Counter> METHOD
“Dynamic Database”
INVITE
200 OK
INVITE/200 OK
BYE/200 OK
A. Dialogs
B. Sessions
C. Calls
D. Transactions
A B C D 0
Page 87
Request retransmission
A PB B
• UDP
– SIP layer uses exponential backoff
when retransmitting
– Default start at 500 ms
INVITE
• TCP or TLS
500ms INVITE
– Connection setup and reliable
transport, 1 sec
so NO sip-level retransmissions INVITE
– Performance, security
and redundancy issues?
2 sec
• SCTP
INVITE
– Performance-, security-, and
INVITE
redundancy improvements 100 Trying
• Mandatory support INVITE
– UDP and TCP
– Proxies “SHOULD” support TLS INVITE
• Detecting retransmissions
– SIP CSeq counter
Page 88
2xx Responses to INVITE
INVITE
100 Trying
INVITE
100 Trying
ACK
Page 89
Proxy Core - Response processing
INVITE
100 Trying
INVITE
100 Trying
INVITE
180 Ringing
180 Ringing
180 Ringing
200 OK
200 OK
200 OK
ACK
ERR
200 OK
200 OK
200 OK
ACK
Page 90
CANCEL
SIP Proxy
Alice ericsson.se Bob Carol
INVITE
sip:[email protected]
INVITE
[email protected]
INVITE [email protected]
200 OK
200 OK
CANCEL
200 OK(CANCEL)
ACK
ACK
Page 93
Forking Proxies (2)
SIP Proxy
Bob Carol
Alice ericsson.se at sales at sales
INVITE
sip:[email protected]
INVITE [email protected]
INVITE [email protected]
200 OK
200 OK
CANCEL
200 OK(CANCEL)
ACK
ACK
Page 94
Forking Proxies
INVITE
sip:[email protected] INVITE
sip:[email protected]
INVITE sip:[email protected]
INVITE
sip:[email protected]
INVITE sip:[email protected]
200 OK
200 OK
200 OK CANCEL
CANCEL
200 OK (CANCEL)
200 OK (CANCEL)
ACK sip:[email protected]
Page 95
Responses and Call state
100 Trying
200 OK
200 OK
CANCEL
200 OK (CANCEL)
ACK
200 OK (INVITE)
200 OK
ACK
BYE
Page 96
Stateful Cancel and 3++
INVITE
INVITE
INVITE
100 Trying
100 Trying 100 Trying
CANCEL
CANCEL
CANCEL
200 OK
200 OK
487 Cancelled
487 Cancelled
ACK
487 Cancelled
200 OK
ACK
ACK
Page 97
Waiting and Selecting
CANCEL
200 OK (CANCEL)
487 Cancelled
486 Busy
ACK
ACK
Page 98
INVITE Transactions
SUCCESSFUL INVITE
UAC UAS
INVITE
INVITE
INVITE from TU 1 •Pass INVITE to TU
•send INVITE
100
2 •Send 100 if TU won’t in 200 ms
Timer A
•Reset A 101-199 from TU
•Send INVITE Timer B 3 or INVITE
1 1 •Inform TU 2xx •Send 101-199
2 2 2xx from TU
CALLING •Send 2xx
4 PROCEEDING
3++ 5 ACK
3++ from TU
•Send ACK 1xx (Another transaction) •Send 3++
•3++ to TU •1xx to TU
2xx UNSUCCESSFUL INVITE Timer G
1xx 3 3 •2xx to TU UAC UAS
INVITE
•Send 3++ 4 •Send 3++
•1xx to TU
PROCEEDING INVITE COMPLETED
1
3++
•Send ACK 100
2
3++ ACK Timer H
•Send ACK •3++ to TU
•Inform TU
5 3 3++
6
COMPLETED 4 CONFIRMED
5 ACK
Timer D
6 Timer I
7
7 5 8
TERMINATED
Application Logic
EVENT
TERMINATED
Transaction User
Transaction Layer
•Action 8 4
Client Transport Server
Page 99
Non-INVITE Transactions
SUCCESSFUL non-INVITE
UAC UAS
Non-INVITE
Request received
Request from TU 1 •Pass request to TU
•send request 100 2
Timer E Timer F or
•Send request Transport Error 3
•Inform TU
1 1 4 2
2xx
2 2++ from TU
•Send 2++
TRYING TRYING
5
2++ 6
•2++ to TU
1xx
•1xx to TU
7 1xx from TU
Timer F or 8 •Send 1xx Request or
Timer E Transport Error 1xx from TU
•Send request 4 4 •Inform TU
3 •Send 1xx
UNSUCCESSFUL non-INVITE 3
PROCEEDING UAC Non-INVITE UAS PROCEEDING
1xx
2++
•1xx to TU 1 2++ from TU
•2++ to TU 100 2 •Send 2++
6 6 4 3 5 5
COMPLETED 3++ COMPLETED
5 Request
Timer K
6 •Send 2++
Timer J
7
8 8 8
7
TERMINATED Application Logic TERMINATED
EVENT
Transaction User
•Action 7
Transaction Layer
Client Transport Server
Page 100
SIP Timers
Timer F Timer E non-INV Timer K non-INV non-INV Timer J There are 3 timer start values: Default
T1 Estimated round-trip-time 500 ms
0.5s
non-INV 2++ 2++ T2 Max retransmit interval for non-Invite 4 seconds
requests and Invite responses
1s
non-INV 2++ non-INV
5s 32s T4 Max duration a message will remain in
2s the network 5 seconds
non-INV 2++ 2++
32s Timer Value for UDP Value for TCP/SCTP
4s A initially T1 Not used
non-INV B 64*T1 64*T1
Terminate Terminate
Non-INVITE Transaction Transaction C > 3min > 3min
Transactions 4s D > 32s 0s
non-INV
non-INV E initially T1 Not used
F 64*T1 64*T1
481 G initially T1 initially T1
H 64*T1 64*T1
I T4 0s
INVITE J 64*T1 0s
Transactions Timeout K T4 0s
1s 0.5s 0.5s
INVITE ACK 3++ <Timer C
ACK 2xx 1xx
2s 1s 1s
INVITE 3++ 3++ <Timer C
ACK 2xx 1xx
32s >32s 5s
4s 2s 2s
INVITE ACK 3++ Timer C
ACK 2xx
32s 64*T1
8s 4s 4s (T2)
INVITE 3++ 3++ 2xx Timeout
Terminate
Transaction
16s 4s 4s
INVITE Discarded 3++ 2xx
Response
Timeout
Timeout Timeout
BYE
Page 101
NIT Problem #1 – Usefulness of 408 Responses
MESSAGE
MESSAGE
MESSAGE
MESSAGE
Timeout
Timeout
408 Timeout Timeout
408 Timeout •
Timeout •
•
408 Timeout •
408 Timeout Timeout
408 Timeout 408 Timeout
408 Timeout 408 Timeout
408 Timeout
408 Timeout
Page 102
NIT Problem #2 – Recovering from packet loss
Retransmission
UAC NextHop UAC NextHop
Destination Blacklisting
MESSAGE MESSAGE
200 OK 1xx SomeThing
500ms Lost
200 OK
MESSAGE 4s Lost
200 OK MESSAGE
1s Lost
200 OK
MESSAGE 4s Lost
200 OK MESSAGE
2s Lost
200 OK
MESSAGE 4s Lost
200 OK MESSAGE
4s Lost
200 OK
MESSAGE 4s Lost
200 OK MESSAGE
4s Lost
200 OK
MESSAGE 4s Lost
MESSAGE
…except for…
proxy SIP proxy)
A CANCEL
All transactions carry
transaction, which
their own unique
carries the branch
transaction ID in the
value of the
branch header
transaction it is
attempting to cancel
Page 104
Answer on the Poll!
Apis-ms.participoll.com
C. Wait until all branches have answered and select the best response
0
A B C D
Page 105
INVITE ?
SIP Proxy
Reject-Contact: *;actor="msg-taker"
Accept-Contact: *;audio;require
Accept-Contact: *;video;explicit
Accept-Contact: *;methods=“MESSAGE";class=“business "
Example of incoming caller preferences, specified in a Request
Page 110
Requiring Extensions
INVITE
• What if we require a certain
extension? INVITE sip:[email protected] SIP/2.0
– Require - header Via: SIP/2.0/UDP pc12.aye.net; branch=z9hG4Kabc
From: sip:[email protected];tag=55a66b
– Proxy-Require – header To: sip:[email protected]
Require: refer, prefs
• So the rule is: Proxy-Require: sec-agree
Call-ID: 1fba35bfa4e5e050fc343b3de932a
– Ignore headers we don’t understand CSeq: 1 INVITE
– Unless there is a Require-header with
an option tag we don’t understand
420 Extension not supported
Reservation
Hey, I’ve got a reservation now!
Good, Finally!
PRACK
200 OK
Page 113
Provisional Response ACK
Alice Bob
Negotiated with
◦ Require: 100rel
INVITE
◦ Supported:100rel Require: 100rel
INVITE INVITE
RSeq header
Supported: 100rel
Cseq: 8 INVITE
182 Queued
182 Queued
RAck header
RSeq: 1
182 Queued Require:100rel 500
182 Queue millisec
PRACK PRACK
RAck: 1 8 INVITE
PRACK
200 OK
200 OK
200 OK
180 Ringing
180 Ringing RSeq: 2
180 Ringing Require:100rel
PRACK/200 PRACK/200
RAck: 2 8 INVITE PRACK/200
Page 114
Quality of Service in SDP
m= audio 9054 RTP/AVP 0 8 18 101
a=rtpmap: 0 PCMU
a=rtpmap: 8 PCMA
a=rtpmap: 101 telephone-event
a=des: qos mandatory local sendrecv
SENDRECV
CURR: MANDATORY LOCAL
a=
SEND
RECV
OPTIONAL
CONF:
E2E
NONE
Page 115
UEs Exchange QoS Information
Networks
180 Ringing
Page 116
Early Media
INVITE (SDP)
100 Trying
182 Queued
PRACK
200 OK
Early Dialog
200 OK
Confirmed Dialog
Page 117
Session Timer
Alice PA PB Bob
INVITE Bob@ips
Session-Exp: 1800
422 Too Small
Min-SE:3600
.........
• Require: timer
• Session-Expires header
Page 118
Answer on the Poll!
Apis-ms.participoll.com
A. prack
B. 100rel
C. session
D. timer
A B C D 0
Page 119
Security
Page 120
Adding SIP Intelligence to the Net
INVITE 212.112.175.20:5060
Dyn. State
10.1.1.100:5060
Static State
Src: IP:3030
TURN Server
STUN Server
10.1.1.10:1025 5.6.7.8:3478
1.2.3.4:3478
STUN-Request :<Port1>
STUN-Response
63.1.2.3:<Port1>
“I got this from: 63.1.2.3:<Port1>”
“Reflexive Address”
63.1.2.3:<Port2> 5.6.7.8:3366
“Relayed Address”
10.1.1.1 63.1.2.3
Simplified scenario. A full STUN/TURN scenario uses more requests and responses.
NOTE: Depending on the NAT, Port1 could be equal to Port2.
Page 126
Interactive Connectivity Establishment
◦ Require: ice
◦ Contact: INVITE / SDP
<sip:[email protected]>;sip.ice a=candidate:1
SDP needs to be updated a=candidate:2
INVITE
NAT
INVITE
Outbound Proxy/
Incoming connections through FW/NAT
Proxy(s) Registrar
NAT
◦ NAT only allow new connections
InsideOut.
◦ UA will register its internal
address
◦ Traffic must be sent to the NAT’s REGISTER
REGISTER
outside address and port! Contact: 10.1.2.3
http://tools.ietf.org/html/rfc5626
Page 129
Managing Client Initiated Connections in SIP
Outgoing Proxies
Authoritative
OP1 OP2 Proxy/ Registrar
10.1.1.10
REGISTER
State REGISTER
Contact:10.1.1.10 Location Server
;reg-id=1 Path: <sip:[keyX]@op1;lr>
AoR Contact Instance-Id Reg-Id Path: .
200 OK
200 OK Bob 10.1.1.10 <Instance-1> 1 sip:[keyX]@op1;lr
State Bob 10.1.1.10 <Instance-1> 2 sip:[keyY]@op2;lr
REGISTER
State REGISTER
Contact:10.1.1.10
;reg-id=2 Path: <sip:[keyY]@op2;lr>
200 OK 200 OK
State
INVITE [email protected]
A B C D 0
Page 131
Securing SIP signalling
• IPSEC
- Ipsec & IKE
• SSL/TLS
- Same as web browsers
• Authentication users
- Who is sending what?
- HTTP Basic
- Simple plain text
- HTTP Digest
- MD5, SHA-1
• End to End
- Secure Mime
- Secures email, ergo it secures SIP
Page 132
Security - Authentication Digest
For simplicity, irrelevant details have been remove from the signalling examples. (ACK, 2xx, etc)
Page 133
Security – Privacy and Identification
*******************************************************
* Content-Type: application/sdp *
* *
* v=0 *
* o=alice 53655765 2353687637 IN IP4 pc33.lab1.sip *
* s=- *
* t=0 0 *
* a=key-mgmt:mikey <key-exch-crypto-parameters> *
* c=IN IP4 pc33.lab1.sip *
* m=audio 3456 RTP/SAVP 0 *
* a=rtpmap:0 PCMU/8000 *
*******************************************************
*The example message is also using feature for Secure RTP, RFC3711
Page 135
Security – S/MIME
--boundary42
Protecting SIP headers Content-Type: message/sip
◦ Digest only protects the URI and SIP-Body INVITE sip:[email protected] SIP/2.0
◦ SIP headers are unprotected Via: SIP/2.0/UDP pc33.lab1.sip ;branch=z9hG4bKnas
To: Bob <[email protected]>
S/MIME Encapsulation From: Alice <[email protected]>;tag=1928301774
◦ Add a copy of the important headers in a Call-ID: a84b4c76e66710
S/MIME protected “attachment” with CSeq: 314159 INVITE
Max-Forwards: 70
integrity protection and sender Date: Thu, 21 Feb 2002 13:02:03 GMT
authentication Contact: <sip:[email protected]>
Content-Type: application/sdp
Content-Length: 147
v=0
o=jdoe 1 2 IN IP4 10.47.16.5
c=IN IP4 161.44.17.12
m=audio 49170 RTP/SAVP 0
a=crypto:1 <SUITE_NAME> inline:<key-data>
v=0
o=- 1181923068 1181923196 IN IP4 1.1.1.1
c=IN IP4 1.1.1.1
a=setup:actpass
a=fingerprint: SHA-1 <fingerPrint>
m=audio 6056 RTP/AVP 0
a=sendrecv
a=tcap:1 UDP/TLS/RTP/SAVP RTP/AVP
a=pcfg:1 t=1
A. Authenticate
C. 401 Unauthorized
D. INVITE
80%
(4)
20%
(1)
A B C D 5
Page 138
• SIP CGI
- Just like the web
- Perl, ActiveX..
- RFC3050
• XML Scripts
- Call Processing Language
- Voice XML
• Servlets
- Java server-side framework,
with SIP support
• Examples
- Rejecting calls
<cpl (With Lots of XML-parameters here) >
<incoming>
- Proxy and redirects <location url="sip:[email protected]">
<proxy>
<redirection>
<redirect/>
</redirection>
<default>
<location url="sip:[email protected]">
<proxy/>
</location>
</default>
</proxy>
</location>
</incoming>
</cpl>
5 4
7
OK, patch her through
8
6
INVITE/200OK/ACK
BYE/200OK 9
Alice Bob
200 OK
Contact: <[email protected]>
;+sip.instance=<urn:uuid=<rand>
;temp-gruu=“sip:aor<keyZ>@lab2.sip;gr”
;pub-gruu=“[email protected];gr=<keyX>
Alice Carol
Bob
Existing Call
Get Contact: !
REFER
Refer-To:
[email protected]
aor<KeyZ>@lab2.sip;gr
INVITE sip:aor<keyZ>@lab2.sip;gr
INVITE sip:[email protected]
10.1.1.10
Page 143
SIP 3rd Party Call Control
200 OK (SDP A)
INVITE (SDP A)
200 OK (SDP B)
ACK (SDP B)
ACK
RFC3725
Page 144
SIP 3rd Party Call Control
• Another option A B
- Different scenarios have different @
problems
- We would like the controller to be as
simple and media-ignorant as possible
ACK
reINVITE (with X)
200 OK (SDP Y)
ACK (SDP Y)
ACK
Page 145
SIP Services – Replacing sessions
• Replacing Calls
Parking Place
- Often used with REFER
Alice
• Replace with? Bob
- This new INVITE-session
• Replace what? Current Call
- How do we identify the session we
which to replace? REFER
- Replaces: “Dialog-ID”
INVITE
200 OK
ACK
INVITE
Replaces: <Dialog-ID>
200 OK
ACK
BYE, etc
RFC3891
Page 146
Call transfer - Attended
Just a A Call for
moment Carol you, Bob
Alice please its Alice
INVITE
200 OK
OK, patch her
ACK through
INVITE (hold)
Hi, I’d like to
speak 200 OK
to Bob, please
ACK
INVITE
200 OK
ACK
REFER
Refer-To: <Bob?Replaces=Dialog-ID>
202 Accepted
INVITE [email protected]
A. presence
B. message-summary
C. call-completion
D. app-activation
0
A B C D
Page 149
SIP for Presence
SUBSCRIBE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP phone42.lab1.sip;branch=z9hGk
To: <sip:[email protected]>
From: <sip:[email protected]>;tag=xfg9
Call-ID: [email protected]
CSeq: 1 SUBSCRIBE
Max-Forwards: 70
Event: presence
Accept: application/cpim-pidf+xml
Contact: <sip:[email protected]>
Expires: 600
NOTIFY sip:[email protected] SIP/2.0
Content-Length:0
Via: SIP/2.0/UDP server.lab1.sip;branch=z9hGk
From: <sip:[email protected]>;tag=ffd2
To: <sip:[email protected]>;tag=xfg9
Call-ID: [email protected]
Event: presence
Subscription-State: active;expires=599
Max-Forwards: 70
CSeq: 1 NOTIFY
Content-Type: application/cpim-pidf+xml
Content-Length: ..
SUBSCRIBE
SUBSCRIBE
Route: <presence;lr>
202 Success
202 Success
NOTIFY
200 OK
PUBLISH
PUBLISH
NOTIFY
200 OK
200 OK
200 OK
Page 151
Presence Dialogs – Record Routing
Proxy Presence AS
SUBSCRIBE
SUBSCRIBE
SUBSCRIBE
Route: Presence;lr 200 OK
Record-Route: P1;lr
202 Success
202 Success Record-Route: P1;lr
NOTIFY
One more
NOTIFY subscriber!!
NOTIFY
Route: P1;lr
Record-Route: P1;lr 200 OK
200 OK
200 OK
SUBSCRIBE
Route: P1;lr
200 OK
Page 152
Authorization and other events
• Authorization Presence
- Who should see what? Server
- Presence Policy Friend Boss
- Xml data
• Other Events
- REFER
My Policy
- Registration-event SUBSCRIBE
200 OK
SUBSCRIBE
202 Accepted
200 OK
Page 153
Answer on the Poll!
Apis-ms.participoll.com
A. PUBLISH
B. SUBSCRIBE
C. UPDATE
D. PUSH
0
A B C D
Page 154
SIP for Instant Messaging
200 OK
ACK
SEND
200 OK
SEND
200 OK
REPORT
200 OK
Page 156
SIP for Instant Messaging
INVITE sip:[email protected] SIP/2.0
To: <sip:[email protected]>
MSRP KjaHG1a SEND
From: <sip:[email protected]>;tag=12345
To-Path: msrp://pc42.lab2.sip:5445/<randB>;tcp
Call-ID: y32432h223 From-Path: msrp://pc24.lab1.sip:3113/<randA>;tcp
Content-Type: application/sdp Message-ID: 78273871123
Byte-Range: 1-*/81
c=IN IP4 pc24.lab1.sip Success-Report: yes
m=audio 1234 RTP/AVP 0 3 4 5 Content-Type: text/plain
m=message 3113 TCP/MSRP *
a=accept-types:text/plain text/html Hey Bob, I’ve just found this incredible...
a=path:msrp://pc24.lab1.sip:3113/<randA>;tcp -------KjaHG1a+
UAC
UAC
UAS
UAC
INVITE
INVITE
INVITE
…
INVITE
INVITE
SIP SIP
Proxy Proxy
One dialog
B2BUA B2BUA
UA ? UA UA ? UA
Three dialogs
Page 160
Back 2 Back User Agent
Proxy or B2B IVR Server Media Server
Early Media
• Common usages
- Getting service control back in the network SUBSCRIBE
- Call-interception BYE
- Conferencing 183
INVITE
Lawful interception,
Session
- Progress
200 OK
- Privacy
Audio/Video Media
NOTIFY
BYE
INVITE
200 OK
200 OK
Page 161
Supplementary Services
A HNW B HNW
AS AS AS AS AS AS
S-CSCF S-CSCF
HSS HSS
I-CSCF I-CSCF
A VNW B VNW
P-CSCF P-CSCF
Access Access
Page 162
Answer on the Poll!
Apis-ms.participoll.com
A. MSNBC
B. RTCP
C. MSRP
D. RTSP
0
A B C D
Page 163
RTP: YES!
INVITE
180 Ringing
SUBSCRIBE
NOTIFY “2“
INVITE
200 OK
183 Sess…
A/V Media “Press 5 to pause the movie”
Classic Fax
◦ Group 1 & 2 - Analog Fax PSTN
◦ Group 3 – PSTN Digital Fax
◦ Group 4 – ISDN Digital Fax
ITU T.30 – Fax Control Protocol Establish Call
◦ Uses V.21 modem signaling at 300 Baud
◦ Control signals CNG
CNG – Calling Signal, 1100 Hz
CED – Answering Fax Tone, 2100 Hz
DIS – Indicating capabilities CED
EOP
DCN
Page 166
Fax and SIP Interworking – Fax over IP
PSTN
IP
Page 167
Answer on the Poll!
Apis-ms.participoll.com
A. In RTP
B. NOTIFY
C. INFO
D. INVITE
0
A B C D
Page 168
SIP and PSTN
PSTN
IP
PSTN
Page 169
Phone numbers vs. Sip-URIs
DNS
ENUM
◦ Translate: tel: <tel, sip, h323, mailto>
◦ Using domain e164.arpa and NAPTR
◦ +46708880263 sip:teacher@ip- +46708880263
solutions.se
◦ 3.6.2.0.8.8.8.0.7.6.4.e164.arpa
PSTN
IP
Media Gateway
INVITE
sip:[email protected]
H.248
PSTN
Media Gateway Controller
Page 170
Merging SIP and PSTN
ENUM
SDP Payload
Tunneling or Translation?
IAM INVITE
ACM 180 Ringing or 183
ANM 200 OK
REL CANCEL or BYE
Page 171
Merging SIP and PSTN
PSTN
SIP PSTN
IAM INVITE
IAM
100 Trying
ACM*
18x*
ACM
200 OK ANM
ANM
ACK
From: Calling Nr
To: Orig Called Nr?*
RequestUri Called Party Nr?*
Page 172
A First Glance
IP
SIP
IP
R
Multimedia
R Subsystem
Mobile Network
A SIP
R R server
IP
SIP
Page 173
Answer on the Poll!
Apis-ms.participoll.com
A. DNS
B. SIP
C. DIAMETER
D. LDAP
0
A B C D
Page 174