Title: Signaling III
1Signaling - III
2SIP
- Session Initiation Protocol
- First RFC 2543, now RFC 3261
- Standardized by the Internet Engineering Task
Force(IETF) - Considered to be of the Intelligent Endpoint
model type - Messages are text-based, easily readable
- Can work over TCP/UDP/SCTP/TLS
3SIP Entities
- User Agent
- Registrar
- Proxy Server
- Redirect Server
- Entities are logical, and may be co-located
4User Agent(UA)
- An endpoint or client, the entity attempting
to initiate the session - Phone, softclient etc
- User Agent Client(UAC)
- Sender of a SIP request
- User Agent Server(UAS)
- Receiver of a SIP request
- Note UAS/UAC roles can be interchanged in a
single session
5Registrar
- Server that UAs register to(like GK in H.323)
- Keeps a registration Database of User-gtIP-Address
- Typically performs an authentication function
6Proxy Server
- A server that receives SIP requests and routes
them to a UAS or another Proxy Server - Based on routes/rules
- May stay in the path of responses to that
request(typically does) - May perform an authentication function
7Redirect Server
- Receives a request and responds to it with a
redirect response pointing to the location of
the target
8Functionality buckets
- Registration
- Locating or finding the user
- Contacting the user and creating a Session
- Authentication and (to some extent) access
control - Unlike H.323, all of these functions are
performed by essentially one protocol - SIP
9SIP addressing
- Uses URI(Uniform Resource Identifier) with the
sip scheme - sipalice_at_example.com
- Of the form user_at_domain, very much like email
addresses - Plain phone number addresses are not native to
SIP, there is a tel scheme for that
10SIP addressing
- So sip238155_at_example.com is legal, just
- sip238155 is not
- tel 14083238155 is a tel URL and legal in
some SIP messages
11Requests and Responses
- Not surprisingly, the protocol functions using a
request-response model - Typically a request is referred to as a Method
- The SIP message structure is based on HTTP, and
is very similar to it - An exchange of requests and responses influence
different kinds of state on the endpoints or
intermediaries, and that is key
12The SIP state/layer model
Call/Session state
UA
Dialog state
Transaction state
Requests Responses
Syntax/Encoding
13Getting a request to the right place
- Requests are targeted at a SIP URI
- Typically DNS is used to find the server
responsible for the domain - That server determines the location of the target
from the registration database - This could be a multi-hop process
14DNS SRV records
- DNS Domain Name Service
- SRV Service record
- The most common DNS record in use is the A
record. - Maps hostname ? IP address
- SRV gives the IP address or hostname of a server
providing a certain service in a certain domain
15SIP Request structure
- METHOD URI Protocol-Version
- Header..
- Header
- Content-Type Header
- Content-Length Header
- Message-Body(type defined by Content-Type)
16SIP Response structure
- Response-Code Response-String Protocol
- Header..
- Header..
- Content-Type Header
- Content-Length Header
- Message-Body(type defined by Content-Type)
17Key SIP Requests
- REGISTER
- INVITE
- ACK
- BYE
- CANCEL
- There are many more, some of which we will look
at later, and some we will not
18Key SIP Headers
- From
- To
- Via
- Cseq
- CallId
- Contact
- Content-Type
- Content-Length
19SIP Response codes
- 1xx
- Request in progress
- 2xx
- Request successful
- 3xx
- Request redirected
- 4xx
- Client error
- 5xx
- Server error
- 6xx
- Global failure
- Every class except 1xx is termed final response
20REGISTER
- Sent by UA to Registrar
- Informs the Registrar about where the UA is(IP
address etc) - This process creates a Registration which is
valid for a period of time determined by the
Registrar - After that time, the UA needs to register again
- REGISTER messages are typically authenticated by
the Registrar
21INVITE
- Sent by UA to initiate a session
- Sent to target UA(callee) typically through one
or more proxies - Basic INVITE sequence
- INVITE ?
- ? 100 Trying
- ? 180 Ringing
- ? 200 OK
22ACK
- ACK acknowledges a final response to an INVITE
request - Sent by UAC
- 3-way handshake to complete INVITE transaction
- Basic ACK sequence
- INVITE ?
- ? 200 OK
- ? ACK
23CANCEL
- Sent by UA to CANCEL pending request for a
session - Typical CANCEL sequence
- INVITE ?
- ? 100 Trying
- ? 180 Ringing
- CANCEL ?
- ? 200 OK (for the CANCEL)
24BYE
- Sent by UA(either side) to terminate session
- Basic INVITE sequence
- INVITE ?
- ? 100 Trying
- ? 180 Ringing
- ? 200 OK (Session established !)
- ACK ?
- ? BYE
- ? 200 OK
25The SIP From header
- From Anup Rao ltsipanup.v.rao_at_gmail.comgt
tag3wdwf - Logical sender of the request
- Should ideally contain the SIP Address of
Record, or AOR, rather than an instance of a
client - ltsipanup.v.rao_at_10.1.1.1gt
- NOT a good idea
- Tag is a key used in identifying a dialog,
which will come up soon - The non-URI part(Anup Rao) is referred to as
the display name
26The SIP To Header
- To Anup Rao ltsipanup.v.rao_at_gmail.comgt
- Specifies intended recipient. Should be AOR
- May or may not be the final recipient
- Request retargetting by a proxy, say for a
feature like call-forwarding - Similar to From, a tag parameter will exist in
the context of a dialog
27The SIP Via Header
- Records the path the request has taken
- Where the response must be sent
- Last hop shows up as the last Via header
- Via SIP/2.0/UDP pc33.atlanta.combranchz9hG4bKna
shds8 - branch parameter is used as a Transaction
Identifier
28The SIP Cseq header
- CSeq 4711 INVITE
- Serves to identify and order transactions
- Note that just a response code does not tell you
which request the response is for - The number part needs to be a 32 bit integer
29The SIP Call-ID header
- Call-ID f81d4fae-7dec-11d0-a765-00a0c91e6bf6_at_foo.
bar.com - Needs to be globally unique across space and time
- Groups together a series of messages into a
higher level construct(typically call or session)
30The SIP Contact header
- Contact ltsipanup.v.rao_at_somehost.example.comgt
- An address(SIP URI) that an instance of the
sender can be contacted for future requests - sipuser_at_ipaddress is also typical
- This is what is used in the REGISTER message to
convey where the instance is - The expires parameter says how long the address
is valid
31The SIP Content-Type header
- Content-Type application/sdp
- Says how to interpret the message-body
- Similar to mime-type in http or email
32The SIP Content-Length header
- Content-Length 132
- The message body for the purposes of transport is
just a stream of bytes - Content-Length says how many bytes
33Basic SIP Trapezoid
domain1 Proxy
domain2 Proxy
user_at_domain1
user_at_domain2
34Basic SIP trapezoid
alice
Proxy(atlanta.com)
bob
Proxy(biloxi.com)
REGISTER/200
REGISTER/200
INVITE
INVITE
100
INVITE
100
100
180 Ringing
180 Ringing
180 Ringing
200 OK
200 OK
200 OK
ACK
Media flow
BYE
200 OK
alice_at_atlanta.com calls bob_at_biloxi.com
35Redirect flow
alice
Proxy(atlanta.com)
jane
REGISTER/200
REGISTER/200
INVITE
100
301
ACK
INVITE
180 Ringing
200 OK
ACK
Media flow
alice_at_atlanta.com calls jane_at_atlanta.com
36State constructs
- Transaction
- The branch id in the Via header
- OR the number and Method name in the Cseq header
- State from Request to final Response
- Dialog(persists beyond single request-response)
- UAS Call-ID, remote-tagto-tag,
local-tagfrom-tag - UAC Call-ID, remote-tagfrom-tag,
local-tagto-tag - State elements
- Local sequence number
- Remote sequence number
- Route set
- Other stuff
- Call/Session
- 1 or more dialogs
37Registration example from 3261
- Bob(bob_at_biloxi.com)s UA registers with the
biloxi.com registrar/proxy
38Registration request
REGISTER sipregistrar.biloxi.com SIP/2.0 Via
SIP/2.0/UDP bobspc.biloxi.com5060branchz9hG4bKn
ashds7 Max-Forwards 70 To Bob
ltsipbob_at_biloxi.comgt From Bob
ltsipbob_at_biloxi.comgttag456248 Call-ID
843817637684230_at_998sdasdh09 CSeq 1826 REGISTER
Contact ltsipbob_at_192.0.2.4gt Expires 7200
Content-Length 0
39Registration response
SIP/2.0 200 OK Via SIP/2.0/UDP
bobspc.biloxi.com5060branchz9hG4bKnashds7
received192.0.2.4 To Bob ltsipbob_at_biloxi.comgt
tag2493k59kd From Bob ltsipbob_at_biloxi.comgttag
456248 Call-ID 843817637684230_at_998sdasdh09
CSeq 1826 REGISTER Contact ltsipbob_at_192.0.2.4gt
Expires 7200 Content-Length 0
40Session example from RFC 3261
- Alice(alice_at_atlanta.com) calls Bob(bob_at_biloxi.com)
- Thru two proxies P(atlanta.com), and P(biloxi.com)
41Alice ? Alices proxy
INVITE sipbob_at_biloxi.com SIP/2.0 Via
SIP/2.0/UDP pc33.atlanta.combranchz9hG4bKnashds8
Max-Forwards 70 To Bob ltsipbob_at_biloxi.comgt
From Alice ltsipalice_at_atlanta.comgttag192830177
4 Call-ID a84b4c76e66710 CSeq 314159 INVITE
Contact ltsipalice_at_pc33.atlanta.comgt
Content-Type application/sdp Content-Length
142 (Alice's SDP not shown)
42Alices Proxy ? Alice
SIP/2.0 100 Trying Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
From Alice ltsipalice_at_atlanta.comgttag192830177
4 Call-ID a84b4c76e66710 CSeq 314159 INVITE
Content-Length 0
43Alices Proxy ? Bobs Proxy
INVITE sipbob_at_biloxi.com SIP/2.0 Via
SIP/2.0/UDP bigbox3.site3.atlanta.combranchz9hG4
bK77ef4c2312983.1 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 Max-Forwards 69 To Bob
ltsipbob_at_biloxi.comgt From Alice
ltsipalice_at_atlanta.comgttag1928301774 Call-ID
a84b4c76e66710 CSeq 314159 INVITE Contact
ltsipalice_at_pc33.atlanta.comgt Content-Type
application/sdp Content-Length 142 (Alice's SDP
not shown)
44Bobs Proxy ? Alices Proxy
SIP/2.0 100 Trying Via SIP/2.0/UDP
bigbox3.site3.atlanta.combranchz9hG4bK77ef4c2312
983.1 received192.0.2.2 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
From Alice ltsipalice_at_atlanta.comgttag192830177
4 Call-ID a84b4c76e66710 CSeq 314159 INVITE
Content-Length 0
45Bobs Proxy to Bob
INVITE sipbob_at_192.0.2.4 SIP/2.0 Via
SIP/2.0/UDP server10.biloxi.combranchz9hG4bK4b43
c2ff8.1 Via SIP/2.0/UDP bigbox3.site3.atlanta.co
mbranchz9hG4bK77ef4c2312983.1
received192.0.2.2 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 Max-Forwards 68 To Bob
ltsipbob_at_biloxi.comgt From Alice
ltsipalice_at_atlanta.comgttag1928301774 Call-ID
a84b4c76e66710 CSeq 314159 INVITE Contact
ltsipalice_at_pc33.atlanta.comgt Content-Type
application/sdp
46Bob to Bobs Proxy
SIP/2.0 180 Ringing Via SIP/2.0/UDP
server10.biloxi.combranchz9hG4bK4b43c2ff8.1
received192.0.2.3 Via SIP/2.0/UDP
bigbox3.site3.atlanta.combranchz9hG4bK77ef4c2312
983.1 received192.0.2.2 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
taga6c85cf From Alice ltsipalice_at_atlanta.comgtt
ag1928301774 Call-ID a84b4c76e66710 Contact
ltsipbob_at_192.0.2.4gt CSeq 314159 INVITE
Content-Length 0
47Bobs proxy to Alices Proxy
SIP/2.0 180 Ringing Via SIP/2.0/UDP
bigbox3.site3.atlanta.combranchz9hG4bK77ef4c2312
983.1 received192.0.2.2 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
taga6c85cf From Alice ltsipalice_at_atlanta.comgtt
ag1928301774 Call-ID a84b4c76e66710 Contact
ltsipbob_at_192.0.2.4gt CSeq 314159 INVITE
Content-Length 0
48Alices Proxy to Alice
SIP/2.0 180 Ringing Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
taga6c85cf From Alice ltsipalice_at_atlanta.comgtt
ag1928301774 Call-ID a84b4c76e66710 Contact
ltsipbob_at_192.0.2.4gt CSeq 314159 INVITE
Content-Length 0
49Bob to Bobs proxy
SIP/2.0 200 OK Via SIP/2.0/UDP
server10.biloxi.combranchz9hG4bK4b43c2ff8.1
received192.0.2.3 Via SIP/2.0/UDP
bigbox3.site3.atlanta.combranchz9hG4bK77ef4c2312
983.1 received192.0.2.2 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
taga6c85cf From Alice ltsipalice_at_atlanta.comgtt
ag1928301774 Call-ID a84b4c76e66710 CSeq
314159 INVITE Contact ltsipbob_at_192.0.2.4gt
Content-Type application/sdp Content-Length
131
50Bobs proxy to Alices proxy
SIP/2.0 200 OK Via SIP/2.0/UDP
bigbox3.site3.atlanta.combranchz9hG4bK77ef4c2312
983.1 received192.0.2.2 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
taga6c85cf From Alice ltsipalice_at_atlanta.comgtt
ag1928301774 Call-ID a84b4c76e66710 CSeq
314159 INVITE Contact ltsipbob_at_192.0.2.4gt
Content-Type application/sdp Content-Length
131 (Bob's SDP not shown)
51Alices proxy to Alice
SIP/2.0 200 OK Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds8
received192.0.2.1 To Bob ltsipbob_at_biloxi.comgt
taga6c85cf From Alice ltsipalice_at_atlanta.comgtt
ag1928301774 Call-ID a84b4c76e66710 CSeq
314159 INVITE Contact ltsipbob_at_192.0.2.4gt
Content-Type application/sdp Content-Length
131 (Bob's SDP not shown)
52Alice to Bob
ACK sipbob_at_192.0.2.4 SIP/2.0 Via SIP/2.0/UDP
pc33.atlanta.combranchz9hG4bKnashds9 Max-Forward
s 70 To Bob ltsipbob_at_biloxi.comgttaga6c85cf
From Alice ltsipalice_at_atlanta.comgttag192830177
4 Call-ID a84b4c76e66710 CSeq 314159 ACK
Content-Length 0
53Bob hangs up(Bob to Alice)
BYE sipalice_at_pc33.atlanta.com SIP/2.0 Via
SIP/2.0/UDP 192.0.2.4branchz9hG4bKnashds10
Max-Forwards 70 From Bob ltsipbob_at_biloxi.comgt
taga6c85cf To Alice ltsipalice_at_atlanta.comgttag
1928301774 Call-ID a84b4c76e66710 CSeq 231
BYE Content-Length 0
54Alice to Bob
SIP/2.0 200 OK Via SIP/2.0/UDP
192.0.2.4branchz9hG4bKnashds10 From Bob
ltsipbob_at_biloxi.comgttaga6c85cf To Alice
ltsipalice_at_atlanta.comgttag1928301774 Call-ID
a84b4c76e66710 CSeq 231 BYE Content-Length 0
55Key takeaways
- INVITE transaction has some special cases, other
than that all other requests are the same - A proxy should be able to route a new SIP request
without specifically knowing anything about it
56SIP Authentication
- Basic/Digest, only Digest recommended
- Follows HTTP model
- Hop by Hop, limits use
- UAC sends request, UAS rejects with a 401
Authorization Required with a WWW-Authenticate
header - UAC resends request with appropriate
credentials(Authentication-Info header)
57Authentication flow
alice
Proxy(atlanta.com)
REGISTER/200
INVITE
100
Transaction ends
407
ACK
INVITE(credentials)
58Reading Exercise
- RFC 3665Sections 2.22.53.33.43.73.83.9