- Session Initiation Protocol Tutorial
- SIP - Home
- SIP - Introduction
- SIP - Network Elements
- SIP - Basic Call Flow
- SIP - Messaging
- SIP - Response Codes
- SIP - Headers
- SIP - Session Description Protocol
- SIP - The Offer/Answer Model
- SIP - Mobility
- SIP - Forking
- SIP - Proxies & Routing
- SIP to PSTN
- SIP - Codecs
- SIP - B2BUA
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
SIP - Messaging
SIP messages are of two types − requests and responses.
The opening line of a request contains a method that defines the request, and a Request-URI that defines where the request is to be sent.
Similarly, the opening line of a response contains a response code.
SIP requests are the codes used to establish a communication. To complement them, there are SIP responses that generally indicate whether a request succeeded or failed.
These SIP requests which are known as METHODS make SIP message workable.
METHODS can be regarded as SIP requests, since they request a specific action to be taken by another user agent or server.
METHODS are distinguished into two types −
There are six core methods as discussed below.
INVITE is used to initiate a session with a user agent. In other words, an INVITE method is used to establish a media session between the user agents.
INVITE can contain the media information of the caller in the message body.
A session is considered established if an INVITE has received a success response(2xx) or an ACK has been sent.
A successful INVITE request establishes a dialog between the two user agents which continues until a BYE is sent to terminate the session.
An INVITE sent within an established dialog is known as a re-INVITE.
Re-INVITE is used to change the session characteristics or refresh the state of a dialog.
The following code shows how INVITE is used.
INVITE sips:Bob@TMC.com SIP/2.0 Via: SIP/2.0/TLS client.ANC.com:5061;branch = z9hG4bK74bf9 Max-Forwards: 70 From: Alice<sips:Alice@TTP.com>;tag = 1234567 To: Bob<sips:Bob@TMC.com> Call-ID: email@example.com CSeq: 1 INVITE Contact: <sips:Alice@client.ANC.com> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY Supported: replaces Content-Type: application/sdp Content-Length: ... v = 0 o = Alice 2890844526 2890844526 IN IP4 client.ANC.com s = Session SDP c = IN IP4 client.ANC.com t = 3034423619 0 m = audio 49170 RTP/AVP 0 a = rtpmap:0 PCMU/8000
BYE is the method used to terminate an established session. This is a SIP request that can be sent by either the caller or the callee to end a session.
It cannot be sent by a proxy server.
BYE request normally routes end to end, bypassing the proxy server.
BYE cannot be sent to a pending an INVITE or an unestablished session.
REGISTER request performs the registration of a user agent. This request is sent by a user agent to a registrar server.
The REGISTER request may be forwarded or proxied until it reaches an authoritative registrar of the specified domain.
It carries the AOR (Address of Record) in the To header of the user that is being registered.
REGISTER request contains the time period (3600sec).
One user agent can send a REGISTER request on behalf of another user agent. This is known as third-party registration. Here, the From tag contains the URI of the party submitting the registration on behalf of the party identified in the To header.
CANCEL is used to terminate a session which is not established. User agents use this request to cancel a pending call attempt initiated earlier.
It can be sent either by a user agent or a proxy server.
CANCEL is a hop by hop request, i.e., it goes through the elements between the user agent and receives the response generated by the next stateful element.
ACK is used to acknowledge the final responses to an INVITE method. An ACK always goes in the direction of INVITE.ACK may contain SDP body (media characteristics), if it is not available in INVITE.
ACK may not be used to modify the media description that has already been sent in the initial INVITE.
A stateful proxy receiving an ACK must determine whether or not the ACK should be forwarded downstream to another proxy or user agent.
For 2xx responses, ACK is end to end, but for all other final responses, it works on hop by hop basis when stateful proxies are involved.
OPTIONS method is used to query a user agent or a proxy server about its capabilities and discover its current availability. The response to a request lists the capabilities of the user agent or server. A proxy never generates an OPTIONS request.
SUBSCRIBE is used by user agents to establish a subscription for the purpose of getting notification about a particular event.
It contains an Expires header field that indicates the duration of a subscription.
After the time period passes, the subscription will automatically terminate.
Subscription establishes a dialog between the user agents.
You can re-subscription again by sending another SUBSCRIBE within the dialog before the expiration time.
A 200 OK will be received for a subscription from User.
Users can unsubscribe by sending another SUBSCRIBE method with Expires value 0(zero).
NOTIFY is used by user agents to get the occurrence of a particular event. Usually a NOTIFY will trigger within a dialog when a subscription exists between the subscriber and the notifier.
Every NOTIFY will get 200 OK response if it is received by notifier.
NOTIFY contain an Event header field indicating the event and a subscriptionstate header field indicating the current state of the subscription.
A NOTIFY is always sent at the start and termination of a subscription.
PUBLISH is used by a user agent to send event state information to a server.
PUBLISH is mostly useful when there are multiple sources of event information.
A PUBLISH request is similar to a NOTIFY, except that it is not sent in a dialog.
A PUBLISH request must contain an Expires header field and a Min-Expires header field.
REFER is used by a user agent to refer another user agent to access a URI for the dialog.
REFER must contain a Refer-To header. This is a mandatory header for REFER.
REFER can be sent inside or outside a dialog.
A 202 Accepted will trigger a REFER request which indicates that other user agent has accepted the reference.
INFO is used by a user agent to send call signalling information to another user agent with which it has established a media session.
This is an end-to-end request.
A proxy will always forward an INFO request.
UPDATE is used to modify the state of a session if a session is not established. User could change the codec with UPDATE.
IF a session is established, a re-Invite is used to change/update the session.
PRACK is used to acknowledge the receipt of a reliable transfer of provisional response (1XX).
Generally PRACK is generated by a client when it receive a provisional response containing an RSeq reliable sequence number and a supported:100rel header.
PRACK contains (RSeq + CSeq) value in the rack header.
The PRACK method applies to all provisional responses except the 100 Trying response, which is never reliably transported.
A PRACK may contain a message body; it may be used for offer/answer exchange.
It is used to send an instant message using SIP. An IM usually consists of short messages exchanged in real time by participants engaged in text conversation.
MESSAGE can be sent within a dialog or outside a dialog.
The contents of a MESSAGE are carried in the message body as a MIME attachment.
A 200 OK response is normally received to indicate that the message has been delivered at its destination.