In Understanding SIP Timers Part I, I explained the basics of T1, Timer B, and Timer F. Today I want to climb up the protocol stack a bit and write about timing from a services point of view. Timers B and F function close to the network layer and are responsible for making sure that messages are received by the next hop. They aren’t particularly interested in what those messages are attempting to do. This next level of timing is context aware and message type is of great importance.
I’ll begin with a brief description of the four parts of a SIP message. First, there is the Request Line. This is a single line of text that contains the SIP request or response type, the SIP URI of the destination, and the protocol version. Examples include:
INVITE sip:firstname.lastname@example.org SIP/2.0
SIP/2.0 200 OK
Following the Request Line is a series of headers. These headers describe who the request or response is coming from, the call ID, the IP addresses of the SIP elements that the packet traversed, and many more things about the message. Example headers include:
After the headers section is a blank line. This blank line is used to separate the SIP protocol components from the message body. For example, a blank line would come between the last header in a SIP Invite request and the SDP (Session Description Protocol) message body. All SIP messages have the blank line, but the message body is optional.
Service level timing occurs in the header section. Specifically, it uses the Expires header. The Expires header indicates the lifespan of a particular operation. If contained within an Invite message, the Expires header specifies the amount of seconds the Invite will exist without being answered. In other words, if the Expires contained a value of 60, the Invite would timeout and be canceled in one minute if a “200 OK” was not received by the sender.
Expires headers are used by other SIP messages. Inside a Register request, an Expires header designates the lifespan of the registration. If it contains 3600, the registration will timeout in one hour and at that point become invalid. You cannot call someone with an expired registration. The SIP proxy will not forward on your Invite.
Expires headers are used in Subscribe messages and the same timeout policies apply.
Keep on Trucking
An Expires header can also be used to extend an existing registration or subscription. Let’s say that a SIP User Agent sent a Register with an Expires header containing the value of 86,400. 86,400 seconds equates to 24 hours. To ensure that the registration remains in force after 24 hours, the SIP User Agent must send another Register sometime prior to the expiration of the first with a new Expires header of 86,400. This extends the registration an additional 24 hours. The SIP User Agent will continue to send Register messages until it’s ready to shutdown. At that point it sends a Register containing an Expires header with the value of 0 (zero). This will cancel the previous registration. Again, Subscribe works the same way.
That’s pretty much it for SIP timers. T1, Timer B, and Timer F ensure that messages arrive and the Expires header gives duration to specific SIP operations. Are you starting to feel a little more like a SIP guru? If not, stick around. I have lots more to talk about.