Tom Qi CSCF RT Team Ericsson XYD/VV2
Tom Qi CSCF RT Team Ericsson XYD/VV2
CSCF RT team
ericsson XYD/VV2
E-mail: tom.qi@ericsson.com
Overview
• Introduction to SIP
• SIP Components and Basic Operation
• SIP Methods and Message
• SDP
• Other SIP Knowledge
SIP URL and URI
SIP Routing and Domain Name System
SIP Reliability
Authentication
Extensibility Model
Request
• SIP is a Client Server Protocol
– Clients send requests, receive
responses SIP Response SIP
– Servers receive requests, send Client Server
response
– A physical entity can have both
client and server functions
• Modeled after HTTP
• Each request invokes a method on
server
• Session
• Dialog
• Transaction
180 Ringing
200 OK
Sessions include Internet
telephone calls, ACK
multimedia distribution,
and multimedia Media Session
conferences. Session
can include multimedia,
audio, video, data, pic,
etc.
180 Ringing
Request
SIP Redirect
Response Server
Location Service
2
3
5
4
6
1
7
11
12 10
SIP Proxy SIP Proxy
8
9
SIP Client
SIP Client
(User Agent
Server)
• Forwards requests and responses only • Stateless proxy server process each request
– Does not issue a request; only responds to based solely on the message content
requests from user agent (except CANCEL) – Never retransmits
– Has no media capabilities – No memory
• Proxy server can be stateless or stateful • Stateful proxy server keeps track of requests
received and use that info for future response
– Uses a timer and retransmits after the timer
expires
– Can require user agent authentication
– Usually sends a 100 Trying response
– Proxy handling TCP must be stateful
Client Server
Server Server
Server Client
Via: A Via: U
– Max-Forwards
Via: U
• Max-Hops counter decremented by 1 on each
hop
• Discard request when Max-Hops is zero
– Via based loop detection and prevention
• Every proxy inserts its address in the Via Via: A
header Proxy Server Via: U Proxy Server
• Check for its own address and branch in the A B
list of Via header Via: U
• Drop the request if loops are detected
Calling
User
Agent
• INVITE
Uses a database or location service to
look up a user 302 Moved Temoprarily
• Responds to, but does not forward
requests ACK
• The location information is sent back to
the caller in a direction class response INVITE
200 OK
ACK
Media Session
BYE
200 OK
Payload or Body
Note that this is opaque to SIP
REGISTER
Informs a SIP server about the location of a user
INVITE
OPTIONS
Invites a participant to a call
ACK
Queries a participant about their
For call acceptance capabilities
UPDATE
Change media attributes of a call BYE
Ends a client’s participation in a call
CANCEL
Terminates a request
PRACK
Confirm reliable delivery of an
intermediate response
• INVITE Request
INVITE sip:johndoe@xyz.com SIP/2.0
Via: SIP/2.0/UDP ihgp192.ih.ericsson.com:5060
To: John Doe <sip:johndoe@xyz.com>
From: Sam fei <sip:fei@ericsson.com>
Call-ID: 1354@ ihgp192.ih.ericsson.com
CSeq: 1 INVITE
Subject: About SIP
Contact: sip:fei@ericsson.com
Content-Type: application/SDP
Content-Length: 156
v=0 ;version
o=fei 6309794261 6309794261 IN IP4 ihgp192.ih.ericsson.com ;origin containing name
s=Phone Call ;subject
c=IN IP4 135.185.192.53 ;connection
t=0 0 ;time limit
m=audio 49170 RTP/AVP 0 ;media
a=rtpmap:0 PCMU/8000 ;attributes
From: <sip:user1_public1@home1.net>;tag=171828
To: <sip:Gonzalo.Camarillo@ericsson.com> Header Field
Call-ID: cb03a0s09a2sdfglkj490333
Cseq: 127 INVITE
Contact: <sip:[5555::aaa:bbb:ccc:ddd]>
Content-Type: application/sdp
Header Field Name
Content-Length: 248 Header Field Value
v=0
o=- 2987933615 2987933615 IN IP6 5555::aaa:bbb:ccc:ddd
s=-
Body
• 200 OK Response
SIP/2.0 200 OK
Via: SIP/2.0/UDP ihgp192.ih.ericsson.com:5060
To: John Doe <sip:johndoe@xyz.com>;
tag=314511
From: Sam fei <sip:fei@ericsson.com>
Call-ID: 1354@ ihgp192.ih.ericsson.com
CSeq: 1 INVITE
Contact: sip:johndoe@xyz.com
Content-Type: application/SDP
Content-Length: 148
v=0 ;version
o=John 3125551234 3125551234 IN IP4 star9.xyz.com ;origin containing name
s=Phone Call ;subject
c=IN IP4 128.135.26.52 ;connection
t=0 0 ;time limit
m=audio 38767 RTP/AVP 0 ;media
a=rtpmap:0 PCMU/8000 ;attributes
RFC-3261
ExtensionProtocol
Extension Protocolmethods
methods
Core Protocol methods Extension Protocol methods
OPTION Used to query a user agent or server about its capability and
its current availability
INVITE
• Final responses to INVITE are always
acknowledged with the ACK method
• Usually has a message body containing the 100 Trying
media information of the caller
– May also contain QoS or security information 180 Ringing
– If an INVITE does not contain media
information, the ACK contains the media
information of the UAS
200 OK
• A media session is established after
INVITE, 200 OK, and ACK messages are sdp UAS
exchanged between UAC and UAS
ACK
sdp UAC
Media Session
CANCEL 200 OK
CSeq: 1 CANCEL
CSeq: 1 INVITE
200 OK CANCEL
CSeq: 1 CANCEL CSeq: 1 CANCEL
200 OK 200 OK
CSeq: 1 INVITE CSeq: 1 CANCEL
ACK
CSeq: 1 ACK
BYE
CSeq: 2 BYE
200 OK
CSeq: 2 BYE
100 Trying
• Acknowledge receipt of reliably transported CSeq: 1 INVITE
provisional response 180 Ringing
• Some provisional response, such as 180 CSeq: 1 INVITE
Ringing, are critical in determining the call state, RSeq: 314
the receipt needs to be confirmed 180 Ringing T1
• PRACK applies to all provisional responses except CSeq: 1 INVITE
100 Trying RSeq: 314
• Generated by a UAC when a provisional response PRACK
has been received containing a RSeq reliable CSeq: 2 PRACK
sequence number and a Supported: rel100 RAck: 314 1 INVITE
header 200 OK
• Echoes the number in the RSeq and the CSeq in a CSeq: 2 PRACK
RAck header
• Always increments CSeq 200 OK
CSeq: 1 INVITE
ACK
CSeq: 1 ACK
Media Session
4xx Client error: The request has failed due to an error by the client
5xx Server failure: The request has failed due to an error by the server
6xx Global failure: The request has failed and will fail wherever it is
tried
Via: C
Via: B Via: B
Via: A Via: A Via: A
Proxy Proxy
UAC UAS
Via: A Via: B Via: C
Addr: A Addr: B Addr: C Addr: D
Via: A Via: B
Via: A
Request
Response
• Added to a request by a UAC to modify or give additional information about the request
• Accept, Accept-Encoding,
Accept-Language, Authorization, Hide,
In-Reply-To, Max-Forwards, Priority,
Proxy-Authorization, Proxy-Require,
Record-Route, Reject-Contact,
Request-Disposition, Require,
Response-Key, Route, RAck,
Session-Expires
• Added to a response by a UAS or SIP server to give more information than just the
response code and reason phrase
• Not added to a request
• Proxy-Authenticate, Server, Unsupported,
Warning, WWW-Authenticate, RSeq
• Provide additional information about the message body or the resource requested
• In SIP, “entity” and “message body” are used interchangeably
• Allow, Content-Encoding,
Content Disposition, Content-Length*,
Content-Type , Expires, MIME-Version
• Most SIP requests are end-to-end messages between user agents, except
– CANVEL method is a hop-to-hop request
– A 4xx, 5xx, or 6xx response is acknowledged on a hop-to-hop basis
• ACK messages are only sent to acknowledge responses to INVITE requests
• For responses to all other request types, there is no acknowledgement
• A lost response is detected by the UAS when the request is retransmitted
1 1016 A 24 unassigned V
2 G721 A 25 CelB V
3 GSM A 26 JPEG V
4 unassigned A 27 unassigned V
5 DVI4 A 28 nv V
6 DVI4 A 29 unassigned V
7 LPC A 30 unassigned V
9 G722 A 32 MPV V
10 L16 A 33 MP2T AV
• SIP addresses are URLs (Uniform Resource Locators) and URIs (Uniform Resource Indicators)
• Used in To, From, Contact, and Request-URI headers
• The information in a SIP URL indicates the way in which the resource (user) should be
contacted using SIP
• URL contains several components
– Scheme (sip:)
– Username@Hostname
– Optional Port sip:fei@ericsson.com:5060:transport=udp;
– Optional Password user=ip;method=INVITE;ttl=1;
– Parameters maddr=135.195.192.23?Subject=Sample
– Headers and Body
• SIP allows any URI types
– Telcom URIs
– HTTP URLs for redirect
– Mailto URLs
• SIP has reliability mechanism defined to allow the use of unreliable transport layer
protocols such as UDP
• SIP user agent does not check to determine if a message has been corrupted in
transmission (UDP’s job)
• SIP user agent does check to make sure that the client has erred by creating a request
missing required headers
• Reliability mechanisms in SIP include:
– Retransmission timers
– Increasing command sequence CSeq numbers
– Positive acknowledgements
BYE
• Response should come quickly
– No need to ring phone
• Request retransmitted with exponential BYE
backoff, up to 4s
100 Trying
– If provisional response received, request
retransmitted at 4s intervals
BYE
• After 4s, request retransmitted every 4 s
• Response retransmitted on receipt of 100 Trying
request
– That is why request must be BYE
retransmitted after provisional – protect
against response loss 200 OK
– No ACK
BYE
200 OK
ACK
ACK
UAC UAS
Stateful Proxy
INVITE
200 OK
200 OK
ACK
ACK
Authorization: 1, 2
Authorization: 2
Media Session