Mobicents Sip Servlets 2.0.0 Alpha1 on top of Tomcat 7.0.5 is already here and the efforts of the MSS team continues toward complete integration with JBoss AS 7.
Tomcat 7 implements the fresh Java Servlets 3.0 spec – and JBoss AS 7 is targeted to implement it as well – which among others brings two significant features, the asynchronous processing of requests and a new set of annotations, to add on top of the existing annotations, that can be used to define a web servlet, thus make the web.xml deployment descriptor optional (Sip Servlets 1.1 – JSR 289 already provides a set of annotations that can be used in order to define a sip servlet, so make optional the sip.xml deployment descriptor also).
The values of asynchronous processing of requests in a converged HTTP/SIP application are tremendous. Having asynchronous processing in the game, there is no need to send an HTTP request in order for the UI to get updated, this can happen every time a new SIP message arrives.
Any action initiated by the sip endpoint will update the web application and vice versa. For example, when a new user registers, the REGISTER message will update the page to display the new user, and when the client clicks to call this new user, the sip endpoint will start ringing and so on.
A converged application will now be able to follow, present and react almost in real-time on every event that initiated from or destined to the HTTP/SIP Servlet container by any client, either a sip endpoint or a web browser.
Important for the performance of the server is the fact that since there is no request being sent in order to update the UI, there is a low-lag communication thus no waste of server resources or network bandwidth, which is especially valuable when there are multiple clients.
Combined the previous features together, along with MSS 2.0, we can have a converged HTTP/SIP application with no deployment descriptors and asynchronous request processing, or in other words, Server Push, and here its the new, modern, version of the traditional click-to-call example to present in action these features.
In order to play with it you will need the latest MSS 2.0.0 build which can be downloaded from here (just make sure you download build #58 or later). If you want to explore or explode the source code of the application grab it from here.
Start the server as usual and you will find the application already deployed and waiting for you. This asynchronous version of the application replaces the previous click-to-call for the MSS 2.x.
First time you access the servlet http://127.0.0.1:8080/Click2CallAsync you will see a message saying that you need to register at least two sip endpoints or if you have already registered users, you will see them there. Configure your SIP clients to use the sip servlets server as a register and proxy. (ip address : 127.0.0.1, port: 5080). By default it will accept any password.
From there you can take control and initiate a call or end a call as usual, but now on top of that, you can watch the page change to display the status of the sip endpoints when a user registers, de-registers, initiates a call, rejects a call or ends a call. All that without the need for any further request from your browser.
In the following diagram you can see the sequence of messages involved in sending a register and then a de-register request between the Converged HTTP/SIP Servlets container, the browser and the sip endpoint.
When the browser first sends an HTTP GET request to the Converged container, the connection opens and a new AsyncContext is assigned to this request. Doing that will release the original request thread and will delegate the process of this in another thread. Server’s resources will be free and waiting for another client request to process, while the newly created thread is waiting for an event to start processing it.
When a new event arrives, in our example a new SIP REGISTER message, the new thread will be notified about it and using the AsyncContext will prepare and dispatch the response in order to update the browser as needed, without closing the connection though so the same steps will be repeated for every event that will come up.
Java Servlets 3.0 asynchronous processing feature turns to be an essential useful tool for converged HTTP/SIP applications, and at the same time, using it will provide the benefit of having really portable applications since there is no need for any server proprietary COMET implementation or any framework to get the server push functionality.
Have fun with it;-)