Skip to main content

Writing your first IM server using SailFin CAFE

Posted by binod on October 27, 2009 at 8:58 AM PDT

In this edition, I am explaining, how to write a simple IM server using SailFin CAFE.

If you have read my earlier blogs on SailFin CAFE (here and here) then there is nothing additional need to be done!. The same applications
that supports 2-party calls or Conference application are already capable of handling IM between two users.

package my.test;
public class YourCommunicationPOJO {

That means the above code will support IM also, apart from supporting 2-party calls.

Here are the steps to run this application.

  • Download and Install latest SailFin V2 build
  • Download and install latest SailFin CAFE build.
  • Package the application using the normal web application packaging format. Use your favorite IDE to do that. For compilation, please use SAILFIN_HOME/lib/communication-api.jar.
  • Start/Restart SailFin and deploy the application (eg: asadmin deploy firstcafe.war)
  • Now your application is ready to test against any SIP phones. To use X-Lite sip phone, follow the steps below.

  • Setup two X-Lite phones with accounts "" and "" respectively. They will register with SailFin CAFE
  • Send IM messages between alice and bob.

  • In the following weeks, I will cover more features like, integration with web applications, redirecting the call, rejecting call, typing detection etc.



    Thank you! This was all very helpful! But I have one more question/request.. :-) Have you got any examples on how to implement presence control within this IM server? I'm new on programming with sailfin (and servers in general..) but i have a school assignment where I'm supposed to implement some kind of group control management for my sip phone and i don't know how to.. :-/ I saw that there are some interesting UserProcedures (PresenceSource, PresenceSource, WatcherInfoSubscriber, GroupWatcher ) but i cant find any examples... Can you help me? Thank youuuu!!! :-)

    Yes, UserProcedures are the

    Yes, UserProcedures are the right way to use Presence. Please take a look at javadocs. Also, take a look at for more details. Feel free to post your question at as well.