The Beginner’s Guide to SIP Headers
Articles

The Beginner’s Guide to SIP Headers

SIP message requests are critical to successfully utilizing SIP trunking technology. User agents and network servers use message requests to locate, invite, and manage calls.
SIP message requests use header fields to supply information about the requested action or information. Including the correct headers and correctly formatting SIP headers is critical to ensure that requests are successfully routed to the right recipients.
# Guidelines for SIP Headers To make the best use of SIP headers, these are some best practices and tips to follow:
  • Headers can be placed in any order. However, the essential headers should be listed first. The REQUEST line is technically not a header and always goes first.
  • Keep headers as short as possible. Compact headers can be used for even shorter headers.
  • If you’re using a point-to-point SIP client, an IP address must be used in place of a user@domain identifier.
  • Wireshark is a great free tool for capturing SIP packets for analysis or network diagnostics.

Headers for the Standard SIP Call

Usually, an INVITE message initiates a session—essentially a phone call—on the SIP network. These are the headers that supply the minimum required information to initiate a call over a SIP trunking network.

To

The To header specifies the recipient of the call.
Format
To: “(name)”

From

The From header specifies who the call is coming from.
Format
From: “(name)”

Call-ID

The Call-ID header creates a globally unique identifier for the call. To ensure that each Call-ID identifier is globally unique, a random number is generated (which often looks like this: f_169eac17a017b0a4e0adfa8_I), and the sender’s IP address is appended to this number. This guarantees that the Call-ID number will be globally unique, since no two devices will have the same IP address.
Format
Call-ID: (generated number)@(ip_address)

CSeq

The CSeq header specifies the number of requests of each type that have been sent. For example, “CSeq: 15 INVITE” means that is the 15th invite request. The number increases by one for each additional request of the same type.
Format
CSeq: (number) (request type)

Via

The Via header identifies a call’s path with the protocol name, protocol version, transport type, user agent client (UAC), the protocol port for the request and a branch parameter which serves as a unique identifier for each SIP transaction. The Via header routes SIP responses to the correct device, similar to a return address on a package. If a SIP request is routed through multiple devices, each UAC adds its own VIA header to the request before sending it on.
Format
Via: SIP/(protocol version)/(transport type) (UAC):(protocol port);branch=(branch number)

Contact

The Contact header identifies the most direct route for sending future requests to the requesting device. The Contact header specifies a caller domain name or IP address and a transport type.
Format
Contact: sip:(user)@(domain);transport=(transport type)

Max-Forwards

The Max-Forwards header limits the number of times a request can be forwarded on its way to the recipient. The number is reduced by one each time the request is forwarded. The Max-Forwards header prevents a request from endlessly circling the SIP network if the recipient cannot be found. The default value is 70.
Format
Max-Forwards: (maximum number of forwards)

Content-Type

If the message has a body, the Content-Type header identifies how the body is formatted. A text message might be identified as text/HTML or an application making a call might identify the content as application/SDP
Format
Content-Type: (type of content)

Content-Length

The Content-Length header specifies the size of the message content in bytes. A Content-Length of 0 indicates that there is no message body.
Format
Content-Length: (number of bytes in message body)
There are many other SIP headers, but these nine headers will enable you to initiate a call using an INVITE request. A BYE request is used to terminate calls.

About Telnyx
Telnyx delivers voice, messaging and more for applications and next-generation communications companies, and our intuitive mission control portal enables users to establish and manage SIP connections through an intuitive point-and-click interface. Contact our customer success team to learn more.
Share on Social
Worth checking out

By using the site, you agree to our use of cookies. Accept and close Find out more here.