Skip to main content

SailFin CAFE: Implementing a simple conference application.

Posted by binod on October 18, 2009 at 11:45 PM PDT

Hope you have read my blog on "Writing your first SailFin CAFE Application". There I explained how to handle a 2-party call using SailFin CAFE.

Now lets see how can you write a simple conference application. The application would accept the calls from any participant and if the participant is calling a conference id, then the application should use a media server, handle SDP, mix the voice, apart from handling the necessary SIP signalling. If you are writing such an application with SIP Servlets and JSR 309 Media control API, it would take serveral pages of code like this.





But, if you are using SailFin CAFE, then it comes down to a single method implementation of 4-5 lines of code.

A SailFin CAFE application can override the default behavior (of forwarding the call to the other party) by implementing a communication event.
The following code intercepts all incoming calls and those with callee "" will create a conference with the name "".

public class YourCommunicationPOJO {

    @Context CommunicationSession sess;
    @Context CommunicationContext ctx;

    void handleInit() {
         Conversation call = (Conversation) ctx.getCommunication();
         String confName = call.getCallee().getUserName();
         if (confName.equalsIgnoreCase("")) {
             sess.createConference(confName, call);

Thats it! Rest everything will be handled by the framework. Here is the java file for your reference.

To run this application, execute the following steps.

  • Download and install latest SailFin V2 promoted build.
  • Download and install latest SailFin CAFE build (b11 or later).
  • Package the application using the normal web application packaging format. Use your favorite IDE to do that. For compilation, please use SAILFIN_HOME/lib/communication-api.jar.
  • Start/Restart SailFin and deploy the application (eg: asadmin deploy cafesample.war).
  • Start three or more X-Lite phones.
  • On the dial-pad of each X-Lite phone type "" and click the dial button. You can see each one of them joining the conference.
  • There are many more features available now and are being added. Take a look at the javadoc and project site for more information. I will come back with another interesting feature soon.