com.ibm.xdms.sip.filter
Interface SipFilter

All Known Implementing Classes:
BaseSipFilter

public interface SipFilter

A SIP filter is an object that performs filtering tasks on the SIP request and provides a response either through the SIP response or via a SIP Notify back to the client. Examples that have been identified for this design are


Field Summary
static java.lang.String COPYRIGHT
           
 
Method Summary
 void destroy()
          Called to indicate to a filter that it is being taken out of service.
 void doErrorResponse(javax.servlet.sip.SipServletResponse response, SipFilterChain chain)
          This method is invoked if an error response is returned from a SIP NOTIFY request.
 void doSubscribe(javax.servlet.sip.SipServletRequest request, javax.servlet.sip.SipServletResponse response, SipFilterChain chain)
          The doSubscribe method of the SipFilter is called each time a SIP Subscribe request is passed through the chain due to a client request.
 void doSuccessResponse(javax.servlet.sip.SipServletResponse response, SipFilterChain chain)
          This method is invoked if a successful response is returned from a SIP NOTIFY request.
 void init(XcapCaps xcapCaps, ApplicationUsage appUsage, AuidConfig auidConfig)
          Called to indicate to a filter that it is being placed into service.
 

Field Detail

COPYRIGHT

static final java.lang.String COPYRIGHT
Method Detail

init

void init(XcapCaps xcapCaps,
          ApplicationUsage appUsage,
          AuidConfig auidConfig)
          throws XdmsException
Called to indicate to a filter that it is being placed into service. The init method is called exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work.

Parameters:
xcapCaps - The entire xcap capabilities object for the XDMS.
appUsage - The application usage for this filter.
auidConfig - The AUID configuration for this filter.
Throws:
XdmsException - Thrown if the filter should not be used

destroy

void destroy()
Called to indicate to a filter that it is being taken out of service. This method is only called once all threads within the filter's doSubscribe method have exited or after a timeout period has passed. After this method is called, it will not be called again on the instance of this filter. This method gives the filter an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the filter's current state in memory.


doSubscribe

void doSubscribe(javax.servlet.sip.SipServletRequest request,
                 javax.servlet.sip.SipServletResponse response,
                 SipFilterChain chain)
                 throws java.io.IOException,
                        XdmsException
The doSubscribe method of the SipFilter is called each time a SIP Subscribe request is passed through the chain due to a client request. The SipFilter must call the getStatus() method to determine if the status is equal to SipServletResponse.SC_OK or SipServletResponse.SC_ACCEPTED which indicates that the response is still valid and has not been returned to the client yet. The SipFilter can still update any headers in the response prior to sending to the client. Any non-success status indicates that the response has already been sent. However, the SipFilter still has an opportunity to create the initial reference SIP notify message back to the client which identifies the state of the subscription. This is done by calling request.createInitialNotify().
The SIPFilterChain passed in to this method allows the Filter to pass on the request to the next entity in the chain. A typical implementation of this method would follow the following pattern:
  1. Examine the request
  2. Optionally wrap the request object with a custom implementation to filter content or headers for input filtering
  3. Optionally wrap the response object with a custom implementation to filter content or headers for output filtering
    1. Either invoke the next entity in the chain using the FilterChain object (chain.doSubscribe()),
    2. or not pass on the request/response pair to the next entity in the filter chain to block the request processing
  4. Directly set headers on the response after invocation of the next entity in the filter chain.

Parameters:
request - The SIP SUBSCRIBE request
response - The SIP SUBSCRIBE response to the SIP Subscribe request
chain - SIP Filter Chain
Throws:
IOException
XdmsException

doSuccessResponse

void doSuccessResponse(javax.servlet.sip.SipServletResponse response,
                       SipFilterChain chain)
                       throws java.io.IOException,
                              XdmsException
This method is invoked if a successful response is returned from a SIP NOTIFY request.

Parameters:
response - The SipServletResponse
chain - SIP Filter Chain
Throws:
IOException
XdmsException

doErrorResponse

void doErrorResponse(javax.servlet.sip.SipServletResponse response,
                     SipFilterChain chain)
                     throws java.io.IOException,
                            XdmsException
This method is invoked if an error response is returned from a SIP NOTIFY request.

Parameters:
response - The SipServletResponse
chain - SIP Filter Chain
Throws:
IOException
XdmsException