Receiving unmatched messages in Session Initiation Protocol (SIP) on Liberty
Use the UnmatchedMessageListener API to receive incoming Session Initiation Protocol (SIP) request or response messages that the SIP container cannot process.
Before you begin
In your server.xmlfile, install and configure the sipServlet-1.1 feature. For more information, see Administering Session Initiation Protocol (SIP) on Liberty.
About this task
The SIP container provides an interface that enables an application to receive all incoming request or response messages that cannot be matched to any existing dialogs. Any request or response messages that are not matched to an existing dialog are known as unmatched messages.
An unmatched request is a request that has To and From tags, but the related dialog is not found in the SIP container because it was never created or this dialog is in the invalidated state. When an incoming unmatched request is received by the SIP container, the container responds with a 481 Call/Transaction Does Not Exist response, and then forwards the incoming request to the listener class. The incoming request is forwarded as part of the UnmatchedRequestEvent event, which is defined in the com.ibm.websphere.sip.unmatchedMessages.events package. The event contains an interface to get the incoming unmatched request and the ServletContext related to the application that receives the event. The application can use the ServletContext to create new SIP activity. The listener cannot create a response for the received unmatched request or proxy the request. When this condition occurs, an IllegalStateException exception occurs in the SIP container.
An unmatched response is a response that is received in the SIP container, but the response is not matched to any outgoing requests. Before the SIP container discards the unmatched response, the unmatched response is sent to the UnmatchedMessageListener listener as part of the UnmatchedResponseEvent event. Similar to the unmatched request, the application gets access to the unmatched response and to the related application ServletContext.
If an application has more than one defined UnmatchedMessageListener listener, each listener is started independent of each other. If you have more than one application on a single application server and multiple applications have UnmatchedMessageListener listeners, all listeners are started in a random order. If one application sends a request to another application on the same server as part of application composition, and the SIP container determines that this request is a request that cannot be handled by the SIP container, then all of the UnmatchedMessageListener listeners on that server are activated.
The UnmatchedMessageListener API is defined in the com.ibm.websphere.appserver.api.sipServlet file in the com.ibm.websphere.sip.unmatchedMessages package.
Procedure
You can use one of the following methods in the application code to access the UnmatchedMessageListener API: