Sailfin CAFE - Click to Call using JSP

Now your JSP is capable of establishing SIP calls. Thanks to Sailfin CAFE, no SIP Servlets needed !!!

Here is the code you need to write:

<%
    CommunicationSession commSession = (CommunicationSession) session.getAttribute("org.glassfish.cafe.communicationsession");
    String party1 = request.getParameter("party1");
    String party2 = request.getParameter("party2");
    try {
       Conversation conv = commSession.createConversation(party1);
       conv.addParticipant(party2);
       out.println("Call started between " + party1 + "and" + party2);
    } catch (Exception e) {
       e.printStackTrace();
    }
%>


Next, you would need to add a CAFE CommunicationBean to the Application.
A simple CommunicationBean looks like:

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

@CommunicationBean
public class CafeCommsBean {
}


Your Click to Call Application is ready !!

Steps to install and run the App:

  • Download and install latest SailFin V2 promoted build.
  • Download and install latest SailFin CAFE build.
  • Package the application as a normal web application. For compilation, please use SAILFIN_HOME/lib/communication-api.jar.
  • Start/Restart SailFin and deploy the application (eg: asadmin deploy CafeApp.war).
  • Register two SIP phones by following the steps mentioned here.
  • Access http://localhost:8080/CafeApp
  • Enter the two user id's and click on call.
  • Click on the Answer button of the SIP Phones. The Call is established !!
  • Comments:

    Post a Comment:
    • HTML Syntax: NOT allowed
    About

    Mohit Gupta

    Search

    Categories
    Archives
    « April 2014
    SunMonTueWedThuFriSat
      
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
       
           
    Today