Skip to main content

Running SailFin CAFE applications on Oracle Communications Converged Application Server -- preliminary notes

Posted by bhavanishankar on February 26, 2010 at 7:44 PM PST

Installing OCCAS

Install OCCAS 4.0 under directory /opt/oracle (here in after referred to as OCCAS_HOME), and configure a domain by running OCCAS_HOME/wlserver_10.3/common/bin/config.sh (with all default options). With that, you will have a domain created at OCCAS_HOME/user_projects/domains/base_domain

Installing CAFE on OCCAS

Get the latest CAFE promoted build from here. Unzip the downloaded sailfin-cafe-v1-b<number>_installer.jar under OCCAS_HOME/user_projects/domains/base_domain/lib

Set the environment variable EXTRA_JAVA_PROPERTIES="-Dwlss.local.serialization=false" and run OCCAS_HOME/user_projects/domains/base_domain/bin/startWebLogic.sh to start OCCAS.

With that, CAFE framework is all set on OCCAS to run your CAFE applications.

Running CAFE apps on OCCAS:

I will provide some example CAFE applications to run it on OCCAS.

(1) Simple two party call

Deploy the simple two-party-call.war CAFE application by dropping it under OCCAS_HOME/user_projects/domains/base_domain/autodeploy directory. Now the application is ready to make two party calls. Refer to the final section of binod's blog to test this application using X-Lite.

The two-party-call.war has the following contents:

./WEB-INF/classes/org/glassfish/cafe/testapp/SimpleCommsBean.class

package org.glassfish.cafe.testapp;

import org.glassfish.cafe.api.bean.CommunicationBean;

@CommunicationBean
public class SimpleCommsBean {
}

./WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
  <listener>
    <listener-class>
     org.glassfish.cafe.integration.occas.CafeContextListener
   </listener-class>
</listener>
</web-app>

./WEB-INF/sip.xml

<?xml version="1.0" encoding="UTF-8"?>
<sip-app xmlns="http://www.jcp.org/xml/ns/sipservlet" xmlns:javaee="http://java.sun.com/xml/ns/javaee">
    <app-name>two-party-call</app-name>
    <servlet>
        <javaee:servlet-name>two-party-call__CafeServlet</javaee:servlet-name>
        <javaee:servlet-class>org.glassfish.cafe.core.Servlet</javaee:servlet-class>
        <javaee:load-on-startup>0</javaee:load-on-startup>
    </servlet>
</sip-app>


Note:
The app-name and servlet-name prefix should match the name of the .war file (two-party-call in this case)


This is the same CAFE application that you would have run on SailFin server, but with the addition of two deployment descriptors (WEB-INF/web.xml & WEB-INF/sip.xml).

(2) Conference application

In order to run conference application you need a media mixer. So, we need to first integrate the jvoicebridge (bundled with CAFE) with OCCAS, by following these steps :

  1. $ cd OCCAS_HOME/user_projects/domains/base_domain/lib/jvb/bridge
     
  2. Edit run.properties to change voicebridge.sip.port=5070. (Otherwise the port 5060 will conflict with OCCAS)
     
  3. Start jvoicebridge by running OCCAS_HOME/modules/org.apache.ant_1.6.5/bin/ant -f run.xml (make sure ANT_HOME is set to OCCAS_HOME/modules/org.apache.ant_1.6.5, and JAVA_HOME is set to OCCAS_HOME/jdk160_05)
     
  4. Deploy the jvoicebridge connector by copying OCCAS_HOME/user_projects/domains/base_domain/lib/jvb-ra.rar to OCCAS_HOME/user_projects/domains/base_domain/autodeploy directory.

With that, the jvoicebridge is integrated with OCCAS-CAFE. Now deploy your conf-app.war CAFE application by dropping it under OCCAS_HOME/user_projects/domains/base_domain/autodeploy directory.


Note :
Prior to deploying conf-app.war, undeploy two-party-call.war by deleting it from autodeploy directory.


Now your CAFE application is ready to handle the conference calls, and the configuration looks like this:

If you are using X-Lite phone, then type "conf1@example.com" on the dial-pad of each each phone and click the dial button. You can see each one of them joining the conference, like this:

On the console where you started the jvoicebridge, you can see various control messages that are printed by the jvoicebridge.

Now to offer some insight into the deployed conf-app.war, it just has one simple communication bean (shown below), and the deployment descriptors:

./WEB-INF/classes/org/glassfish/cafe/testapp/YourCommunicationPOJO.class

package org.glassfish.cafe.testapp;

import org.glassfish.cafe.api.Conversation;
import org.glassfish.cafe.api.CommunicationSession;
import org.glassfish.cafe.api.CommunicationContext;
import org.glassfish.cafe.api.Context;
import org.glassfish.cafe.api.bean.CommunicationBean;
import org.glassfish.cafe.api.bean.CommunicationEvent;

@CommunicationBean
public class YourCommunicationPOJO {

    @Context CommunicationSession sess;
    @Context CommunicationContext ctx;

    @CommunicationEvent(type=CommunicationEvent.Type.INITIALIZATION)
    void handleInit() {
         Conversation call = (Conversation) ctx.getCommunication();
         String confName = call.getCallee().getName();
         if (confName.equalsIgnoreCase("conf1@example.com")) {
             sess.createConference(confName, call);
         }
    }
}

The deployment descriptors are same as that of two-party-call.war with app-name and servlet prefix set as conf-app in WEB-INF/sip.xml

(3) Accessing communication session from jsp and http servlet

If you want to do something as in binod's blog with CAFE on OCCAS, then you can access the communication session from jsp or http servlet like this:

public class SimpleTestServlet extends HttpServlet{

    @Context CommunicationSession session; // as of now, this injection does not work on OCCAS

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            if(session == null) {
                session = (CommunicationSession)request.getSession().getAttribute(CommunicationSession.NAME);
            }
             ....
    }
}

Ditto for jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="org.glassfish.cafe.api.CommunicationSession"%>
<%
    CommunicationSession commSession = (CommunicationSession) session.getAttribute(CommunicationSession.NAME);
    ...
%>

 

Continue reading MSRP on OCCAS with CAFE

AttachmentSize
conf-call.png165.96 KB
occas-jvoicebridge.png12.44 KB