SIP Session Timers

Krishnakumar PG
4 min readJun 18, 2024

--

Session Initiation Protocol (SIP) is a fundamental protocol used in VoIP communications for initiating, maintaining, and terminating real-time sessions. One critical aspect of SIP is the Session Timer, defined in RFC 4028, which ensures that sessions do not hang indefinitely if a failure occurs in the network or endpoints. The Session Timer mechanism is crucial for both maintaining the efficiency of the network and ensuring reliable communication.

What are SIP Session Timers?

Session Timers are used to manage and refresh SIP sessions periodically, ensuring they remain active and responsive. This is achieved through re-INVITE or UPDATE requests, which allow user agents (UAs) and proxies to determine if a SIP session is still active.

Session-Expires Header:

The Session-Expires header field indicates the maximum duration a session can remain active without being refreshed. If the session is not refreshed within this interval, it is considered terminated. The session expiration interval is negotiated between the UAC and UAS during the SIP transaction. UA to attempt a session refresh at half the interval and complete the transaction before the session expires. For example, a Session-Expires: 1800 header specifies that the session will expire in 1800 seconds (30 minutes) unless refreshed at half the interval 900 seconds. The absolute minimum value for the Session-Expires header is 90 seconds.

Example INVITE message

Refresher Parameter:

The refresher parameter in the Session-Expires header determines which party is responsible for sending the session refresh request. This can be either the UAC or UAS, indicated by refresher=uac or refresher=uas. The refresher sends a refresh request at half the session interval specified. For example, if the session interval is 1800 seconds, the refresher will send a re-INVITE or UPDATE request at 900 seconds to maintain the session.

Min-SE Header:

The Min-SE header field defines the minimum allowed value for the session expiration interval. This prevents setting the session refresh interval too short, which could overwhelm network resources. If a UAC proposes a session interval shorter than the Min-SE value set by any proxy or UAS, it will receive a 422 (Session Interval Too Small) response, requiring it to increase the interval. The 422 response MUST contain a Min-SEheader field with the minimum timer for that server.

422 Session Interval Too Small

Operation and Negotiation:

  1. Session Initiation:
  • When initiating a session, the UAC includes a Supported: timer header to indicate support for session timers. The initial INVITE may include a Session-Expires header proposing an expiration interval.
  • Proxies along the path can modify the Session-Expires and Min-SE headers according to their requirements.
  • The UAS can accept the proposed interval or suggest a different one in its 200 OK response.

2. Session Maintenance:

  • Once the session is established, the designated refresher (UAC or UAS) is responsible for sending refresh requests.
  • The refresher sends a re-INVITE or UPDATE request at half the session interval. For example, with a Session-Expires: 1800 header, a refresh is sent at 900 seconds.
  • If the refresh request fails or is not received, the session is considered expired, and a BYE message is sent to terminate the session.

Handling Session Expiration:

If the refresher fails to send a refresh request or the request fails to be acknowledged, the session is considered expired. Both UAC and UAS will then send a BYE message to terminate the session. Proxies monitoring the session will also recognize the absence of a refresh request and clear their state accordingly.

Example Use Case:

Consider a SIP call initiated with a Session-Expires: 3600 seconds and refresher=uas. After 1800 seconds (half of 3600), the UAS sends a re-INVITE or UPDATE request to refresh the session. This ensures that both the UAC and any proxies along the path are aware that the session is still active.

Conclusion:

Understanding SIP Session Timers is crucial for maintaining the stability and efficiency of SIP sessions. The Session-Expires and Min-SE headers ensure that sessions are refreshed periodically, preventing unnecessary resource usage and detecting session termination. The refresher parameter assigns the responsibility of session refreshing to either the UAC or UAS, ensuring smooth operation.

--

--