Developing SIP Applications

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Developing Converged Applications

The following sections describe how to develop converged HTTP and SIP applications with Oracle Communications Converged Application Server:

 


Overview of Converged Applications

In a converged application, SIP protocol functionality is combined with HTTP or Java EE components to provide a unified communication service. For example, an online push-to-talk application might enable a customer to initiate a voice call to ask questions about products in their shopping cart. The SIP session initiated for the call is associated with the customer’s HTTP session, which enables the employee answering the call to view customer’s shopping cart contents or purchasing history.

You must package converged applications that utilize Java EE components into an application archive (.EAR file). Converged applications that use utilize SIP and HTTP protocols should be packaged in a single SAR or WAR file containing both a sip.xml and a web.xml deployment descriptor file.You can optionally package the SIP and HTTP Servlets of a converged application into separate SAR and WAR components within a single EAR file.

The HTTP and SIP sessions used in a converged application can be accessed programmatically via a common application session object. The SIP Servlet API also helps you associate HTTP sessions with an application session.

 


Assembling and Packaging a Converged Application

The SIP Servlet specification fully describes the requirements and restrictions for assembling converged applications. The following statements summarize the information in the SIP Servlet specification:

 


Working with SIP and HTTP Sessions

As shown in Figure 6-1, each converged application deployed to the Oracle Communications Converged Application Server container has a unique SipApplicationSession, which can contain one or more SipSession and HttpSession objects.

Figure 6-1 Sessions in a Converged Application

Sessions in a Converged Application

The API provided by javax.servlet.SipApplicationSession enables you to iterate through all available sessions in a given SipApplicationSession. It also provides methods to encode a URL with the unique application session when developing converged applications.

In prior releases, Oracle Communications Converged Application Server extended the basic SIP Servlet API to provide methods for:

This functionality is now provided directly as part of the SIP Servlet API version 1.1, and the proprietary API (com.bea.wcp.util.Sessions) is now deprecated. Table 6-1 lists the SIP Servlet APIs to use in place of now deprecated methods. See the SIP Servlet v1.1 API JavaDoc for more information.

Table 6-1 Deprecated com.bea.wcp.util.Sessions Methods
Deprecated Method (in com.bea.wcp.util.Sessions)
Replacement Method
Description
getApplicationSession
javax.servlet.sip.SipSessionsUtil.
getApplicationSession
Obtains the SipApplicationSession object with a specified session ID.
getApplicationSessionsByCallId
None.
Obtains an Iterator of SipApplicationSession objects associated with the specified call ID.
createHttpSession
None.
Applications can instead cast an HttpSession into ConvergedHttpSession.
setApplicationSession
javax.servlet.sip.ConvergedHttpSession.
getApplicationSession
Associates an HTTP session with an existing SipApplicationSession.
removeApplicationSession
None.
Removes an HTTP session from an existing SipApplicationSession.
getEncodeURL
javax.servlet.sip.ConvergedHttpSession.
encodeURL
Encodes an HTTP URL with the jsessionid of an existing HTTP session object.

Notes: The com.bea.wcp.util.Sessions API is provided only for backward compatibility. Use the SIP Servlet APIs for all new development. Oracle Communications Converged Application Server does not support converged applications that mix the com.bea.wcp.util.Sessions API and JSR 289 convergence APIs.
Note: Specifically, the deprecated Sessions.getApplicationSessionsByCallId(String callId) method cannot be used with v1.1 SIP Servlets that use the session key-based targeting method for associating an initial request with an existing SipApplicationSession object. See Section 15.11.2 in the SIP Servlet Specification v1.1 for more information about this targeting mechanism.

Modifying the SipApplicationSession

When using a replicated domain, Oracle Communications Converged Application Server automatically provides concurrency control when a SIP Servlet modifies a SipApplicationSession object. In other words, when a SIP Servlet modifies the SipApplicationSession object, the SIP container automatically locks other applications from modifying the object at the same time.

Non-SIP applications, such as HTTP Servlets, must themselves ensure that the application call state is locked before modifying it in a replicated environment. This is also required if a single SIP Servlet needs to modify other call state objects, such as when a conferencing Servlet joins multiple calls.

To help application developers manage concurrent access to the application session object, Oracle Communications Converged Application Server extends the standard SipApplicationSession object with com.bea.wcp.sip.WlssSipApplicationSession, and adds a new interface, com.bea.wcp.sip.WlssAction to encapsulate changes to the session. When these APIs are used, the SIP container ensures that all business logic contained within the WlssAction object is executed on a locked copy of the associated SipApplicationSession instance.

Listing 6-1 Example Code using WlssSipApplicationSession and WlssAction API
SipApplicationSession appSession = ...;
WlssSipApplicationSession wlssAppSession = (WlssSipApplicationSession) appSession;
wlssAppSession.doAction(new WlssAction() {
       public Object run() throws Exception {
         // Add all business logic here.
         appSession.setAttribute("counter", latestCounterValue);
         sipSession.setAttribute("currentState", latestAppState);
         // The SIP container ensures that the run method is invoked
         // while the application session is locked.
         return null;
       }
     });

 


Using the Converged Application Example

Oracle Communications Converged Application Server includes a sample converged application that uses the com.bea.wcp.util.Sessions API. All source code, deployment descriptors, and build files for the example can be installed in WLSS_HOME\samples\sipserver\examples\src\convergence. See the readme.html file in the example directory for instructions about how to build and run the example.


  Back to Top       Previous  Next