Exploring the Power of the SIP Protocol in VoIP Communications

Exploring the Power of the SIP Protocol in VoIP Communications
Foto de Maarten van den Heuvel en Unsplash

One technology that has revolutionized the way we communicate is Voice over Internet Protocol (VoIP). This technology allows us to make phone calls over the Internet, eliminating the need for traditional phone lines. Behind the scenes, a protocol called Session Initiation Protocol (SIP) facilitates these interactions. At the heart of Next Generation Emergency Call's (NG911) VoIP-enabled communication lies the Session Initiation Protocol (SIP).

At Zaleos, we're really into SIP and in this blog post, we will dive into the realm of SIP, exploring its significance, working principles, and impact on modern communication. We will also cover SIP messages, transactions, and dialogs.


What is SIP?

SIP, short for Session Initiation Protocol, is a signaling protocol used to establish, modify, and terminate communication sessions over IP networks. SIP enables voice, video, and other real-time communication services across the Internet.

It operates on a client-server model, where the client initiates the session and the server responds to the client's requests. The client, also known as the User Agent Client (UAC), sends a SIP request to the server, known as the User Agent Server (UAS). The UAS processes the request and sends back a response to the UAC. Note that in a typical SIP dialog, it is possible and even likely for the UAC and UAS roles to be reversed, depending on which end of the call is sending a request.

The Core Principles of SIP

The core principles of SIP in NG911 provide the foundational communication framework for emergency calls:

  1. Session Establishment: SIP initiates communication sessions between various devices, enabling users to invite others, negotiate session parameters, and establish connections.
  2. User Location: SIP decouples logical user addresses (SIP URI) from physical locations, allowing seamless device and network changes while maintaining consistent contact information.
  3. Session Management: SIP not only establishes sessions but also supports ongoing management, including call forwarding, transfer, hold, and other features for an enhanced user experience and reliable communication.
  4. Media Negotiation: SIP handles the negotiation of media types and codecs, ensuring agreement between endpoints on the optimal voice, video, or text format for transmission.

Diving into technical SIP details


Messages - What are SIP messages?
A SIP message is a packet of information. There are two main types of SIP messages:

  1. SIP Requests: SIP requests are sent by UACs to initiate actions or commands. The most common SIP request is the INVITE request, which is used to initiate a new session.
  2. SIP Responses: SIP responses are sent by UASs in response to SIP requests. They convey the result or status of the request. SIP responses are categorized into six groups based on their status codes: 1xx (Provisional), 2xx (Successful), 3xx (Redirection), 4xx (Client Error), 5xx (Server Error), and 6xx (Global Failure).

Examples of most popular SIP messages:

INVITE sip:recipient@example.com SIP/2.0
Via: SIP/2.0/UDP client.example.com:5060;branch=z9hG4bK74bf9
Max-Forwards: 70
From: <sip:sender@example.com>;tag=as5b88e2ae
To: <sip:recipient@example.com>
Call-ID: 1234567890@client.example.com
CSeq: 101 INVITE
Contact: <sip:sender@example.com>
Content-Type: application/sdp
Content-Length: 142

v=0
o=user1 53655765 2353687637 IN IP4 client.example.com
s=-
c=IN IP4 client.example.com
t=0 0
m=audio 7070 RTP/AVP 0
a=rtpmap:0 PCMU/8000

SIP INVITE Request

SIP/2.0 100 Trying
Via: SIP/2.0/UDP client.example.com:5060;branch=z9hG4bK74bf9
From: <sip:sender@example.com>;tag=as5b88e2ae
To: <sip:recipient@example.com>;tag=1a2b3c4d5e
Call-ID: 1234567890@client.example.com
CSeq: 101 INVITE
Content-Length: 0

SIP 100 Trying Response

BYE sip:recipient@example.com SIP/2.0
Via: SIP/2.0/UDP client.example.com:5060;branch=z9hG4bK74bf9
From: <sip:sender@example.com>;tag=as5b88e2ae
To: <sip:recipient@example.com>;tag=1a2b3c4d5e
Call-ID: 1234567890@client.example.com
CSeq: 102 BYE
Content-Length: 0

SIP BYE Request

Transactions - What are SIP transactions?
A SIP transaction represents a complete request-response exchange between a SIP client (User Agent Client - UAC) and a SIP server (User Agent Server - UAS) within a SIP communication session. Transactions are essential for reliable message delivery and are divided into two types: non-INVITE and INVITE transactions.

  1. Non-INVITE Transaction: This type of transaction involves SIP methods other than INVITE, such as REGISTER (for user registration) or BYE (to terminate a call). Non-INVITE transactions are simple and consist of a single request followed by one or more responses.
  2. INVITE Transaction: INVITE transactions are more complex and consist of a three-way handshake: INVITE request, followed by one or more provisional responses (1xx series), and finally a final response (2xx, 3xx, 4xx, 5xx, 6xx series) indicating the outcome of the transaction. INVITE transactions are used to establish new sessions, and they include call setup and media negotiation.

Identifying SIP transactions
Transactions are uniquely identified and managed using a combination of the following elements:

  • Call-ID: A globally unique identifier that associates all messages within a single call or session.
  • CSeq (Sequence Number): A numerical value that increases with each new SIP request within the transaction, allowing the receiving party to maintain proper message ordering.
  • From tag: A locally unique identifier for the sender of the SIP request.
  • To tag: A locally unique identifier for the recipient of the SIP request.

SIP Dialogs - What are SIP dialogs?
A SIP dialog is a peer-to-peer communication relationship between two user agents (UAs) within a SIP session. If the combination of the Call-ID, From tag, and To tag matches an existing dialog, the message is associated with that dialog. This allows the entities to maintain the context of the ongoing session and handle messages accordingly. For example, let's consider a SIP dialog for a two-party voice call:

Call-ID: 1234567890@client.example.com
From: <sip:sender@example.com>;tag=as5b88e2ae
To: <sip:recipient@example.com>;tag=1a2b3c4d5e

In this case, the Call-ID is "1234567890@client.example.com," and the From and To tags identify the sender and recipient within the dialog: these tags are unique identifiers assigned to each dialog participant, and they remain constant throughout the session.

SIP messages, transactions, and dialogs

Basic SIP Call flow identifying messages, transactions, and dialogs

Conclusion

In conclusion, SIP is a robust framework for establishing and managing communication sessions over IP networks. SIP ensures that NG911 calls based on the NENA i3 Standard deliver vital information to emergency responders promptly and accurately. Understanding SIP transactions and dialogs is crucial to comprehend NG911 calls.