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 these SIP headers is critical to ensure that requests are successfully routed to the right recipients.

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
1
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
1
Via: SIP/(protocol version)/(transport type) (UAC):(protocol port);branch=(branch number) 

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
1
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
1
Contact: sip:(user)@(domain);transport=(transport type) 

From

The From header specifies who the call is coming from.
Format
1
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
1
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
1
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
1
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
1
Content-Type: (type of content) 

Guidelines for SIP Headers

Here are some tips and best practices that you can follow to make the most of SIP headers:
  • 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:
HeaderCompact Form
ToT
ViaV
Call-IDI
ConatctM
FromF
SubjectS
Contact LengthL

  • 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!


Still confused about SIP trunking? Read our beginner's guide for everything you need to know, or chat to our experts to find out how SIP trunking can make your phone system cheaper and more flexible than ever before.


Share on Social

Worth checking out

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