Beginner’s guide to SIP headers [Complete list]
SIP message requests locate, invite, and manage calls, and SIP headers communicate much of that information.
By Josh Whitaker
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 SIP headers to supply information about the requested action or information.
Why not try out our SIP Trunking product and see for yourself how SIP headers work? You can set up a Telnyx Portal account in minutes.
What is a SIP Header?
A SIP Header is a component of a SIP message that is used to convey information about the SIP message. Including the correct SIP Header and correctly formatting these SIP Headers is critical to ensure that requests are successfully routed to the right recipients. We'll try and run through some of the most common SIP Headers in this blogpost.
Headers for the Standard SIP Call
Usually, an INVITE message initiates a session—essentially a phone call—on the SIP protocol. While there are many other SIP headers, the nine outlined below supply the minimum required information to initiate a call over a SIP trunking network. A BYE request is used to terminate calls.
To
The To header specifies the recipient of the call.
Format
To: “(name)” <sip: (user)@(domain)>
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)
Call-ID
The Call-ID SIP 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)
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)
From
The From header specifies who the call is coming from.
Format
From: “(name)” <sip: (user)@(domain)>
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)
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)
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)
Guidelines for SIP Headers
Below are are some tips and best practices that you can follow to make the most of SIP headers. For more in-depth information, reach out to our team of experts.
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. For example:
Header | Compact Form |
---|---|
To | T |
Via | V |
Call-ID | I |
Conatct | M |
From | F |
Subject | S |
Contact Length | L |
If you’re using a point-to-point SIP client, an IP address must be used in place of a user@domain identifier.
Utilize Wireshark to capture SIP packets for analysis or network diagnostics- it's free!
Contact our team of experts to learn how you can make your system more affordable and flexible with SIP trunking. Or clear up other SIP trunking questions you might have by checking out our guide
Sign up for emails of our latest articles and news
Related articles