SIP Messages [RFC3261] - Omid-Mohajerani/Learn-Kamailio GitHub Wiki

Reference : https://datatracker.ietf.org/doc/html/rfc3261

  • A SIP message is either a request from a client to a server or a response from a server to a client.
  • Both types of messages consist of a start-line, one or more header fields, an empty line indicating the end of the header fields, and an optional message body.

Requests:

  • SIP requests are distinguished by having a Request-Line for a start line.
  • A Request-Line contains a method name, a Request-URI, and the protocol version separated by a single space (SP) character.

Request-URI:

  • The Request-URI is a SIP or SIPS URI as described in Section 19.1 or a general URI (RFC 2396 [5]).
  • It indicates the user or service to which this request is being addressed.
  • The Request-URI MUST NOT contain unescaped spaces or control characters and MUST NOT be enclosed in "<>".

SIP-Version:

  • Both request and response messages include the version of SIP in use and follow.
  • To be compliant with this specification, applications sending SIP messages MUST include a SIP-Version of "SIP/2.0".
  • The SIP-Version string is case-insensitive, but implementations MUST send upper-case.

Method:

This specification defines six methods:

  • REGISTER for registering contact information
  • INVITE, ACK, and CANCEL for setting up sessions
  • BYE for terminating sessions
  • OPTIONS for querying servers about their capabilities

Responses:

  • SIP responses are distinguished from requests by having a Status-Line as their start line.
  • A Status-Line consists of the protocol version followed by a numeric Status-Code and its associated textual phrase, with each element separated by a single SP character.

  • The Status-Code is a 3-digit integer result code that indicates the outcome of an attempt to understand and satisfy a request.

  • The Reason-Phrase is intended to give a short textual description of the Status-Code.

  • The Status-Code is intended for use by automata, whereas the Reason-Phrase is intended for the human user.

  • A client is not required to examine or display the Reason-Phrase.

  • The first digit of the Status-Code defines the class of response.

  • The last two digits do not have any categorization role.

  • For this reason, any response with a status code between 100 and 199 is referred to as a "1xx response", any response with a status code between 200 and 299 as a "2xx response", and so on. SIP/2.0 allows six values for the first digit: