1. Home
  2. SIP Over WebRTC
  3. What is a SIP Message?

What is a SIP Message?

Session Initiation Protocol (SIP) is a signaling protocol used for initiating, maintaining, and terminating real-time sessions that involve voice, video, messaging, and other communications applications and services between two or more endpoints on IP networks. SIP messages are the fundamental building blocks of SIP-based communications, facilitating various operations such as call setup, management, and termination.

Types of SIP Messages

SIP utilizes two types of messages:

  1. Requests – Methods sent by the client to initiate or control a transaction. Examples include INVITE, ACK, BYE, CANCEL, REGISTER, OPTIONS, and UPDATE.
  2. Responses – Replies from the server that indicate the status of the received request. These are numerically coded, similar to HTTP responses (e.g., 200 OK, 404 Not Found).

Common SIP Message Headers

SIP messages consist of several headers that provide essential protocol functionality. Here is an explanation of the most commonly used SIP headers:

  1. Via: This header is used to track the path taken by the request through the network. It is used by SIP proxies to route the responses back to the originator of the request. It includes the protocol version, transport protocol, and the sender’s address.
  2. From: Specifies the initiator of the request. It contains a URI (usually a SIP URI similar to an email address) and optionally a display name. It also includes a tag parameter, which helps in identifying the session.
  3. To: Contains the recipient’s URI and optionally their display name. Like the From header, it may include a tag, but in initial requests, it typically does not.
  4. Call-ID: A unique identifier for the SIP session, shared by all participants in the call. It is crucial for call management and tracking.
  5. CSeq: The Command Sequence header includes a sequence number and the request method (e.g., INVITE). It is used to order transactions within a SIP dialog, ensuring that they are processed in the correct sequence.
  6. Contact: Provides a URI that can be used to contact the user or service identified in the To header. It is used in registration and call-routing processes.
  7. Max-Forwards: Limits the number of times a request can be forwarded by proxies. This prevents loops and too long request paths in the network.
  8. Content-Type: Describes the type of message body attached to the SIP message. Common types include application/sdp, which denotes that the message body contains a Session Description Protocol description.
  9. Content-Length: Indicates the length of the message body in octets. It is critical for determining where the message body ends and the next SIP message begins when multiple SIP messages are sent in a single TCP stream.

Examples of SIP Messages

Example 1: SIP INVITE Request

INVITE sip:user@example.com SIP/2.0
Via: SIP/2.0/UDP host.example.com;branch=z9hG4bKnashds8
To: <sip:user@example.com>
From: "Alice" <sip:alice@example.com>;tag=1928301774
Call-ID: a84b4c76e66710@host.example.com
CSeq: 314159 INVITE
Contact: <sip:alice@host.example.com>
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: 142

(v=0
o=Alice 2890844526 2890844526 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000)

Example 2: SIP 200 OK Response

SIP/2.0 200 OK
Via: SIP/2.0/UDP host.example.com;branch=z9hG4bKnashds8;received=192.0.2.1
From: "Alice" <sip:alice@example.com>;tag=1928301774
To: <sip:user@example.com>;tag=a6c85cf
Call-ID: a84b4c76e66710@host.example.com
CSeq: 314159 INVITE
Contact: <sip:user@example.com>
Content-Type: application/sdp
Content-Length: 131

(v=0
o=user 53655765 2353687637 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 3456 RTP/AVP 0
a=rtpmap:0 PCMU/8000)

These SIP messages and their headers play a vital role in managing the communication sessions. Each header provides specific functionality that ensures proper protocol operation, contributing to the robustness and reliability of SIP-based communications.

SIPERB makes use of the standard SIP messages as its primary messaging protocol for calling. This technique is called SIP over WebRTC. SIPERB follows the default SIP standard according to RFC 3261.

Related Articles