sip crash course
TRANSCRIPT
SIP Crash Course
January 2011
Agenda
IntroductionWhat is SIP
What is it not
Basic ArchitectureProxy
Redirect
Location Server
Registrar
SIP ProtocolRequest
Response
Addressing
Sending a request
Routing
Dialog
Scenarios
What is SIP
Provides infrastructure for routing messages.
Provides a way for end-points to register their current location.
SIP creates and manages sessions.
Allows parties to agree on a set of compatible media types.
Session can be anything:Voice/Video/Gaming/Chat
Introduction
What SIP is not
SIP does not provide complete multimedia solution.
Since SIP is a signaling protocol, it cannot guarantee the QoS in the established session.
It is not a billing protocol
Introduction
SIP Components
Two main elementsUser Agents (UA)User Agent Client (UAC)
User Agent Server (UAS)
ServersProxy (stateful & stateless) forwards the request to the next hop
Registrar accepts register requests
Redirect Server finds alternative locations
Location Service stores bindings*
Basic Architecture
Proxy forwards the request to the next hop. One type of proxy is a location based proxy, which will use the information found in the Location Service in order the final destination, to which it will forward the request. Note, the message will most likely not go directly the address found in the location service and has to do with a number of factors. One such factor are if there are any pre-loaded routes in the message, which we will talk more about later.
Registrar responsible for maintaining contact addresses associated with a particular AOR (aka a binding). This is accomplished through REGISTER requests. The bindings are stored in the Location Service.
Location Service more of a concept than anything else and is basically just a simple database storing mappings between AORs and contact addresses.
Redirect Server will actually not forward the request to the next hop but will simply suggest alternative locations where the intended target may be reached (sends back 3xx responses).
Question:
SIP Messages
Like HTTP Requests/Response modelUAC sends the Request, UAS responds.
Requests starts with a request lineINVITE sip:[email protected] SIP/2.0
MethodsINVITE, ACK, BYE, CANCEL, REGISTER, OPTION
More defined by extensions
SIP Protocol
SIP Messages
Responses with a status lineSIP/2.0 200 OK
Response Codes:1xx Provisional.
2xx Success.
3xx Redirection.
4xx Client Error.
5xx Server Error.
6xx - Global Failures.
SIP Protocol
1xx: Provisional -- request received, continuing to process the request;
2xx: Success -- the action was successfully received, understood, and accepted;
3xx: Redirection -- further action needs to be taken in order to complete the request;
4xx: Client Error -- the request contains bad syntax or cannot be fulfilled at this server;
5xx: Server Error -- the server failed to fulfill an apparently valid request;
6xx: Global Failure -- the request cannot be fulfilled at any server.(rfc3261, section 7.2)
Basic User Scenario
SIP Protocol
INVITE sip:[email protected]
INVITE sip:[email protected]
180 Ringing
180 Ringing
ACK
ACK
200 OK
200 OK
Proxy
Alice
Bob
Session EstablishmentThree way handshake
Questions: * Does 180 has any purpose? If so, what? Only for humans?* Any cool usage for 180?* How did the proxy know to contact Bob at the specified IP?* At what point is the session established?* Could you have multiple sessions being established due to this one INVITE? If so, how?
INVITE Request
INVITE sip:[email protected] SIP/2.0
To:
From: ;tag=987lkajsdf89au
Call-ID: lkjasdf90989lkj
CSeq: 1 INVITE
Content-Type: application/sdp
Content-Length: 450
Record-Route:
Record-Route:
Via: SIP/2.0/TCP 192.168.0.122:5060;branch=xxx;rport
...
Contact:
SIP Protocol
Identify the different parts of the message * What is the via header used for? * what is the Contact header used for? * To? From? Etc
200 OK Response
SIP/2.0 200 OK
To: ;tag=89uasdkfjoiu
From: ;tag=987lkajsdf89au
Call-ID: lkjasdf90989lkj
CSeq: 1 INVITE
Via: SIP/2.0/TCP 192.168.0.122:5060;branch=xxx;rport
...
Contact:
Record-Route:
Record-Route:
Content-Type: application/sdp
Content-Length: 451
SIP Protocol
SIP Headers
Headers carries important information about e.g. routing or request and responses.
Similar in syntax and meaning to HTTP
The more important headers:To & From
Via
Contact
Call-ID
Route & Record-Route
CSeq
SIP Protocol
Addressing
SIP-address is used to locate and communicate with other users.sip:[email protected]
sips:[email protected]
Each user typically have an Address of Record (AOR), through which that user can be contacted.
SIP Protocol
Constructing a request
Request line
Headers (the minimum)To
From
Call-ID
Via
Cseq
Max-Forwards
SIP Protocol
Sending the request
Most compute the destination.Transport
Port
IP-address
RFC 3263 describes how to compute these
The procedures of 3263 are applied to which URI?
SIP Protocol
Routing
SIP uses DNS to resolve sip-addresses.
SIP:s routing capability is very strong.
Requests uses Route-headers and the request-uri to traverse the network.
Responses use Via-headers.
SIP Protocol
Routing
SIP Protocol
To:
From: ;tag=987lkajsdf89au
Call-ID: lkjasdf90989lkj
CSeq: 1 INVITE
Contact:
Route:
Via: SIP/2.0/TCP 192.168.0.122:3156;branch=xxx;rport
Via: SIP/2.0/TCP 62.72.129.14:5060;branch=yyy;rport
Record-Route:
Via: SIP/2.0/TCP 182.62.114.75:5060;branch=xyz;rport
outbound.whatever.com
INVITE sip:[email protected] SIP/2.0
INVITE sip:[email protected];transport=TCP SIP/2.0
;tag=89uasdkfjoiu
Routing
SIP Protocol
outbound.whatever.com
SIP/2.0 200 OK
To: ;tag=89uasdkfjoiu
From: ;tag=987lkajsdf89au
Call-ID: lkjasdf90989lkj
CSeq: 1 INVITE
Contact:
Record-Route:
Via: SIP/2.0/TCP 192.168.0.122:5060;branch=xxx;rport
Via: SIP/2.0/TCP 62.72.129.14:5060;branch=yyy;rport
Via: SIP/2.0/TCP 182.62.114.75:5060;branch=xyz;rport
Dialog
A dialog is a peer-to-peer relationship between two end-points that lasts for some time.
Facilitates proper routing between the two end-points.
Maintains state
Identified through a Dialog id
Only a few messages are dialog creating.
When the dialog is established depends on the method.
SIP Protocol
The End
Jonas Borjesson [email protected]
Jonas Borjesson [email protected]