Introduction

Starting with Mobicents SIP Servlets 2.0.0.Final the container now supports WebSocket transport and SIP over Websocket specification. This enable developers to provide a new set of applications, WebRTC applications that brings real time communication to the browser using HTML5.

Check here for a video of the demo application that comes with Mobicents SIP Servlets 2.0.0.Final and read the wiki page for more information for the Mobicent WebRTC demo application.

Cloudbees

CloudBees offers the first Java Platform as a Service (PaaS) that supports the entire application lifecycle, from development through to production. Java developers can quickly and easily create quality software using DEV@cloud. Once the application is ready, instantly deploy it to the cloud using RUN@cloud.

Cloudbees introduced the ClickStart feature to make developer’s life easier. With a provided ClickStack, a user can easily deploy an application to the cloud and start using it.

There is a plethora of ClickStack to be used and recently Mobicent team added one more. the Mobicents Tomcat 7 Clickstack.

Mobicents Sip Servlet Tomcat 7 ClickStack

The Mobicents Sip Servlet Tomcat 7 ClickStack will allow developers to deploy WebRTC applications and use SIP Over WebSocket to the cloud infrastructure of Cloudbees rapidly with no need to setup the container and the infrastructure.

The ClickStack contains the latest Mobicent Sip Servlet 2.1.0 snapshot and the latest Mobicents LoadBalancer.

Deploying a WebRTC Sip Servlet application to Cloudbees

Few modifications need to be made to an application in order to get deployed to the Cloudbees using the Mobicents Tomcat 7 ClickStack.

  • Change the WebSocket port of the container to port 80
  • Define a STUN server
  • Include a mobicents-dar.properties file to the application war, with instructions for the Application Router

When the application is ready you will need to use the Cloudbees SDK in order to deploy the application.

To demonstrate the use of the ClickStack a step by step guide on how to deploy the websocket-b2bua example to Cloudbees follows.

WebSocket-b2bua example to Cloudbees

The WebSocket-b2bua example (https://code.google.com/p/sipservlets/source/browse/#git%2Fsip-servlets-examples%2Fwebsocket-b2bua), needs to be modified as follows.

  • Modify the file https://code.google.com/p/sipservlets/source/browse/sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/js/MobicentsWebRTCPhoneController.js with the following:

    // Default SIP profile to use
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_OUTBOUND_PROXY=”ws://” + window.location.hostname + “:80″;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_USER_AGENT=”MobicentsWebRTCPhone/0.0.1″
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_USER_AGENT_CAPABILITIES=undefined
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_DOMAIN=”webrtc.mobicents.org”;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_DISPLAY_NAME=”alice”;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_USER_NAME=”alice”;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_LOGIN=undefined;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_PASSWORD=undefined;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_CONTACT=”bob”;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_REGISTER_MODE=true;
    MobicentsWebRTCPhoneController.prototype.DEFAULT_STUN_SERVER= “stun.l.google.com:19302″;

  • Next build and package the application, and include the mobicents-dar.properties file the appropriate routing information for the application, for the websocket-b2bua example the dar properties file is:

    OPTIONS: (“WebsocketSample”, “DAR:From”, “ORIGINATING”, “”, “NO_ROUTE”, “0″)
    REGISTER: (“WebsocketSample”, “DAR:From”, “ORIGINATING”, “”, “NO_ROUTE”, “0″)
    INVITE: (“WebsocketSample”, “DAR:From”, “ORIGINATING”, “”, “NO_ROUTE”, “0″)

     

You can downloaded the final modified example application from here

Deploy the application to Cloudbees Run@Cloud

To deploy the application to Cloudbees Run@Cloud you will need to download and install the Cloudbees SDK (https://developer.cloudbees.com/bin/view/RUN/BeesSDK#HInstallingtheCloudBeesSDK).

With the SDK installed you deploy the application using the following command

bees app:deploy -a websocket-b2bua -t mss-tomcat7 -Rjava_version=1.6 -RPLUGIN.SRC.mss-tomcat7=https://s3.amazonaws.com/clickstacks/mobicents/mss-tomcat7-plugin.zip ./websockets-sip-servlet.war

Important to note:

  • -a websocket-b2bua: Defines the name of the Cloudbees application
  • -RPLUGIN.SRC.mss-tomcat7: Defines the location of the Mobicents Sip Servlets Tomcat 7 Clickstack