Internet Engineering Task Force SIP WG
Internet Draft S.Donovan,J.Rosenberg
draft-ietf-sip-session-timer-02.txt dynamicsoft
July 14, 2000
Expires: January 2001
The SIP Session Timer
STATUS OF THIS MEMO
This document is an Internet-Draft and is in full conformance with
all provisions of Section 10 of RFC2026.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that
other groups may also distribute working documents as Internet-
Drafts.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet- Drafts as reference
material or to cite them other than as work in progress.
The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt
The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html.
Abstract
This document proposes an extension to the Session Initiation
Protocol (SIP). This extension allows for a periodic refresh of SIP
sessions through a re-INVITE. The refresh allows both user agents and
call stateful proxies to determine if the SIP session is still
active. The extension defines a new general header, Session-Expires,
which conveys the lifetime of the session.
1 Introduction
The Session Initiation Protocol (SIP) [1], does not currently define
a keepalive mechanism. The result is that call stateful proxies will
not always be able to determine whether a call is still active or
not. For instance, when a user agent fails to send a BYE message at
the end of a session, or the BYE message gets lost due to network
S.Donovan,J.Rosenberg [Page 1]

Internet Draft Session Timer July 14, 2000
problems, a call stateful proxy will not know when the session has
ended. In this situation, the call stateful proxy will retain state
for the call and has no deterministic method of determining when the
call state information no longer applies.
To resolve this problem, this extension defines a keepalive mechanism
for SIP sessions. UAs send periodic re-INVITEs to keep the session
alive. The interval for the re-INVITEs is determined through a
negotiation mechanism defined here. If a re-INVITE is not received
before the interval passes, the session is considered terminated.
Both UAs are supposed to send a BYE, and call stateful proxies can
remove any state for the call.
This refresh mechanism has additional applications. For the same
reasons a call stateful proxy server would like to determine whether
the session is still active, a user agent would like to make this
determination. This determination can be made at a user agent without
the use of SIP level mechanisms; for audio sessions, periodic RTCP
packets serve as an indication of liveness [2]. However, it is
desirable to separate SIP call liveness from the details of the
particular session.
Another important application of the session timer is in NAT and
firewall control [3]. In order for SIP to flow through a NAT or
firewall, holes and/or address bindings must be dynamically created
to allow the media for the session to flow. These holes and/or
address bindings represent state which must be eventually removed.
Relying on a BYE to trigger the removal of state, besides being
unreliable, introduces a potential denial of service attack.
This document proposes an extension to SIP that defines a session
expiration mechanism. Periodic refreshes, through re-INVITEs, are
used to keep the session active. The extension is sufficiently
backwards compatible with SIP that it works so long as one of the two
participants in a call leg understand the extension. A new general
header, the Session-Expires header, is defined. It conveys the
expiration time of the session.
2 Protocol Overview
UACs which support the session timer extension defined here include a
Supported header in all requests, excepting ACK, containing the
option tag "timer" [4]. When a UAC makes a call, it MAY include a
Session-Expires header in the INVITE request. The presence of the
Session-Expires header indicates that the UAC wishes to use the
session timer for this call. Its value indicates the desired
expiration time of the session.
S.Donovan,J.Rosenberg [Page 2]

Internet Draft Session Timer July 14, 2000
Proxies on the signaling path may have their own requirements for the
refresh interval of the session. If the Supported header in the
request lists the option tag "timer", a proxy can be certain the UAC
understands the session timer. In this case, if no Session-Expires
was present, the proxy can insert one if it so desires. If one was
present, the proxy can lower, but not increase, the expiration time
of the session. The proxy remembers the value of Session-Expires it
placed into the request, and also remembers that the UAC supported
session timer. The UAC will ultimately be responsible for sending the
refreshes for this call leg.
If the Supported header was absent from the request, or was present
but didn't include the tag "timer", the proxy knows the UAC cannot
generate refreshes, but the called party may be able to. If no
Session-Expires was present, the proxy can insert one if it so
desires. If one was present, the proxy can lower, but not increase,
the expiration time of the session. The proxy remembers the value of
Session-Expires it placed into the request, and also remembers that
the UAC did not support the session timer. The UAS may be responsible
for sending the refreshes for this call leg. If the proxy wishes to
insist that the call is only established if the UAS supports session
timer, it MAY insert a Require header into the request, with the
value "timer".
Eventually, the initial INVITE reaches the UAS. There are two cases -
the UAS supports session timer, or it does not. If it does, the UAS
MAY add a session timer or reduce the session timer from the request.
If the UAS accepts the call, it places the final value of the session
timer in the Session-Expires in the 200 OK response. If the request
also contained the Supported header with the value "timer", the UAS
knows the UAC can do refreshes. To make sure the UAC is aware it must
actually do them, the UAS MUST add a Require to the 200 OK response,
with the tag "timer". The UAS does not perform the refreshes in this
case. If the request did not contain the Supported header with the
value "timer", the UAS knows the UAC cannot perform refreshes. So, it
assumes the responsibility. It MUST add the value of the Session-
Timer to the response, but it MUST NOT add a Require header with
value "timer". This is because the UAC does not support the
extension; the UAS cannot insist on its usage at the UAC, which is
what a Require header in the response would accomplish.
If the UAS does not support session timer, it behaves as a normal
UAS. It will, in this case, neither insert Session-Expires in the
response nor a Require header with value "timer".
This response travels backwards through the proxies. When it reaches
a proxy which remembers that it asked for session timer, the proxy
examines the response. If the response did not contain a Session-
S.Donovan,J.Rosenberg [Page 3]

Internet Draft Session Timer July 14, 2000
Expires header, but the proxy remembers that the UAC supported
session timer, the proxy knows that the UAC supports session timer,
but the UAS did not. So, it inserts the Session-Expires header into
the response and also adds a Require header with a value of "timer".
If the response the proxy received did have a Session-Expires header,
but no Require header with value "timer", the proxy knows that the
UAS understands session timer, but not the UAC. It simply forwards
this request upstream. If the proxy gets a response without Session-
Expires, and the proxy remembers that the UAC did not support session
timer, the proxy knows that session timer cannot be used, since
neither UAS nor UAC support it. Finally, if the response contains the
Session-Expires and Require header with the value "timer", the proxy
knows that both UAC and UAC support session timer, and that the UAC
will be performing refreshes.
The response then arrives at the UAC. If it contains a Require header
with the value "timer", the UAC knows it is responsible for
refreshes. The response will also contain a Session-Expires header,
and the value of that header is used as the interval for refreshes.
The UAC then ACKs the INVITE. The Session-Expires MUST NOT be
included in the ACK.
If the calling UA is supposed to perform refreshes and wishes to keep
the session alive, it MUST send a re-INVITE before the expiration
time. This re-INVITE MAY contain a Session-Expires header. The
processing of this re-INVITE by proxies and UAS is identical to that
of the initial INVITE.
If the called UA is supposed to perform refreshes and wishes to keep
the session alive, it MUST send a re-INVITE before the expiration
time. This re-INVITE MAY contain a Session-Expires header. The
processing of this re-INVITE by proxies and UAS is identical to that
of the initial INVITE.
If the calling UA or the called UA is not performing refreshes, and
does not receive a re-INVITE refreshing the session before the
session expires, they SHOULD send a BYE to terminate the call. If a
refreshing UA does not receive a response to the re-INVITE used to
refresh the session, it SHOULD send a BYE to terminate the call.
Similarly, if a proxy doesn't receive a re-INVITE before expiration
of the session, it MAY remove associated call state, and MAY free any
resources associated with the call. Unlike the UA, it MUST NOT send a
BYE.
3 Session-Expires Header Field Definition
The Session-Expires header conveys the expiration time for a SIP
S.Donovan,J.Rosenberg [Page 4]

Internet Draft Session Timer July 14, 2000
session. It is placed in only in INVITE requests, and is allowed in
any response to an INVITE. Like the SIP Expires header, it can
contain either an absolute time or a delta-time. If it contains an
absolute time, this time indicates the time at which a proxy or UA
may safely destroy any state associated with the call. If it contains
a delta time, the expiration time of the session is defined as that
delta plus the time at which the header is observed in a response.
For example, if a UAS generates a 200 OK response to a re-INVITE that
contained a Session-Expires header with a value of 3600, the UAS
computes the expiration time of the session as one hour after the
time when the 200 OK was sent. For each proxy, the expiration time is
one hour after the time when the 200 OK was received or sent
(assuming these two are sufficiently close together). For the UAC,
the expiration time is one hour after the receipt of the 200 OK.
The syntax of the Session-Expires header is:
Session-Expires = "Session-Expires" ":" ( SIP-date |
delta-seconds )
Both SIP-Date and delta-seconds are defined in Section 6.20 of RFC2543 [1].
Table 1 is an extension of tables 4 and 5 in [1] for the Session-
Expires header:
where enc. e-e ACK BYE CAN INV OPT REG
Session-Expires R n h - - - o - -
Session-Expires r n h - - - o - -
4 UAC Behavior
A UAC which supports the session timer extension defined here MUST
include a Supported header in each request (excepting ACK), listing
the option tag "timer" [4]. It MUST do so even if the UAC is not
requesting keepalives for the call.
If the UAC wishes to request keepalives for this call, it MUST
include a Session-Expires in the INVITE request used to initiate the
call. The value of this header indicates the time when the UAC will
consider the call expired if no refresh is sent. If the request is
S.Donovan,J.Rosenberg [Page 5]

Internet Draft Session Timer July 14, 2000
being authenticated, the Session-Expires header MUST appear before
the Authorization or Proxy-Authorization headers.
The UAC MAY include a Require in the request with the value "timer"
to indicate that the UAS must support the session timer to
participate in the session. In addition, the UAC MAY include a
Proxy-Require header in the request with the value "timer" to
indicate that proxies must support session timer in order to
correctly process the request. However, usage of either Require or
Proxy-Require by the UAC is NOT RECOMMENDED. They are not needed,
since the extension works even when only the UAC supports the
extension.
When the response to the initial INVITE request arrives, it may or
may not contain a Session-Expires header, and may or may not contain
a Require header with the value "timer". UACs MUST be prepared to
receive a Session-Expires header in a response even if none were
present in the request.
Table 4 describes the behavior of the UAC after receiving a 200 OK
response to an initial INVITE, or any final response to a re-INVITE.
Require Session-Timer Behavior
N N Do nothing.
N Y Do nothing.
Y N Should never happen. Do nothing.
Y Y UAC SHOULD perform refreshes.
If the UAC must refresh, it follows the following procedure. The UAC
computes the expiration time of the session. If the Session-Expires
contains an absolute time, that is the time of expiration. If it
contains a delta-time, the expiration time is the time of reception
of the response plus that delta time. Let the difference in time
between the reception of the response and the session expiration time
be called the refresh interval. Note that this expiration applies
only to the call leg associated with the response. It is explicitly
allowed for there to be differing session timers (or none at all) on
differing call legs.
If UA wishes to continue with the session beyond the expiration, it
MUST generate a refresh before the expiration time. It is RECOMMENDED
that this refresh be sent once half the refresh interval has elapsed.
This refresh is accomplished by sending a re-INVITE request on the
given call leg. Sending of the refresh (in terms of this extension),
and processing the response are exactly identical to the rules above.
S.Donovan,J.Rosenberg [Page 6]

Internet Draft Session Timer July 14, 2000
A UA MAY use the refreshing re-INVITE as a normal SIP re-INVITE; that
is, this re-INVITE MAY contain an updated session description. In the
case where the re-INVITE contains an updated session description, the
session description MUST somehow indicate that it has changed. In the
case of SDP [5], this is accomplished by using a different value for
the origin field.
If the refreshing re-INVITE is used solely for refreshing, it still
contains SDP. However, this is exactly the same SDP as sent
previously by the UA.
If no response to a refreshing re-INVITE is received before the
expiration of the session, the UA SHOULD send a BYE request to
terminate the call. It SHOULD send this BYE slightly before
expiration of the session. Ten seconds is RECOMMENDED.
Firewalls and NATs may be very unforgiving about allowing
SIP traffic to pass after the expiration time of the
session. It is for this reason that the BYE should be sent
before the expiration.
Note that it is possible that the calling UA is generating refreshes,
and then it receives a re-INVITE. After following the rules for UAS
described below, the calling UA now determines it is not supposed to
generate refreshses. The UA SHOULD cease generating refreshes in this
case, and let the other UA perform them. This also implies that the
responsibility for generating refreshes may change many times during
a call.
Also note that a non-200 response to an initial INVITE MAY indicate a
session expiration. This happens when a UA crashes and reboots
between refreshes. When the refresh arrives at the rebooted UA, it
decides to reject the call. In order to alert the UAC that it
believes the call is down (the UAC believes this request to be a re-
INVITE, and so a non-200 OK final response will not cause it to
destroy the call), it MAY include a Session-Expires and Require into
the non-200 response (assuming session timer is supported by the
UAC), with an immediate expiration time.
5 Proxy Behavior
Session expirations are mostly of interest to call stateful proxy
servers. However, a stateful proxy server may also follow the rules
described here. Stateless proxies MUST NOT attempt to request session
timers.
S.Donovan,J.Rosenberg [Page 7]

Internet Draft Session Timer July 14, 2000
The proxy processing rules require the proxy to remember
information between the request and response, ruling out
stateless proxies.
Due to local policy, a proxy may have guidelines about the desired
maximum lifetime for a call initiated through it. When an initial
INVITE is received to establish a call, a proxy MAY insert a
Session-Expires header in the request before forwarding it, if none
was present in the request. This Session-Expires header may contain
any desired expiration time the proxy would like. If the request
already had a Session-Expires header, the proxy MAY reduce the value
in the Session-Expires header before forwarding the request, but MUST
NOT increase it.
Assuming the proxy wishes to use session timer (and thus has possibly
inserted the Session-Expires header or reduced it), the proxy MUST
remember that it is using session timer, and also remember the value
in the request it forwarded, until the final response to the request
arrives, or the transaction times out. If the request also contained
the Supported header with the value "timer", the proxy MUST remember
this as well.
If the request did not contain a Supported header with the value
"timer", the proxy MAY insert a Require header into the request, with
the value "timer". This allows the proxy to insist on session timer
for the session. This header is not needed if a Supported header was
in the request; in this case, the proxy can already be sure that the
session timer can be used for the session.
When the final response to the request arrives, it is examined by the
proxy. If it does not contain a Session-Expires header, and the proxy
remembers that the UAC supports session timer, the proxy MUST insert
a Session-Timer header into the response with the value it remembered
placing into the forwarded request. The proxy MUST also insert the
Require header into the response, with the value "timer", before
forwarding it upstream. The value of the Session-Timer in the
forwarded response represents the expiration time of the session.
If the final response to the request arrives without a Session-
Expires header, and the proxy remembers that the proxy did not
support session timer, then session timer is not available for this
session.
If the final response does contain a Session-Expires header, its
value represents the expiration time of the session.
In all cases, the proxy MUST NOT modify the value of the Session-
Expires header received in the response before forwarding it
S.Donovan,J.Rosenberg [Page 8]

Internet Draft Session Timer July 14, 2000
upstream.
The expiration of the call will occur at the time indicated in the
Session-Expires header. If the Session-Expires header contains a
delta-time, the expiration time is the time of receipt of the final
response, plus that delta time.
Re-INVITE requests may arrive from either UA, refreshing the session
and extending the expiration time. Processing of these re-INVITEs by
a proxy is identical to the procedure for processing the initial
INVITE.
If the session expires without having seen a response to a re-INVITE,
the proxy MAY consider the call leg terminated. This means it MAY
flush any state associated with that call leg.
6 UAS Behavior
When a UAS receives an INVITE for a new call, and that INVITE
contains a Session-Expires header, the UAS MUST place a Session-
Expires header in a 200 OK response (assuming the UAS accepts the
call). The UAS MAY reduce the expiration time when it places this
header into the response, but it MUST NOT increase it. If the inital
INVITE did not contain a Session-Expires header, but it did contain a
Supported header containing the option tag "timer", the UAS MAY
insert a Session-Expires header into the response. This header MAY
have any desired expiration time.
If the UAS places a Session-Expires header into the response, and the
request contained a Supported header with the value "timer", the UAS
MUST place a Require header into the response with the value "timer".
In this case, the UAC will generate the refreshes.
If the UAS places a Session-Expires header into the response, and the
request did not contain a Supported header with the value "timer",
the UAS MUST NOT place a Require header into the response with the
value "timer". In this case, the UAS will generate the refreshes.
If the UAS is generating refreshes, it computes the expiration time
of the session based on the value of the Session-Expires header in
the response it sent. The processing from this point is as described
in section 4 once the UAC determined it was performing refreshses.
As described in Section 4, the refreshing UA will send periodic re-
INVITEs to refresh the session. A UAS MUST be prepared to receive and
process these re-INVITEs. Processing of the re-INVITE, as far as the
session timer is concerned, is identical to the rules for the initial
INVITE, described above. Note that if the 200 OK to the re-INVITE has
S.Donovan,J.Rosenberg [Page 9]

Internet Draft Session Timer July 14, 2000
no Session-Expires, no expiration time exists for the session.
7 Security Considerations
The session timer introduces the capability of a proxy to effectively
force clients to send refreshes at a rate of the proxies choosing. It
can also force the clients to send a BYE by setting the expirations
to times that are too short. This introduces the possibility of rogue
proxies introducing denial-of-service attacks. Use of short refresh
intervals allows the proxies to create network load. The session
timer mechanism allows the proxy to be able to terminate established
calls - a capability a normal proxy doesn't have in [1].
As a result of these potential attacks, it is RECOMMENDED that IP or
transport level security is used when communicating between proxies.
8 Examples
The following examples are meant to illustrate the functionality
associated with the session timer. In the interest of brevity, all
headers excepting Supported, Session-Expires and Require are
intentionally left out of the SIP messages.
8.1 Basic session-timer setup with UAS detected timeout
Calling UA -> Called UA
INVITE
Supported: timer
Session-Expires: 120
Calling UA <- Called UA
200 OK
Require: timer
Session-Expires: 120 Called UA starts session timer on send
Calling UA starts session timer on receipt
Calling UA -> Called UA
ACK
n60 seconds later:
Calling UA -> Called UA
INVITE
Supported: timer
Session-Expires: 120
Calling UA <- Called UA
S.Donovan,J.Rosenberg [Page 10]

Internet Draft Session Timer July 14, 2000
SPS -> Called UA
ACK
9 Changes since -01
o Added wording indicating that the UAC can add the Require and
Proxy-Require headers with the "timer" header.
o Added the ability for proxy to include Session-Timer header
when the UAC did not include the Supported with the "timer"
tag.
o Added the ability for a proxy to insert the Session-Timer
header into a response, in the case where the called UA didn't
support session timer, but the calling UA did.
o Added the ability for the called UA to refresh the session
timer. This is only in the case that the calling UA does not
support the "timer" feature.
o Session-Expires can be present in non-200 OK responses to
reINVITEs
o Added wording about getting Session-Expires of zero in non-200
OK response to initial INVITE, handling crash and reboot
cycles.
o Discuss re-INVITEs changing the role of who is doing
refreshes.
10 Author's Addresses
Steven R. Donovan
dynamicsoft
72 Eagle Rock Avenue
First Floor
East Hanover, NJ 07936
email: sdonovan@dynamicsoft.com
Jonathan Rosenberg
dynamicsoft
72 Eagle Rock Avenue
First Floor
S.Donovan,J.Rosenberg [Page 17]