310 likes | 704 Views
SIP (Session Initiation Protocol) - SIP Messages. Contents. A Simple SIP Example SIP Message - Request Message RFC2543 (INVITE, REGISTER, BYE, ACK, CANCEL,OPTION) INTERNET-DRAFTS (INFO, PRACK) - Response Message. A Simple SIP Example(1). Tesla. Marconi. INVITE. 180 Ringing. 200 OK.
E N D
Contents • A Simple SIP Example • SIP Message - Request Message RFC2543 (INVITE, REGISTER, BYE, ACK, CANCEL,OPTION) INTERNET-DRAFTS (INFO, PRACK) - Response Message
A Simple SIP Example(1) Tesla Marconi INVITE 180 Ringing 200 OK ACK Media Session BYE 200 OK
A Simple SIP Example(2) INVITE sip:marconi@radio.org SIP/2.0 Start line Via: SIP/2.0/UDP lab.high-voltage.org:5060 To: G. Marconi <sip:Marconi@radio.org> From: Nikola Tesla <sip:n.tesla@high-voltage.org> Call-ID: 123456789@lab.high-voltage.org CSeq: 1 INVITE Subject: About That Power Outage… Contact: sip:n.tesla@high-voltage.org Content-type: application/sdp Content-Length: 158 minimum required header set Message Header CRLF v=0 o=Tesla 2890844526 2890844526 IN IP4 lab.high-voltage.org s=Phone Call c=IN IP4 100.101.102.103 t=0 0 m=audio 49170 RTP/AVP 0 a=rtpmap:0 PCMU/8000 Message Body
A Simple SIP Example(3) SIP/2.0 180 Ringing Via: SIP/2.0/UDP lab.high-voltage.org:5060 To: G. Marconi <sip:Marconi@radio.org> From: Nikola Tesla <sip:n.tesla@high-voltage.org> Call-ID: 123456789@lab.high-voltage.org CSeq: 1 INVITE Content-Length: 0 - Copying many of the Headers from the INVITE message, including the Via, To, From, Call-ID, and CSeq - To and From headers are not reversed(To and From headers are Defined to indicate the direction of the request)
A Simple SIP Example(4) SIP/2.0 200 OK .. Contact: sip:marconi@radio.org Content-type: application/sdp Content-Length: 155 v=0 o=heisenberg 2890844526 2890844526 IN IP4 200.201.202.203 s=Phone Call c=IN IP4 200.201.202.203 t=0 0 m=audio 49172 RTP/AVP 0 a=rtpmap:0 PCMU/8000 UAS Media Capability - When the called party decides to accept the call, a 200 OK response is sent
A Simple SIP Example(5) ACK sip:marconi@radio.org SIP/2.0 Via: SIP/2.0/UDP lab.high-voltage.org:5060 To: G. Marconi <sip:marconi@radio.org> From: Nikola Tesla <sip:n.tesla@high-voltage.org> Call-ID: 123456789@lab.high-voltage.org CSeq: 1 ACK Content-Length: 0 - ACK Method means that UAC can support the media session proposed by UAS - At this point , the media session begins using the media information carried in the SIP messages. - In TCP , connection is safely closed after sending ACK Method
A Simple SIP Example(6) BYE sip:n.tesla@high-voltage.org SIP/2.0 - SIP-enabled device must contain both SIP server and SIP client software Via: SIP/2.0/UDP tower.radio.org:5060 To: Nikola Tesla <sip:n.tesla@high-voltage.org> From: Marconi <sip:marconi@radio.org> Call-ID: 123456789@lab.high-voltage.org CSeq: 1 BYE Content-Length: 0 - To and From headers are reversed but Tesla is able to identify the call leg and tear down the correct media session SIP/2.0 200 OK .. ..
SIP Messages • Method(RFC2543) - INVITE, REGISTER, BYE, ACK, CANCEL, OPTIONS • Internet-Drafts Method - INFO, PRACK • Response Messages
INVITE method • Establish media sessions between user agents • It usually has a message body containing the media information - If it dose not have, the ACK contains the media information • re-INVITE - An INVITE sent for an existing call leg references the same Call-ID as the original INVITE - Changing the session characteristics. - CSeq is incremented • Request-URI is able to contain a phone number ex) INVITE <sip:411@salzburg.aut>;user=phone SIP/2.0
REGISTER method REGISTER sip:registrar.munich.de SIP/2.0 .. Contact: sip:werner.heisenberg@munich.de • The REGISTER method is used by a user agent to notify a SIP network of its current IP address and the URLs for which it would like to receive calls • Request-URI contains only the domain of the registrar Server with no user portion • Example(Contact, Expires header & expires parameter) 200 OK Contact: * Expires: 0 Contact: sip:galvani@bologna.edu.it; expires=30 Contact: sip:galvani@bologa.edu.it; Expires: 30
BYE method • It is used to terminate an established media session • A BYE is send only by user agents participating in the session, never by proxies or other third parties • A BYE can be sent by either the caller or the called party in a session. • BYE always increments the CSeq
ACK method • The ACK method is used to acknowledge final responses to INVITE requests • ACK is never incremented for an ACK - A UAS can match the CSeq number of the ACK with the number of the corresponding INVITE • An ACK may contain an message body, but can not be used to modify a media description
CANCEL method(1) • The CANCEL method is used to terminate pending searches or call attempts • A forking proxy can use the CANCEL method. • The CANCEL method dose not increment the CSeq • - UA can match the CSeq of the CANCEL with the CSeq of the pending INVITE Calling user agent Forking proxy server
CANCEL method(2) • CANCEL method is a hop-by-hop request • If a final response has already been received, a user agent should not generate a CANCEL UAC Stateful Proxy UAS INVITE CSeq: 1 INVITE INVITE CSeq: 1 INVITE 100 Trying CSeq: 1 INVITE 100 Trying CSeq: 1 INVITE CANCEL CSeq: 1 CANCEL 200 OK CSeq: 1 INVITE 200 OK CSeq: 1 CANCEL CANCEL CSeq: 1 CANCEL 200 OK CSeq: 1 INVITE 200 OK CSeq: 1 CANCEL ACK CSeq: 1 ACK BYE CSeq: 2 BYE 200 OK CSeq: 2BYE
OPTIONS method • The OPTION method is used to query a user agent or server about its capabilities and discover its current availability OPTIONS sip:proxy.carrier.com SIP/2.0 Via: SIP/2.0/UDP cavendish.kings.cambridge.edu.uk To: sip:proxy.carrier.com From: J.C. Maxwell <sip:james.maxwell@kings.cambridge.edu.uk> CSeq: 1 OPTIONS Content-Length: 0 SIP/2.0 200 OK Via: SIP/2.0/UDP cavendish.kings.cambridge.edu.uk;tag=512A6 To: sip:proxy.carrier.com From: J.C. Maxwell <sip:james.maxwell@kings.cambridge.edu.uk> Call-ID: 9352812@cavendish.kings.cambridge.edu.uk Cseq: 1 OPTIONS Allow: INVITE, OPTION, ACK, BYE, CANCEL, REGISTER Accept-Language: en, de, fr Content-Length: 0
INFO & PRACK method(1) • INFO method - It is used by UA to send call signaling information to another user agent with which it has an established media session. • PRACK - It is used to acknowlegde receipt of reliably transported provisional responses(1XX)
INFO & PRACK method(2) UAS UAC INVITE Supported:100rel CSeq: 1 INVITE 100 Trying CSeq: 1 INVITE 180 Ringing CSeq: 1 INVITE RSeq: 314 T1 180 Ringing CSeq: 1 INVITE RSeq: 314 PRACK CSeq: 2 PRACK RAck: 314 1 INVITE 200 OK CSeq: 2 PRACK 200 OK CSeq: 1 INVITE ACK CSeq: 1 ACK Media Session
Response Messages(1) • A SIP response is a message generated by a UAS or a SIP server to reply to a request generated by a UAC • The reason phrase is for human consumption only - 200 Call Failed = 200 OK • Informational class response(1XX) - It is used to indicate call progress - The first informational response received by the UAC confirms receipt of the INVITE, and stops retransmission of the INVITE ( ex)180 Ringing)
Response Messages(2) • Success 200 OK - When used to accept a session invitation( ex) INVITE ) - Successful completion of the request( ex) PRACK ) • Redirection class response(3XX) - It is generally sent by a SIP server acting as a redirect server in response to an INVITE - There is no requirement that a UAC receiving a redirection response must retry the request to the specified address. - UAC could be configured to automatically generate a new INVITE upon receipt of a redirection class response without requiring user intervention
Response Messages(3) • Client Error(4XX) - It is used by a server or UAS to indicate that the request cannot be fulfilled as it was submitted - 400 Bad Request , 401 Unauthorized, 404 Not Found .. • Server Error(5XX) - The request cannot be processed because of an error with the server - The response may contain a Retry-After header if the server anticipates being available within a specific time period - 501 Not Implemented, 505 Version Not Supported
Response Messages(4) • Global Error(6XX) - The Server knows that the request will fail wherever it is tried. As a result the request should not be sent to other locations - 604 Dose Not Exist Anywhere It is similar to the 404 Not found but indicates that the user in the Request-URI cannot be found anywhere.