Home | Tutorials | Resources | Books | Feedback | About us


VoIP

SIP
  Introduction
  A Brief History of SIP
  What it does & what it doesn't
  Components in SIP
  SIP Commands
  A typical example
  SIP request
  SIP response
  Types of Responses
  Relation among Call, Dialog, Transaction, Message
  SIP Registration
  Conclusion

RTP

SDP


 

Go to Previous Go to Next

Request Message Format of SIP

Back already! Well, let's continue.

In the previous SIP session example we have seen that requests are sent by clients to servers. We will now discuss what that request actually contains. The following is the format of INVITE request as sent by user1.

INVITE sip:user2@server2.com SIP/2.0
Via: SIP/2.0/UDP pc33.server1.com;branch=z9hG4bK776asdhds Max-Forwards: 70
To: user2 <sip:user2@server2.com>
From: user1 <sip:user1@server1.com>;tag=1928301774
Call-ID: a84b4c76e66710@pc33.server1.com
CSeq: 314159 INVITE
Contact: <sip:user1@pc33.server1.com>
Content-Type: application/sdp
Content-Length: 142

---- User1 Message Body Not Shown ----

The first line of the text-encoded message is called Request-Line. It identifies that the message is a request.

Request-Line
Method SP Request-URI SP SIP-Version CRLF
[SP = single-space & CRLF=Carriage Return + Line Feed (i.e. the character inserted when you press the "Enter" or "Return" key of your computer)]
Here method is INVITE, request-uri is "user2@server2.com" and SIP version is 2.
The following lines are a set of header fields.

  • Via:
    It contains the local address of user1 i.e. pc33.server1.com where it is expecting the responses to come.
    • Max-Forward:
      It is used to limit the number of hops that this request may take before reaching the recipient. It is decreased by one at each hop. It is necessary to prevent the request from traveling forever in case it is trapped in a loop.
  • To:
    It contains a display name "user2" and a SIP or SIPS URI <user2@server2.com>
  • From:
    It also contains a display name "user1" and a SIP or SIPS URI <user1@server1.com>. It also contains a tag which is a pseudo-random sequence inserted by the SIP application. It works as an identifier of the caller in the dialog.
  • Call-ID:
    It is a globally unique identifier of the call generated as the combination of a pseudo-random string and the softphone's IP address.
         The Call-ID is unique for a call. A call may contain several dialogs. Each dialog is uniquely identified by a combination of From, To and Call-ID. If you are in confusion click here.
  • CSeq:
    It contains an integer and a method name. When a transaction starts, the first message is given a random CSeq. After that it is incremented by one with each new message. It is used to detect non-delivery of a message or out-of-order delivery of messages.
  • Contact:
    It contains a SIP or SIPS URI that is a direct route to user1. It contains a username and a fully qualified domain name(FQDN). It may also have an IP address.
         Via field is used to send the response to the request. Contact field is used to send future requests. That is why the 200 OK response from user2 goes to user1 through proxies. But when user2 generates a BYE request (a new request and not a response to INVITE), it goes directly to user1 bypassing the proxies.
  • Content-Type:
    It contains a description of the message body (not shown).
  • Content-Length:
    It is an octet (byte) count of the message body.

The header may contain other header fields also. However those fields are optional. Please note that the body of the message is not shown here. The body is used to convey information about the media session written in Session Description Protocol (SDP). You may continue your journey through SIP without worrying about SDP right now. However it doesn't hurt to take a peep.

Your SIP request is waiting to get a SIP response message.

 

Go to Previous Go to Next


If you have any suggestion, correction, query just mail to koushik.banerjeeATgmail.com
© 2005-2018 K.Banerjee
Last updated: March 1st, 2018