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 & receive $10 of free testing credit.
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.
The To header specifies the recipient of the call.
To: “(name)” <sip: (user)@(domain)>
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.
Via: SIP/(protocol version)/(transport type) (UAC):(protocol port);branch=(branch number)
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.
Call-ID: (generated number)@(ip\_address)
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.
Contact: sip:(user)@(domain);transport=(transport type)
The From header specifies who the call is coming from.
From: “(name)” <sip: (user)@(domain)>
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.
Content-Length: (number of bytes in message body)
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.
CSeq: (number) (request type)
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.
Max-Forwards: (maximum number of forwards)
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.
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:
- 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