Developing Applications with WebLogic SIP Server

     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 WebLogic SIP Server:

 


Overview of Converged Applications

In a converged application, SIP protocol functionality is combined with other protocols (generally HTTP) 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 assemble converged applications using the basic SIP Servlet directory structure outlined in JSR 116. Converged applications require both a sip.xml and a web.xml deployment descriptor files.

The HTTP and SIP sessions used in a converged application can be accessed programmatically via a common application session object. WebLogic SIP Server provides an extended API to help you associate HTTP sessions with an application session.

 


Assembling and Packaging a Converged Application

JSR 116 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 5-1, each application deployed to the WebLogic SIP Server container has a single SipApplicationSession, which can contain one or more SipSession and HttpSession objects. The basic API provided by javax.servlet.SipApplicationSession enables you to iterate through all available sessions available in a given SipApplicationSession. However, the basic API specified by JSR 116 does not define methods to obtain a given SipApplicationSession or to create or associate HTTP sessions with a SipApplicationSession.

Figure 5-1 Sessions in a Converged Application

Sessions in a Converged Application

WebLogic SIP Server extends the basic API to provide methods for:

These extended API methods are available in the utility class com.bea.wcp.util.Sessions. Table 5-1 provides a summary of each method. See the JavaDoc for more details on this utility class.

Table 5-1 Summary of com.bea.wcp.util.Sessions Methods
Method
Description
getApplicationSession
Obtain a SipApplicationSession object with a specified session ID.
getApplicationSessionsByCallId
Obtain an Iterator of SipApplicationSession objects associated with the specified call ID.
createHttpSession
Create an HTTP session from within a SIP Servlet. You can modify the HTTP session state and associate the new session with an existing SipApplicationSession for later use.
setApplicationSession
Associate an HTTP session with an existing SipApplicationSession.
removeApplicationSession
Removes an HTTP session from an existing SipApplicationSession.
getEncodeURL
Encodes an HTTP URL with the jsessionid of an existing HTTP session object.

Modifying the SipApplicationSession

When using a replicated domain, WebLogic SIP 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, WebLogic SIP 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 5-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

WebLogic SIP 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 are 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