Saturday, December 6, 2008

Mobicents at Devoxx

UPDATE: Making the slides available in PDF and google documents.
And if you want to view in your browser here is the quickie and this is the BOF (some formatting is lost).


Devoxx (a.k.a. JavaPolis) is starting tomorrow. Ed and I have a converged applications BOF on Day 2, where we will be covering the Mobicents platform and you can ask questions about any Mobicents technology - JAIN SLEE, Sip Servlets, Media Server, etc. Also, there will be another talk on Mobicents Sip Servlets about what's new and cool there. Among other things, I will be demoing the Seam integration, how to code&deploy SIP applications quickly with JBoss Developer Studio and possibly some ways to make active Web UI with AJAX and Reverse AJAX.

If you are up for a meeting ping me on vladimir.ralev at gmail.com.

Looking forward..

Thursday, November 20, 2008

JBoss Seam enhances Sip Servlets

Seam-managed SIP components. How about that? Seam components can now handle real SipServletRequests while taking advantage of the Seam perks - bijection, scoping, transaction management, interceptors and everything else.

Your SIP and HTTP Servlets are running in the same servlet context and they share the same application-scoped components, while the session-scoped components are mapped to the respective SIP and HTTP sessions*. You can work with both EJBs and POJOs, interact with your web-layer, and still build very loosely coupled telco components working on the same messages without being aware of each-other. Seam provides synchronous and asynchronous light-weight message passing through the @Observer-annotated methods, which covers most of the communication needs in converged applications.

How it works?

The Seam 2 core is now mostly independent of HTTP Servlets and JSF. Basically we hooked a controller Sip Servlet and session listeners to the Seam lifecycle to control the context assignment for incoming SIP messages. When a SIP message arrives, we raise Seam events to notify the Seam components subscribed to receive the SIP events. We had to use a small Java reflection hack to reach some protected Seam contexts, but I believe it is safe. We will try to make it more clean.

The setup is straightforward - just add the controller servlet to your Seam application in a Sip Servlets container and it's ready to go. For now you can start with the sample application.

Theoretically this technique can work on any JSR289-compliant container that supports JBoss Seam, but I have only tested it on Mobicents Sip Servlets 0.6/0.7 with JBoss Application Server 4.2.3 and Seam 2.1.0.SP1.

One example

This is simple SIP service which responds to an INVITE and counts the number of messages per session. There is a session-scoped counter, which is incremented on every message. Note how you can subscribe methods to SIP events. You can subscribe as many methods as you like in any Seam component, they all will be notified.

@Name("simpleSeamSipService")
@Scope(ScopeType.STATELESS)
@Transactional
public class SimpleSeamSipService {
@Logger Log log;
@In SessionMessageCounter sessionMessageCounter;

public void incrementMessageCounter() {
sessionMessageCounter.increment();
log.info("Processed SIP messages "
+ sessionMessageCounter.getMessages());
}

@Observer("INVITE")
public void doInvite(SipServletRequest request)
throws Exception {
incrementMessageCounter();
request.createResponse(180).send();
Thread.sleep(100);
request.createResponse(200).send();
}

@Observer("ACK")
public void doAck(SipServletRequest request)
throws Exception {
incrementMessageCounter();
}

@Observer({"REGISTER","BYE"})
public void sayOK(SipServletRequest request)
throws Exception {
incrementMessageCounter();
request.createResponse(200).send();
}

@Observer({"RESPONSE"})
public void sayOK(SipServletResponse response)
throws Exception {
incrementMessageCounter();
}
}
You should keep in mind that the Seam events are application-wide. If you need cross-application messaging use JMS (which accidentally is also effortless with Seam).

And here is the SIP-session scoped component:

@Name("sessionMessageCounter")
@Startup
@Scope(ScopeType.SESSION)
public class SessionMessageCounter {
private int messages;

public int getMessages() {
return messages;
}

public void increment() {
messages++;
}
}
Actually, this component is created and stored in every Seam session, no matter if it's SIP or HTTP. This is a bit inefficient, but has some advantages. Ultimately we would want to have a separate SipSession and SipApplicationSession scopes in Seam and we will probably get there with the user-defined scopes in Web Beans (JSR 299) or a newer version of Seam.

Why use it?
  • All the Seam goodness.
  • Development will be easier, because you can take advantage of the Seam WEB-INF/dev classloader to deploy Seam components faster. Otherwise you have to redeploy the whole war/ear (10-20 secs vs 1-2 secs). This feature is not perfect yet.
  • Testing - Seam provides a great framework for testing based on dependency injection and mocking.
  • Programming model is practically the same as the one you use for Web apps with Seam and similar to the future Web Beans.
  • Potential to integrate with jBPM and JBoss Rules through Seam. (contributors?)

Why not to use it?
  • It is not standards-based.
  • Performance is suffering a bit with Seam.
You can find the sample application in SVN:
http://mobicents.googlecode.com/svn/trunk/servers/sip-servlets/sip-servlets-seam

We will soon provide a kit for integrating this capability in your applications. Until then, use the sample application.



*(We currently have no use for conversation scope in SIP.)

Saturday, October 25, 2008

A Conference Demo for Sip Servlets

UPDATE: Now the Media Server has been released and the application doesn't need any tweaks to work. All dependencies come from the maven repository.

There is a new example application for Sip Servlets - a conference demo. Conferencing has been important for many of our users and this is a good way to get them started and show them how easy it is. In fact I spent more time fighting with Maven than actually writing the code for this example (and I know this is not really an achievement).


The features demonstrated by this applications are the following:
  • Mobicents Media Server 1.0.0.CR2 - the latest version of Media Server with the latest MSC API. This Medis Server is not released yet, so you will need to build it from the trunk.
  • Sip Servlets Conference API Preview - this API will help Sip Servets users to create and manage conferences in Media Server and will be part of the future Mobicents Sip Servlets PBX.
  • Server Push updates with GWT - providing instant updates in the browser about the conference status without polling and enabling desktop-like experience. JSR 315 (HTTP Servlets 3.0) will have support for delayed request/response handling, so this is definitely becoming part of the asynchronous web applications in Java, which is particularly useful for real-time interaction with telco applications.
  • Completely annotated Sip Servlets application - minimum glue code and XML.
The application still has some bugs, but I am working on it.

The example is available in SVN from here.

Tuesday, September 30, 2008

Mobicents Sip Servlets 0.6 achieves JSR-289 compliance!

The freshly released Mobicents Sip Servlets 0.6 is now the first open-source JSR-289 compatible server. Or more precisely two servers, since we have both JBoss and Tomcat versions.

Pick your distro from here.

Read more in Jean Deruelle's blog, the official announcement and the project homepage.

If you enjoy watching successful TCK results:
Jean is the man!

Thursday, September 25, 2008

Mobicents team visits the Red Hat office in Munich

We started with an inventory inspection. Turned out there is enough beer in the office to host the entire Oktoberfest. As a moral obligation we had to reduce the amount of alcohol to the lawful limit. Then we moved on to the real Oktoberfest (managers know it as an important telecom conference). After this, everything is blurry.

In the few flashbacks I have from time to time there are some slides about Mobicents, german bars and "forty dollar". Later, a summary of the meetings surfaced here. Check it out if you are interested in the Mobicents roadmaps and current status. I see some exciting things there :)

On the flight back to home (trying to impress the girl next to me) I mixed wine, beer, coffee and apple juice. It rocks.

Munich, sorry for the mess.

Monday, May 12, 2008

Mobicents Sip Servlets Management Console

One of the things that got shipped with Mobicents 1.2.0.BETA1, but didn't receive enough attention is the Sip Servlets Management Console and hopefully this post will reach the users.

The managment console is a web application available at http://localhost:8080/sip-servlets-management/ for those who have the latest Mobicents.



Currently it allows configuring the application router in the Sip Servlets container by dragging the blocks or the columns of the applications associated with certain SIP method and we plan to enhance it with application management and monitoring module, stun, media and other configuration options.

You can see it in action here.

In the future we plan to add wildcard and rules matching to the Application Router configuration tool, so stay tuned.

JavaOne 2008 Materials

JavaOne 2008 was interesting. The Mobicents team held short sessions on the Mobicents Platform. In my presentation I tried to cover the basics of VoIP, show some real world examples and applications, explain the components and the features in Mobicents. I also had a few slides on the new programming model that we are developing now. At the end I made a quick demo of a Facebook click-to-call application that calls two different phones and links them (web-initiated 3pcc).

Unfortunately, it didn't go as planned. It was supposed to be 15 mins presentation and 45 mins demos, and it was 45 mins of presentation and just a few minutes of demo. And I sucked. They shouldn't let me talk to people :)

Anyway, it seems the Mobicents sessions attracted a lot of people interested to learn about converged and VoIP applications. There are a few requests to post the presentations and demos, so here they are:


The demos can be found here:The Facebook demo basically asks for two phone numbers, then you can click Dial and the phones should start ringing. Once you pick up both phones the call is established and both parties can hear each other.



This demo shows is a web store where once the user has checked out with some items in the basket, he receives a call on his phone and must confirm the payment by pressing 1. It is similar to the original JAIN SLEE Converged demo (Shopping demo) and the Sip Servlets Shopping Demo but it uses both JAIN SLEE and Sip Servlets.


First post

Testing