Another SIP dissection session, because the more I read and write about it, the easier it becomes. So let me shed some light on what SIP packets look like and what the actual lines in the message bodies mean.
SIP messages come in two flavors; a status or a request
The start-line of any SIP message, is either a request-line or a status-line and is constructed as follows:
- Method is the function/feature a client is requesting; i.e. REGISTER, INVITE, ACK, BYE,CANCEL, OPTIONS
- Request URI is the address of the endpoint.
Fig.1 below (taken from Wireshark), shows an INVITE (i.e. request with a request line) and then a message header. Remember, message bodies are optional. For instance you would not see them in a delayed offer INVITE, which is what we see below (Fig1).
|Fig.1 - SIP INVITE with request-line and message header|
- Status code is the 3 digits to define the response
- Reason-phrase is the description of the status code
An example of a status message is given below, as a RINGING status update.
|Fig 2 - SIP RINGING status update and message header|
Both Status updates and Requests, contain a message header (again see Fig.1 and 2).
SIP request message bodies must contain the following fields:
- To: logical destination of the request (might not be the ultimate destination) , the resource that we are trying to reach. Typically this line contains a URI.
- From: very similar to the To: header field, the URI is not necissarily the IP address of the endpoint that invoked (in this case) the request.
- CSeq: This sequence number and method, this number orders transactions within a dialogue. INVITE, BYE, OPTIONS are transactions within the same dialogue/call.
- Call-ID; globally unique identifier for the call, no other call will ever use the same ID, this ID will stay the same until the call is terminated.
- Max-Forwards: This is a Time to Live. This value is decremented by every SIP entity in the path. If that value of 70 goes to 0, a 483 message is sent. This Max-Forwards value, prevents loops.
- Via: tells the entities where to send the responses.
for example below, the INVITE, with the message body starting after the SIP/2.0:
If you want to know more about this, I suggest you get stuck into the SIP-topia series on YouTube: