SIP Session timers
Contents |
SIP Session Timer Support
SIP provides a mechanism by which both user agents and proxies can determine whether a given SIP session is still active. This mechanism is referred to as a Session Timer and is described in RFC 4028 “Session Timers in SIP”. This specification defines a keep alive mechanism for SIP sessions.
The SIP Session Timer Support feature adds the capability to periodically refresh Session Initiation Protocol (SIP) sessions by sending repeated INVITE requests. The repeated INVITE requests, or re-INVITEs, are sent during an active call leg to allow user agents (UAs) or proxies to determine the status of a SIP session. Without this keep alive mechanism, proxies that remember incoming and outgoing requests (stateful proxies) may continue to retain the call state needlessly. If a UA fails to send a BYE message at the end of a session or if the BYE message is lost because of network problems, a stateful proxy does not know that the session has ended. The re-INVITES ensure that active sessions stay active and completed sessions are terminated.
Prerequisites for SIP Session Timer Support
No special prerequisites, SIP Session Timer is available for all TMedia Toolpack versions that released.
Role of the User Agents
The initial INVITE request establishes the duration of the session and may include a Session-Expires header and a Min-SE header. These headers indicate the session timer value required by the user agent client (UAC). A receiving user agent server (UAS) or proxy can lower the session timer value, but not lower than the value of the Min-SE header. If the session timer duration is lower than the configured minimum, the proxy or UAS can also send out a 422 response message. If the UAS or proxy finds that the session timer value is acceptable, it copies the Session-Expires header into the 2xx class response. A UAS or proxy can insert a Session-Expires header in the INVITE if the UAC did not include one. Thus a UAC can receive a Session-Expires header in a response even if none was present in the request. In the 2xx response, the refresher parameter in the Session-Expires header indicates who performs the re-INVITES. For example, if the parameter contains the value UAC, the UAC performs the refreshes. For compatibility issues, only one of the two user agents needs to support the session timer feature, and in that case, the UA that supports the feature performs the refreshes. The other UA interprets the refreshes as repetitive INVITEs and ignores them. Re-INVITEs are processed identically to INVITE requests, but go out in predetermined session intervals. Re-INVITEs carry the new session expiration time. The UA responsible for generating re-INVITE requests sends a re-INVITE out before the session expires. If there is no response, the UA sends a BYE request to terminate the call before session expiration. If a re-INVITE is not sent before the session expiration, either the UAC or the UAS can send a BYE. If the 2xx response does not contain a Session-Expires header, there is no session expiration and re-INVITES do not need to be sent.
Session-Expires Header
The Session-Expires header field conveys the session interval for a SIP session. It is placed only in INVITE or UPDATE requests, as well as in any 2xx response to an INVITE or UPDATE. The absolute minimum for the Session-Expires header field is 90 seconds. This value represents a bit more than twice the duration that a SIP transaction can take in the event of a timeout. This allows sufficient time for a UA to attempt a refresh at the halfpoint of the session interval, and for that transaction to complete normally before the session expires. However, 1800 seconds (30 minutes) is RECOMMENDED as the value for the Session-Expires header field. In other words, SIP entities MUST be prepared to handle Session-Expires header field values of any duration greater than 90 seconds, but entities that insert the Session-Expires header field SHOULD NOT choose values of less than 30 minutes.
The syntax of the Session-Expires header field is as follows:
Session-Expires = ("Session-Expires" / "x") HCOLON delta-seconds *(SEMI se-params) se-params = refresher-param / generic-param refresher-param = "refresher" EQUAL ("uas" / "uac")
The refresher parameter is optional in the initial INVITE, although the UAC can set it to UAC to indicate that it will do the refreshes. The 200 OK response must have the refresher parameter set. Min-SE Header Because of the processing load of INVITE requests you can configure a minimum timer value that the proxy, UAC, and UAS can accept. The proxy, UAC, and UAS. The Min-SE command sets the minimum timer, and it is conveyed in the Min-SE header in the initial INVITE request. When making a call, the presence of the Min-SE header informs the UAS and any proxies of the minimum value that the UAC accepts for the session timer duration, in seconds. The default value is 1800 seconds (30 minutes). By not reducing the session timer below the value set, the UAS and proxies prevent the UAC from having to reject a call with a 422 error. Once set, the Min-SE command value affects all calls originated by the router. If the Min-SE header is not present, the UA accepts any value. The syntax of the Min-SE header is: Min-SE = "Min-SE" ":" delta-seconds 422 Response Message If the value of the Session-Expires header is too small, the UAS or proxy rejects the call with a 422 Session Timer Too Small response message. With the 422 response message, the proxy or UAS includes a Min-SE header indicating the minimum session value it can accept. The UAC may then retry the call with a larger session timer value. If a 422 response message is received after an INVITE request, the UAC can retry the INVITE.
How to configure
Session Timer Configurable under:
SIP -> SIP Stack -> Session Timer
Please visit toolpack configuration for each toolpack version for detail: Web Portal SIP Configuration
Note: The recommended value for “Default session timer” is not less than 30 Mins (1800 Sec) and for Min-SE it is recommended value is not less than 90 sec. To make new configuration take effect:
- Validate the configuration from the system
- Activate the new configuration.
SIP Session Timer Call Flows Example
General SIP Session Timer call flow
TMG/TSBC requests session timer by including Session-Expires: 1800 and Min SE: 256 header on the INVITE. TMG/TSBC receives 200 OK that set session timer to 1800 seconds and TMG/TSBC as the refresher. TMG/TSBC starts a 900 seconds session refresh timer, which is half of the 1800 seconds of the session timer to make sure the refresh is processed before the session expires. After refresh timer expires, TMG/TSBC sends out refresh request with Session-Expires value set to current value 1800 seconds and refresher to UAC. TMG/TSBC receives 200 OK and resets the timer. Once again TMG/TSBC sends out refresh request after session refresh timer expire. Finally, call ended in clear manner and Bye send to remote proxy, TMG/TSBC receives 200 OK.
Sip Session Expire too Small
SIP Proxy send invite to TMG/TSBC by including Min SE: 50 SIP header on the INVITE message.
TMG/TSBC reply with 422, Session timer too small as Min-SE value is set to 90 in TMG/TSBC and SIP Proxy send acknowledge to TMG/TSBC and call terminated.
TMG/TSBC is UAS and does the refresh
TMG/TSBC receives INVITE that has supported header with option tag ‘timer’ and Session-Expires header with 1800 seconds value with refresher=uas. TMG/TSBC starts 900 seconds session refresh timer. After refresh timer expires, TMG/TSBC sends out refresh request with Session-Expires value set to current value 1800 seconds, refresher is set to UAC so that ensure TMG/TSBC will always perform refresh. TMG/TSBC receives 200 OK and resets the timer. Once again TMG/TSBC sends out refresh request after session refresh timer expires, but now the SIP Proxy crashed so that TMG/TSBC receives 408 Request Timeout. TMG/TSBC sends out BYE and the call is terminated.
TMG or SBC is UAS and SIP Proxy does the refresh
TMG/TSBC receives INVITE that has supported header with option tag ‘timer’. TMG/TSBC sends 200 OK and requests session timer by including require header with tag ‘timer’ and Session-Expires header. The session interval is set to 1800 seconds and refresher is the SIP Proxy. TMG/TSBC receives session refresh request before the session end timer expires. TMG/TSBC sends 200 OK back and set refresher to UAC so that the role of refresher doesn’ t change. TMG/TSBC restarts 1800 seconds session end timer. Now the Sip Proxy crashes and no refresh request sent. 1800 seconds later the session end timer expires, TMG/TSBC sends out BYE and terminates the call.
TMG/TSBC is UAC and Requests Session Timer
TMG/TSBC invite by including Session-Expires header and Min SE on the INVITE. TMG/TSBC receives 200 OK that set session timer to 1800 seconds and TMG/TSBC as the refresher. TMG/TSBC starts 900 seconds session refresh timer. After refresh timer expires, TMG/TSBC sends out refresh request with Session-Expires value set to current value 1800 seconds and refresher to UAC. TMG/TSBC receives 200 OK and resets the timer. Once again TMG/TSBC sends out refresh request after session refresh timer expires, but now the (SIP) Proxy crashed so that TMG/TSBC receives 408 Request Timeout. TMG/TSBC sends out BYE and the call is terminated.
TMG/TSBC is UAC and (SIP) Proxy does the refresh
TMG/TSBC sends INVITE that has supported header with option tag ‘timer’ and Session-Expires to request session timer. The remote gateway accepts it. The session interval is set to 1800 seconds and refresher is the remote gateway. TMG/TSBC starts 1800 seconds session end timer. TMG/TSBC receives session refresh request before the session end timer expires. TMG/TSBC sends 200 OK back and set refresher to UAC so that the role of refresher doesn’t change. TMG/TSBC restarts 1800 seconds session end timer. Now the remote gateway crashes and no refresh request sent. 1800 seconds later the session end timer expires, TMG/TSBC sends out BYE and terminates the call.