Automatic invalidation of SIP sessions (aka Invalidate When Ready - IWR) in SailFin
Posted by bhavanishankar on November 10, 2008 at 2:01 AM EST
This blog explains how the automatic invalidation of SIP sessions work in SailFin container.To give some brief introduction, following are the ways by which a SIP session can be invalidated in SailFin container:1. Explicit invalidation by the application itself i.e., by invoking session.invalidate(). 2. SAS (SipApplicationSession) expiration which eventually invalidates SAS and all its children, if the application does not extend the SAS expirationTime in sessionExpired listener callback. 3. IWR i.e., Automatic invalidation of sessions, I would call it "container managed invalidation" which is the fastest invalidation and resource cleanup machanism. This type of invalidation happens as soon as the sip dialog terminates (eg., after processing BYE request). In the rest of the blog I will explain more about how this particular invalidation machanism works and the how the applications can use it and get benefit out of it. Here are the details of automatic invalidation (IWR): Section #1. Enabling the automatic invalidation: (a) If the application is of SSA 1.1 version, then the automatic invalidation is enabled by default. The 1.1 application will have its sip.xml like this:
It is also possible to write 1.1 applications only using annotations without requiring sip.xml (b) If the application is of SSA 1.0 version,, then the automatic invalidation can be enabled programatically. This need to be done when processing the initial request, something like this:
Section #2. Once enabled, the automatic invalidation of javax.servlet.sip.SipSession takes place under following circumstances: (a) After BYE is processed. From a application point of view, it looks something like this:
(b) After NOTIFY is processed whose Subscription-State=terminated. This is what it means for an application: class UASServlet { // case 1 : UAS doNotify(SipServletRequest req) { // incoming NOTITY request. if (req.getHeader("Subscription-State").equalsIgnorecase("terminated")) { (c) When the non-record-routing proxy finishes proxying the request. Like below:
(d) Non 2xx final response is received for the initial request.
That is about the SipSession' invalidation in the simplest possible terms. Now let us see when javax.servlet.sip.SipApplicationSession gets automatically invalidated. For the SipApplicationSession it is very simple : Automatic invalidation happens when the SipApplicationSession becomes completely EMPTY i.e., when all its child protocol sessions (sip & http) get invalidated & all its servlettimers expire.Section #3. Controlling the automatic invalidation:
Similar thing can be done in the SipApplicationSessionListener as well. |
Blog Links >>
- Printer-friendly version
- bhavanishankar's blog
- 1735 reads





