Tech blog to share ideas about ongoing project and discuss interesting stuff related to Communication tech and programming.

Wednesday, August 13, 2008

UMTS 3G Video Portal using JSLEE and WebFlow

Recently I've been working on a 3G video portal based on JSLEE (a java event driven application server) and Spring WebFlow 1.0.5 (a flow execution engine that allows to design a web app as a state machine).

The Video Portal uses SIP to established incoming calls and after the call is setup a Flow execution session is started to keep track of the state of the user inside the container. The user can interact with the video portal from a UMTS phone using DTMF tones sent to the application server as SIP INFO messages or inside the media path.

The JSLEE container provides a well define concurrency model using the concept of activity, all the event belonging to a given call are queued inside a so called activity context and are received by the application logic instantiated by the container to handle the call and registered to receive all the events inside the call.

Once the call is setup the application logic inside JSLEE (implementing using Service Building Blocks) ask the WebFlow Registry for a flow definition using a flow id and creates a flow execcution session and start the flow execution. After the flow is created all the events belonging to the call (like DTMF) are notified to the flow execution. The Flow Session is saved inside a persistent field that allows to continue the flow execution on a different node in case of failure of the first active node.

The call events are passed to the flow using a method of FlowExecutionImpl with the following signature:

Application signalEvent(String eventId, ExternalContext ctx)

the flow engine execute the transition described inside the flow definition for the given event, returns a view to be presented to the user and waits for the next event. The view usually is the url of the new video to be streamed to the user mobile phone using a Media Server.

A flow definition in spring webflow is represented using an XML files that defines the state machine implementing the video portal flow. The Flow Definition is very closed to the specification of the video portal application coming from the marketing, this reduces drammatically the implementation of the video application and provides a very fast and clean way to change the video portal behaviour according to the marketing needs.