Search
The Open Source SLEE and SIP Server

Mobicents Sip Servlets

Important Note : This example is a modified version of the Mobicents JSLEE Converged Demo available at http://groups.google.com/group/mobicents-public/web/converged-application-demo?hl=en .
It is has been modified to fit to Sip Servlets v 1.1 specification. The purpose here is to demonstrate integration with more technologies and protocols than just SIP and HTTP.
It is a Converged JEE Application showing SEAM & JEE integration and Media integration with TTS and DTMF support.
This application only works on a full JEE Container, in other words it will only work on top of Jboss AS and not Tomcat.

JSR-309 version : This example is also available in JSR-309 based Shopping Demo version. The JSR-309 example can run in both JBoss 4 and JBoss 5

Shopping Demo

Service Description

The idea is to have a converged application that shows how JEE application can leverage Sip Servlets to have voice, message and data transfer seamlessly.  This example is built using Seam, Mobicents Sip Servlets and Mobicents Media Server deployed on Jboss AS.

Application Flow

  • Once User places an order, he/she receives call to confirm for the same.
    • User presses 1 and order state remains as OPEN and flow continues. If User presses 2 order gets CANCELLED and flow completes
  • If order is less than 100$ it gets approved automatically as per the rule set by jBPM and User receives call to set delivery date and time.
  • If order is greater than 100$, Admin has to either approve or reject the order.
  • If Admin doesn't log on the site and take necessary action, call is initiated to Admin and Admin preses DTMF to take necessary action
    • Admin presses 1 and order state changes to PROCESSING and flow continues. If Admin presses 2 order gets CANCELLED and flow completes.
      • User id for Admin is 'manager' and password is 'password'
  • Once order is approved by Admin, a call is initiated to User to set the date and time for delivery
    • Please note that for orders greater than 100$ call to User to set delivery date and time is only initiated if Admin logs on to system and approves. This is becuase the logic is tied with jBPM process and I haven't yet taken care that in SBB.
  • User sets delivery date and time by punching numbers on his/her phone. As soon as this is done user can see the delivery date and time set on 'My Orders' tab and click on 'Show Details' for corresponding order.
  • Once again the ball roles on to Admin, and he/she has to log in the site and mark the order for Shipping
  • As soon as Admin marks the order for Shipping, call is initiated to User to remind him/her date and time when the shipment will arrive.

How to activate it

From the binary

You can find the ear file corresponding to this example here .
It's working with the Mobicents Media Server 1.0.3.GA.
Rename it to shopping-demo.ear
Drop the renamed shopping-demo.ear file into your jboss_home/server/default/deploy directory.

Get the corresponding dar configuration file .
To understand what the dar configuration file is used for, check the Application Router Documentation .
Drop it in your jboss_home/server/default/conf/dars directory.
To use this dar file for this service, specify in the Service xml tag, darConfigurationFileLocation attribute of the jboss_home/server/default/deploy/jboss-web.deployer/server.xml , the following :
conf/dars/shopping-demo-dar.properties.properties

You can now run your Jboss AS Converged Container.

From the source

Setup your Jboss AS to become a converged container as explained here .

Please check out the shopping demo example located under this location from the svn repository. Follow the instructions in the README.txt to build and run the example.

The DAR file for this example can be found at the root of the project. Use this as a DAR file (Service tag/darConfigurationFileLocation attribute in the jboss's server.xml): file:///E:/workspaces/sip-servlets/sip-servlets-examples/shopping-demo/shopping-demo-dar.properties

How to play with it

http://localhost:8080/shopping-demo/

Start a Sip Phone, make it register as a customer (let's say sip:jean@shopping-demo.com) to your Jboss AS SIP Connector listening point (default to 127.0.0.1:5080).

Start another Sip Phone, make it register as admin (if you're using the binary or if you didn't change the sip.xml file it should be sip:admin@shopping-demo.com) to your Jboss AS SIP Connector listening point (default to 127.0.0.1:5080).

Before shopping create a new account and make sure that you enter the SIP address for Phone field of your registered Sip Phone (here sip:jean@shopping-demo.com).

Note: The new account created won't survive server restart. If you want it to survive server restart, it requires you to modify import.sql which is stored under "ShoppingDemo.ear/ShoppingDemo.jar". This is because the SIP phone addresses for all the users (user1,user2 etc...) are hardcoded here and we are using an in-memory database called HSQLDB that is created and dropped on every restart. If you SIP client address is different, this is where you would modify it. To make this easy you can explode the ear under deploy directory and also explode the jar under the ear. That way you can easily modify the import.sql.

For SIP Phone settings you can see examples at SIP Phone Settings for Converged Demo

  • After creation of account once you check out the cart a call will be received on the customer SIP Phone for confirmation.
  • You can check your Order Status via 'My Orders' tab
  • After 30000 milli secs ( value specified for order.approval.waitingtime in convergeddemo.properties) call is received by Admin to confirm the order for Shipping or Cancel if order is greater than 100$ or a call will be received on the customer sip phone for choosing delivery date if order is lower than 100$
  • You can check log out and relog in as manager to accept the order if it is greater than 100$, then a call will be received on the customer sip phone for choosing delivery date. You can also ship the orders that have been accepted and then a reminder call will be placed on the customer sip phone.

Mobicents Sip Servlets