ti sip protocol structure
TRANSCRIPT
SIP Protocol Structure through an Example http://www.tech-invite.com
V2.2 – Nov 26, 2007InitiatingUA Proxy 1
(Stateful)
INVITE
100 Trying
INVITE
ACK
100 Trying
180 Ringing180 Ringing
180 Ringing200 OK
200 OK200 OK
Copyright © 2005-2008 Joël Repiquet. All Rights Reserved. 21 pages
Proxy 3(Stateful)
RespondingUA
Proxy 2(Stateless)
INVITE
180 Ringing
200 OK
INVITE407 Proxy
Authorization Required
INVITE
ACKACK
ACK
BYE
BYEBYE
200 OK200 OK
200 OK
Media Session
This example illustrates, as a slide show, the structure of the SIP protocol, as outlined in chapter 5 of RFC 3261:
"The lowest layer is the transport layer. It defines how a client sends requests and receives responses and how a server receives requests and sends responses over the network. All SIP elements contain a transport layer.
The second layer is the transaction layer. A transaction is a request sent by a client transaction (using the transport layer) to a server transaction, along with all responses to that request sent from the server transaction back to the client. Any task that a user agent client (UAC) accomplishes takes place using a series of transactions. Stateless proxies do not contain a transaction layer.
The layer above the transaction layer is called the transaction user (TU). Each of the SIP entities, except the stateless proxy, is a transaction user."
Note: we set aside the syntax and encoding as the lowest layer.
In this example, the rejection of the first INVITE request, followed by a valid INVITE request, enables the analysis of the processing of the ACK for these two situations.
It is assumed that both Proxy 1 and Proxy 3 stateful proxy servers are in the final signalling path because they requested it in the INVITE requests they routed on.
1
2
3
5
4
4
4
5
4
66
66
77
77
8
8
8
x
x
x
y
y
y
TCPSCTP
TLS
IP
UDP
RTP
TCP SCTP
TLS
IP
UDP
IP IP
server transaction
server transport
clienttransport
proxy coreUAScore
UACcore
client transaction
clienttransport
INVITErequest
request
Initiating UA
receive
request
Proxy 1(Stateful)Open
Session
INVITErequest
SDPOffer
send
server transport
Client Transport:- before sending the request: insert the 'sent-by' parameter in the Via header field
Server Transport:- when receiving the request: by examining the 'sent-by' parameter in the top Via header field, match it to the relevant server transaction and add the "received" parameter
The new "INVITE" client transaction (state="calling") is identified by the CSeq header field and the "branch" parameter of the Via header field. T1 timer is started (if UDP) before passing message request to transport.
The UAC (User Agent Client) TU:- creates the initial INVITE request- creates a new client transaction (in the transaction layer) and passes it the INVITE message, plus the IP address, port and transport
The new "INVITE" server transaction (state="proceeding") is created by the proxy core (not acting as TU). The server transaction transmits the INVITE request to the TU and somehow knows that this TU will generate a response within 200ms: it does not send back a 100 Trying response.
The proxy core TU first validates the INVITE request. It cannot authenticate the originator because no credentials are provided. It rejects the request by sending back (see next slide) a 407 (Proxy Authentication Required) response.
INV/br-a0 INV/br-a1
SIP Transport Layer
SIP Transaction Layer
SIP Transaction User (TU)
1
SIP Protocol Structure through an Example (1)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
TCP SCTP
TLS
IP
UDPTCPSCTP
TLS
IP
UDP
RTP
server transaction
server transport
clienttransport
proxy coreUAScore
UACcore
client transaction
clienttransport
ACK(request)
Initiating UA
receive
request
Proxy 1(Stateful)
ACK
response
send
server transport
Client Transport:- when receiving the response: match it to the relevant client transaction by examining 'sent-by' parameter in top Via header field- before sending the (ACK) request: insert 'sent-by' parameter in Via header field
Server Transport:- before sending the response: retrieve IP@ & port from 'sent-by' and "received"- when receiving the (ACK) request: by examining 'sent-by' parameter in top Via header field, match it to relevant server transaction + add "received" parameter
When receiving the 407 response, the client transitions to state="completed", passes the response up to the TU, generates an ACK, and passes it to transport. D timer started. When D timer fires, the client transaction is destroyed.
The UAC analyses the response and prepares a new INVITE request.
The server transaction enters the "completed" state and passes the 407 response to transport.When ACK (request) is received: passes to "confirmed" state and starts I timer. When I timer fires, the server transaction is destroyed.
The proxy core TU:sends back a 407 (Proxy Authentication Required) response
INV/br-a0 INV/br-a0
SIP Transport Layer
SIP Transaction Layer
SIP Transaction User (TU)
receive
response
407response
407response
2
response
send
3
SIP Protocol Structure through an Example (2)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IP IP
TCP SCTP
TLS
IP
UDPTCPSCTP
TLS
IP
UDP
RTP
server transaction
server transport
clienttransport
proxy coreUAScore
UACcore
client transaction
clienttransport
INVITErequest
request
Initiating UA
receive
request
Proxy 1(Stateful)
INVITErequest
receive
response
100(Trying)
100 (Trying) response
sendsend
server transport
The new "INVITE" client transaction (state="calling") is identified by CSeq header field and "branch" parameter of Via header field. T1 timer started (if UDP) before passing message request to transport. When receiving 1xx response: state="proceeding" and T1 reset.
The UAC (User Agent Client) TU:(1) creates the new INVITE request containing the correct credentials(2) creates a new client transaction and passes it the INVITE message, plus the IP address, port and transport
The new "INVITE" server transaction (identified by CSeq header field and "branch" parameter of Via header field) is created by proxy core (not acting as TU). The server transaction sends back a 100 Trying response and transmits the INVITE request to proxy core (acting as TU).
The proxy core TU:(1) validates the request(2) determines the target for the request(3) forwards the request (see next slide) towards the target
INV/br-a1 INV/br-a1
4
SIP Transport Layer
SIP Transaction Layer
SIP Transaction User (TU)
Client & Server Transport main behavior, whatever the system:
Server: (1) when receiving a request: by examining 'sent-by' parameter in top Via header field, match it to relevant server transaction + add "received" parameter; (2) before sending a response: retrieve IP@ and port from 'sent-by' and "received"
Client: (1) before sending a request: insert 'sent-by' parameter in Via header field (2) when receiving a response: match it to relevant client transaction by examining 'sent-by' parameter in top Via header field
SIP Protocol Structure through an Example (3)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IP IP
5
TCP SCTP
TLS
IP
UDPTCP SCTP
TLS
IP
UDPTCP SCTP
TLS
IP
UDP
proxy coreserver
transaction
clienttransport
server transport
server transport
clienttransport
clienttransport
server transport
proxy core
server transaction
client transaction
Proxy 1(Stateful)
Proxy 3(Stateful)
proxy core
receive
request
INVITErequest
request
send
Proxy 2(Stateless)
send
receive
INVITErequest
request
request
receivesend
response100 (Trying)
response
INV/br-x10 INV/br-x10INV/br-a1
For forwarding the INVITE request, the proxy core creates a new client transaction
The proxy core TU:(1) validates the request(2) determines the target for the request(3) forwards the request (see next slide) towards the target
There is no Transaction Management with a stateless
proxy
SIP Protocol Structure through an Example (4)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IP IP
4
5
TCP SCTP
TLS
IP
UDP
RTP
TCPSCTP
TLS
IP
UDP
IPIP
server transport
clienttransport
server transaction
UACcore
UAScore
proxy core
client transaction
server transaction
clienttransport
server transport
INVITErequest
request
send
Responding UA
Proxy 3(Stateful)
request
receive
INVITErequest
SDPOffer
response
send
response
180(Ringing)
receive
180 (Ringing)response
INV/br-x30 INV/br-x30INV/br-x10
For forwarding the INVITE request, the proxy core creates a new client transaction
SIP Protocol Structure through an Example (5)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
4 6
TCP SCTP
TLS
IP
UDPTCP SCTP
TLS
IP
UDPTCP SCTP
TLS
IP
UDP
proxy coreclient
transactionserver
transaction
clienttransport
server transport
server transport
clienttransport
clienttransport
server transport
proxy core
server transaction
client transaction
Proxy 1(Stateful)
Proxy 3(Stateful)
proxy core
Proxy 2(Stateless)
receive
sendsend
response
responseresponse
receive
response
180(Ringing)
180(Ringing)
INV/br-x10 INV/br-x10INV/br-a1 INV/br-x30
SIP Protocol Structure through an Example (6)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IP IP
6
6
TCPSCTP
TLS
IP
UDP
RTP
TCP SCTP
TLS
IP
UDP
IP IP
client transaction
server transaction
server transport
clienttransport
proxy coreUAScore
UACcore
client transaction
clienttransport
Initiating UA
Proxy 1(Stateful)
receive
response
180(Ringing)
send
server transport
response
180(Ringing)
INV/br-a1INV/br-a1 INV/br-x10
SIP Protocol Structure through an Example (7)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
6
TCP SCTP
TLS
IP
UDP
RTP
TCPSCTP
TLS
IP
UDP
IPIP
server transport
clienttransport
server transaction
UACcore
UAScore
proxy core
client transaction
server transaction
clienttransport
server transport
Responding UA
Proxy 3(Stateful)
response
send
response
200(OK)
receive
200 (OK)response
SDPAnswer
INV/br-x30INV/br-x30INV/br-x10
Retransmissions of 200 OK (whatever the UA transport protocol) are handled by the UAS core, not the transaction layer. The 200 OK response retransmission (if any) is passed to the transport with an interval that starts at T1 seconds and doubles for each retransmission until it reaches T2 seconds.
The INVITE server transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the transport.
The INVITE client transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the proxy core TU.
SIP Protocol Structure through an Example (8)
The callee answers the call, and an SDP answer is communicated to the UAS core
http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
7
proxy coreserver
transaction
clienttransport
server transport
server transport
clienttransport
clienttransport
server transport
proxy core
server transaction
client transaction
TCP SCTP
TLS
IP
UDP TCP SCTP
TLS
IP
UDP TCP SCTP
TLS
IP
UDP
Proxy 1(Stateful)
Proxy 3(Stateful)
proxy core
Proxy 2(Stateless)
receive
sendsend
response
responseresponse
receive
IP IP
response
200(OK)
200(OK)
INV/br-x10INV/br-x10INV/br-a1 The INVITE server transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the transport.
The INVITE client transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the proxy core TU.
SIP Protocol Structure through an Example (9)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
7
7
TCPSCTP
TLS
IP
UDP
RTP
TCP SCTP
TLS
IP
UDP
IP IP
server transaction
server transport
clienttransport
proxy coreUAScore
UACcore
client transaction
clienttransport
Initiating UA
Proxy 1(Stateful)
receive
response
200(OK)
send
server transport
response
200(OK)
INV/br-a1INV/br-a1
SDPAnswer
The INVITE server transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the transport.
The INVITE client transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the UAC core TU.
SIP Protocol Structure through an Example (10)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
7
TCP SCTP
TLS
IP
UDPTCPSCTP
TLS
IP
UDP
RTP
server transport
clienttransport
proxy coreUAScore
UACcore
clienttransport
Initiating UA
Proxy 1(Stateful)
server transport
ACKrequest
send receive
ACKrequest
SIP Protocol Structure through an Example (11)
The ACK request (following a 2xx final response) is passed to the transport layer directly for transmission
http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IP IP
8
TCP SCTP
TLS
IP
UDP
clienttransport
server transport
clienttransport
server transport
proxy core
Proxy 1(Stateful)
Proxy 3(Stateful)
proxy core
ACKrequest
send receive
ACKrequest
SIP Protocol Structure through an Example (12)
Both Proxy 1 and Proxy 3 stateful proxy servers are in the final signalling path because they requested it in the INVITE request they routed on.
http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
8
TCP SCTP
TLS
IP
UDP
IP IPIP
TCPSCTP
TLS
IP
UDP TCP SCTP
TLS
IP
UDP
RTP
server transport
clienttransport
UACcore
UAScore
proxy core
clienttransport
server transport
Responding UA
Proxy 3(Stateful)
ACKrequest
send receive
ACKrequest
SIP Protocol Structure through an Example (13)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IPIP
8
UAScore
UACcore
clienttransport
Initiating UA
server transport
server transport
clienttransport
UACcore
UAScore
Responding UA
Media part Media part
SIP Protocol Structure through an Example (14)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
TCPSCTP
TLS
IP
UDP
RTP
IP IP
TCP SCTP
TLS
IP
UDP
RTP
TCP SCTP
TLS
IP
UDP
RTP
TCPSCTP
TLS
IP
UDP
server transport
clienttransport
UAScore
UACcore
client transaction
clienttransport
Responding UA
BYErequest
request
send
BYE/br-b1
proxy core
Proxy 3(Stateful)
server transaction
request
receive
BYErequest
BYE/br-b1
SIP Protocol Structure through an Example (15)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IPIP
server transport
x
TCP SCTP
TLS
IP
UDPTCP SCTP
TLS
IP
UDP
server transport
clienttransport
proxy core
Proxy 1(Stateful)
Proxy 3(Stateful)
proxy core
clienttransport
server transport
server transaction
BYE/br-b1
client transaction
BYE/br-b31
BYErequest
request
send
server transaction
BYE/br-b31
request
receive
BYErequest
SIP Protocol Structure through an Example (16)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
IP IPIP
x
TCPSCTP
TLS
IP
UDP
RTP
TCP SCTP
TLS
IP
UDP
IP IP
clienttransport
server transport
proxy core
Initiating UA
Proxy 1(Stateful)
server transaction
BYE/br-b31
client transaction
BYE/br-b11
BYErequest
request
send
UACcore
UAScore
server transport
clienttransport
server transaction
BYE/br-b11
request
receive
BYErequest
SIP Protocol Structure through an Example (17)http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
x
TCPSCTP
TLS
IP
UDP
RTP
TCP SCTP
TLS
IP
UDP
IP IP
clienttransport
server transport
proxy core
Initiating UA
Proxy 1(Stateful)
server transaction
BYE/br-b31
client transaction
BYE/br-b11
UACcore
UAScore
server transport
clienttransport
server transaction
BYE/br-b11
response
send
200(OK)
response
receive
200(OK)
SIP Protocol Structure through an Example (18)
The BYE server transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the transport.
The BYE client transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the proxy core TU.
http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
y
TCP SCTP
TLS
IP
UDP TCP SCTP
TLS
IP
UDP
server transport
clienttransport
proxy core
Proxy 1(Stateful)
Proxy 3(Stateful)
proxy core
clienttransport
server transport
server transaction
BYE/br-b1
client transaction
BYE/br-b31
server transaction
BYE/br-b31
response
send
200(OK)
response
receive
200(OK)
SIP Protocol Structure through an Example (19)
The BYE server transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the transport.
The BYE client transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the proxy core TU.
http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
y
IP IPIP
TCP SCTP
TLS
IP
UDP
RTP
TCPSCTP
TLS
IP
UDP
IPIP
server transport
clienttransport
UAScore
UACcore
client transaction
clienttransport
Responding UA
BYE/br-b1
proxy core
Proxy 3(Stateful)
server transaction
BYE/br-b1
response
send
200(OK)
response
receive
200(OK)
SIP Protocol Structure through an Example (end)
The BYE server transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the transport.
The BYE client transaction is destroyed as soon as it receives the 200 (OK) response and passes it to the UAC core TU.
http://www.tech-invite.comCopyright © 2005-2008 Joël Repiquet. All Rights Reserved.
y
server transport