Often it is desirable to have initial events be processed by the same application instance.

For example, a conferencing service might want to have all calls to the conference address be handled by the same application instance, so the state of all participants can be easily managed in a single SipApplicationSession.

Session targeting mechanisms

SIP Servlet provides several session targeting mechanisms that allow initial SIP requests to be directed to the same SipApplicationSession. The most generic session targeting mechanism is the @SipApplicationKey method. The SIP Servlet container invokes a @SipApplicationKey method with the initial request, and the method returns a string which identifies a SipApplicationSession, creating the session if it doesn’t exist.

@SipApplicationKey only applies to SIP requests, but Rhino SIP Servlet provides an equivalent session targeting mechanism for non-SIP initial events. This means that events from different protocols can be directed to the same application instance, enabling converged applications.

@SleeApplicationKey session targeting

To implement session targeting for non-SIP events, a servlet application defines a @SleeApplicationKey method. This is very similar to @SipApplicationKey methods, in that it takes an initial event and returns a string. The string identifies a SipApplicationSession instance, which is created automatically if it doesn’t already exist.

Tip The @SleeApplicationKey method is only used for non-SIP initial events; SIP events will still use @SipApplicationKey. To enable SIP and non-SIP initial events to select the same application instance, the application developer just has to ensure that these two methods return the same values for related events.

The signature of the @SleeApplicationKey-annotated method looks like this:

@SleeApplicationKey
public static String anyMethodName(Object event, Object activity) { ... }

The method must satisfy these properties:

  • Only one method in the application can be annotated with @SleeApplicationKey.

  • The method must be public and static.

  • The method may have any name.

  • The method must return String.

  • The method must have two Object parameters, which are the SLEE event and its activity object.

The body of the method can do anything, but it should be idempotent. It should inspect the event and activity parameters and extract the required information, such as user IDs or session IDs, to generate the return value.

Default session targeting behaviour

If there is no @SleeApplicationKey method defined in the application, Rhino SIP Servlet will just create a new SipApplicationSession instance for each new non-SIP activity.

Previous page Next page