Posts Tagged ‘SIP Servlets’

Test Drive Voxeo Prism

Tuesday, November 23rd, 2010

If you have followed my last blog, you should have Voxeo Prism installed and running by now.

In this blog, I want to show you how to use a SIP phone to test drive Voxeo Prism. Voxeo Prism comes with a demo application that demonstrates the following functions:

  • SIP voice call
  • DTMF input recognition
  • SIP instant messaging (using SIMPLE)
  • Text-to-Speech
  • Recording
  • Media playback

The following video shows how you can use XLite, a free softphone with both voice and instant messaging capabilities, to test drive Voxeo Prism.

In the future blog, I will show you how this demo application looks like.


Want to learn how Voxeo can help unlock your communications and deliver a better customer experience? Please contact us!

If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


How to install Voxeo Prism?

Thursday, November 18th, 2010

Last blog introduced the basic concepts of Voxeo Prism communication platform. Here I will walk you through step by step on how to install Voxeo Prism.

System Requirements

Voxeo Prism requires a modern Intel based PC with at least 2G of RAM and 1G of free disk space. Voxeo Prism supports Windows (both 32 and 64 bit), Linux (CentOS, both 32 and 64 bit), and Mac.

Please note you must have root privilege on Linux and Mac in order to install Voxeo Prism.

Download Voxeo Prism

Voxeo Prism installers are available at http://www.voxeo.com/prism. Download one suitable for your system.

Install Voxeo Prism

The following are step-by-step instruction on installation. Note that the following screenshots are taken on Mac.

Step 1. Introduction.

Step 2. License Agreement. You must accept the License Agreement in order to install Voxeo Prism.

Step 3. Choose the installation directory. By default, Voxeo Prism is installed in /opt/voxeo/prism on both Linux and Mac, and \Program Files\Voxeo\Prism on Windows.

Step 4. Choose what services to install. By default, Voxeo Prism installs both Application Server service and Media Server service. By checking “Start services automatically”, Voxeo Prism services will be started after installation and when the system is booted up.

Step 5. Choose what modules to install. Modules are pre-built applications on top of Prism. Each module itself deserves another blog to talk about. Unless you are interested in specific modules, for the sake of simplicity, I would recommend not to install these modules.

Step 6. After review the “Pre-Installation Summary”, please click Install button.

Step 7. Installation is completed.

Start/Stop Voxeo Prism

Once the installation is completed, on Windows or Mac, you will also see a systray application being installed. This allows you to start/stop Voxeo Prism from a graphical user interface.

You may also start/stop Voxeo Prism via command line.

  • <prism>/bin/prism start
  • <prism>/bin/prism stop

You may also start/stop individual Voxeo Prism service — Application Server and Media Server — respectively. Please refer to the User Guide for more details.

Prism Home Page

Once Voxeo Prism is started, clicking the “Prism Home” menu item on the systray application will open up the Prism Home page in your web browser. Or simply go to http://localhost:8080 from your web browser.

From the Prism Home page, you can access Read Me, User Guide, Prism Management Console, and Samples. You can also register your Voxeo Prism installation with Voxeo from the Prism Home page.

Prism Management Console

Clicking “Prism Management Console” link in the Prism Home page will open up the Prism Management Console. The default login name and password are admin and admin respectively.

Prism Management Console allows you configure, manage, and monitor the Voxeo Prism and the applications.

For more details about Prism Management Console, please refer to the User Guide.

By now, Voxeo Prism should be installed and running on your system. In the next blog, I will show you how to use the Prism Demo Application to test drive Voxeo Prism.


Want to learn how Voxeo can help unlock your communications and deliver a better customer experience? Please contact us!

If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


Introduction to Voxeo Prism

Thursday, November 18th, 2010

Voxeo Prism is carrier-grade converged communication platform. It supports both Web technologies and communication technologies such as SIP and XMPP.  It comes with full media capabilities such as media playback and recording, as well as multi-party conferencing. It also supports advanced speech technologies such as text-to-speech and speech recognition.

Voxeo Prism can be used for various applications, from traditional softswitch and call center to real-time social networking applications. Voxeo Prism is built from the ground up with performance and scalability in mind.  It can support up to 40,000 concurrent calls at 1,000 call attempts per second (CAPS) on a single high performance Intel server.

You may wonder how Voxeo Prism compares with Voxeo Prophecy and Voice Object products. In short, Voxeo Prism provides a flexible and powerful general-purpose API-driven development platform for communication applications. Voxeo Prophecy, on the other hand, is an XML driven development platform for IVR-centric applications. Voice Object provides a drag-n-drop GUI development platform for IVR applications. Currently only Voxeo Prophecy and Voice Object application hosting is provided in Voxeo cloud.

From a technology stack point of view, Voxeo Prism is the cornerstone for Voxeo Prophecy and other Voxeo offerings such as Tropo and Phono. For example, a Voice Object application generates VoiceXML documents to be executed by Voxeo Prophecy, which, in turn, translates all the VoiceXML semantics into API calls on Voxeo Prism, as illustrated by the following diagram.

Voxeo Prism supports the following standard Java APIs. You can use any or all of these APIs in a single application to support multimodal use cases.

  • Java Servlet/JSP is the standard Java API for building web applications.
  • SIP Servlet is the standard Java API for building communication applications using SIP, such VoIP call centers.
  • XMPP Servlet is an API developed by Voxeo based on the Java Servlet framework for building XMPP based application such as instant messaging.
  • Java Media Control is the standard Java API for controlling media operations on a media server.

Voxeo Prism includes a HMP media server on Windows, Linux, and Mac. The media server supports the following media capabilities. All these capabilities can be manipulated through Java Media Control APIs.

  • media playback and text-to-speech.
  • DTMF detection and voice recognition.
  • media mixing and multiparty conferencing.
  • media recording or multi-track call recording.

In summary, Voxeo Prism is a powerful platform for innovative IP communication applications.  If you are a Java programmer and want to develop communication applications, Voxeo Prism is the right platform for you. To try out, simply go to www.voxeo.com/prism to download one of the installers for your desired platform. As always, Voxeo provides free 24×7 technical support for developers.

In the next blog, I will show you how to install Voxeo Prism on your system.


Want to learn how Voxeo can help unlock your communications and deliver a better customer experience? Please contact us!

If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


Slides available for Voxeo CTO RJ Auburn’s JavaOne talk “Taking a SIP of Java”

Thursday, June 4th, 2009

This week Voxeo CTO RJ Auburn spoke out at the JavaOne conference on the topic of “Taking a SIP of Java“. RJ’s slides are now available on SlideShare at:

http://www.slideshare.net/voxeo/javaone-a-sip-of-java-rj-auburn

And the presentation, also embedded below, looks to be a classic RJ kind of talk… fun, lively, interesting… and also with some code. I don’t know if there were any recordings made, but if there were I’ll update the article with a link. Enjoy the talk!


If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook or following us on Twitter.


Technorati Tags: , , , , ,


Want to learn how Voxeo can help unlock your communications and deliver a better customer experience? Please contact us!

If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


Video from eComm: Voxeo CTO RJ Auburn on Building Voice Mashups using Tropo.com

Monday, May 18th, 2009

eComm organizer Lee Dryburgh recently made the video available of Voxeo CTO RJ Auburn’s talk at eComm in March titled “Building Voice Mashups using SIP Servlets” but which really focused on all the cool things you can do with Tropo.com (and Tropo is built on top of SIP Servlets). You can view it here – and the slides are embedded below the video:

RJ’s slides are available here:


If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook or following us on Twitter.


Technorati Tags: , , , , ,


Want to learn how Voxeo can help unlock your communications and deliver a better customer experience? Please contact us!

If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


SIP Servlet programming: Basics

Friday, October 24th, 2008

Here I would like to start a series of blogs to talk about how to build advanced VoIP services with SIP servlet technology.

This blog covers some of the basic concepts about SIP servlet technology and demonstrate a simple SIP proxy server using SIP servlet programming model.

What is a Servlet and a Servlet Container?

A servlet is  a Java component which is managed by a servlet Container and which responds to messages of an application protocol.

A servlet container, typically part of an application server, manages the lifecycle of servlets, sends and receives the messages for servlets. It also provides other services such as security to servlets as well.

The following diagram shows the relationship of a servlet, servlet container, application server, and Java virtual machine.

When needed, the servlet container loads the servlet class, instantiates (a.k.a. new()) the servlet and invokes its init() method with the configuration in the form of ServletConfig object. Once initialized, the servlet is able to serve the messages. The servlet container repeatedly invokes the servlet’s service() method with the incoming messages in the form of ServletRequest and ServletResponse objects. The servlet container can deactivate a servlet by invoking its destroy() method and makes the servlet eventually be garbage collected.

As you can tell, the lifecycle of a servlet is rather simple. The service() method is where all the interesting actions are during its life. What a servlet does in its service() method fundamentally depends on the application protocol the servlet supports.

What is a HTTP and a SIP Servlet?

Simply speaking, a HTTP servlet is a kind of servlet that supports HyperText Transfer Protocol, and a SIP servlet is a kind of servlet that supports Session Initiation Protocol. If you are familiar with Object Oriented programming, you should be able to think of the following class diagram.

The latest HTTP servlet specification (and the generic servlet specification) is Servlet 2.5. The latest SIP servlet specification is SIP Servlet 1.1. You may notice that the APIs of both specifications are quite similar. However there are many subtle differences due to the differences of the protocols.

The most fundamental difference of a HTTP servlet and a SIP servlet is what a servlet can do in the service() method.

HTTP is a synchronous protocol where a HTTP servlet is expected to receive a HTTP request and respond with a HTTP response before it can serve another HTTP request. In the HttpServlet.service(HttpServletRequest request, HttpServletResponse response) method, a HTTP servlet is expected to process the request and write the output into the response within the method invocation.

SIP is an asynchronous protocol where a SIP servlet can receive a SIP request and response at any time. In the SipServlet.service(SipServletRequest request, SipServletResponse response) method, only one of the parameters – either the request or the response – is valid. The SIP servlet is expected to receive the request or response in the service() method but can either process it within the method invocation or save it for processing at a later time. A SIP servlet can also issue requests or responses at any time as long as the servlet is in the initialized state.

How to write a SIP servlet?

Writing a SIP servlet starts with creating a subclass of the SipServlet class. Instead of overwriting the service() method, you typically overwrite one of the doXXX() methods.

The doXXX() methods are defined to modularize the logic within the service() method. The default implementation of SipServlet.service() method calls one of the doXXX() methods based on the type of the message it receives. For example, for a SIP INVITE request, doInvite() method is invoked.

Because most of SIP protocol details, such as message parsing, retransmission, transaction and dialog management, are abstracted away from a SIP servlet, the logic with these doXXX() methods shall just focus on the high level functionality.

Here I demonstrate how easy it is to write a stateful SIP proxy with a SIP servlet – just 4 lines of code, including one optional line.

public class ProxyServlet extends SipServlet {
  public void doInvite(SipServletRequest request) throws ServletException, IOException {
    if (request.isInitial()) {
      Proxy proxy = request.getProxy();
      proxy.setRecordRoute(true); //optional
      proxy.proxyTo(request.getRequestURI());
    }
  }
}

In the doInvite() method, I first check to see if the request is an initial request – a request that doesn’t match any existing SIP dialogs. If true, I simply create a Proxy object out of the request. I can optionally invoke Proxy.setRecordRoute() method to indicate this SIP proxy records the route. Then just simply proxy the request to its destination by invoking Proxy.proxyTo() method with the original request URI.

That’s it – now I have a functional stateful SIP proxy. What about all the complex Proxy Behavior in RFC 3261? The SIP servlet container has taken care of most of the standard work once it knows the SIP dialog associated the INVITE request is intended for proxy. Isn’t this wonderful to an application developer?

How to build a SIP servlet application?

A typical SIP servlet application probably involves more than just one SIP servlet class. In order for the SIP servlet container to properly load and run a SIP servlet application, the application has to be assembled into a hierarchical directory structure with additional deployment descriptors, as shown in the following.

  |-- WEB-INF
  |     |-- classes  (where all the java classes are)
  |     |   |-- com
  |     |       |-- voxeo
  |     |           |-- sipmethod
  |     |               |-- tutorial
  |     |                   |-- one
  |     |                       |-- ProxyServlet.class
  |     |-- lib (where all the library JARs are, if any)
  |     |-- sip.xml (optional SIP deployment descriptor XML)
  |     |-- web.xml (optional HTTP deployment descriptor XML)
  |-- index.html (document files)

The root of the hierarchy is where all the documents, such as index.html, are, although there is none in this tutorial.

A special directory under root is WEB-INF, which is where all other stuff are, such as Java classes, libraries, deployment descriptors, etc.

All the Java classes including servlets shall be placed under WEB-INF/classes directory. The above diagram shows how ProxyServlet.class is placed. WEB-INF/lib is where all the third-party libraries (i.e. JARs) are, in which I don’t have any in this tutorial. All the deployment descriptors – sip.xml and web.xml – are also under WEB-INF directory.

A deployment descriptor is an XML file that conveys information about how the application is assembled and to be deployed. In other words, these are meta data about the application.

With the latest servlet standards, these meta data can also be specified in the Java classes using Java annotations. For example, to specify deployment information about the ProxyServlet, we add a class level annotation – @SipServlet – to specify the name for the servlet

@javax.servlet.sip.annotation.SipServlet(name="Proxy")
public class ProxyServlet extends SipServlet {
  ...
}

sip.xml is the deployment descriptor for all the SIP related meta data. Here I specify the application name, the default timeout value for proxy and the main servlet of the application. (These information can be specified using Java annotation as well.)

      <sip-app xmlns="http://www.jcp.org/xml/ns/sipservlet"
               xmlns:javaee="http://java.sun.com/xml/ns/javaee">
        <app-name>SIP Proxy Server</app-name>
        <main-servlet>Proxy</main-servlet>
        <proxy-config>
          <proxy-timeout>300</proxy-timeout>
        </proxy-config>
      </sip-app>

I don’t have web.xml in this tutorial. I will cover web.xml when talking about converged applications.

Typically we package the above directory structure into a Servlet Archive (SAR) using the standard Java Archieve (JAR) format, which is essentially a ZIP file. Here is the SAR file of the above SIP proxy sample.

How to deploy and run a SIP servlet application?

Deploying a SIP servlet application typically means deploying the SAR of the application to a SIP servlet container. Running the SIP servlet container typically runs all the SIP servlet applications deployed within that container.

The exact steps of deploying and running a SIP servlet application depends on which SIP servlet container and application server you use. The following steps are based on SIPMethod Application Server.

  1. Make sure you have JDK 1.5 or later installed on your system.
  2. Install SIPMethod Application Server 4.0 (beta). Let’s call where SIPMethod Application Server is installed <sm_home>.
  3. Remove all all the files and directories under <sm_home>/apps. This step is to simplify the application routing since we haven’t talked about the concept of Application Router yet.
  4. Copy the SAR file of the above sample into <sm_home>/apps directory.
  5. Assuming environment variable JAVA_HOME is pointing to where the JDK is installed, running <sm_home>/bin/startup.[bat | sh] shall start SIPMethod Application Server.
  6. Now your SIP proxy server is up and running.

To test your SIP proxy server, you can try any softphone that can be configured with an outbound proxy server. Once you configure SIPMethod Application Server as the outbound proxy server (by default, SIPMethod listens on port 5060 on all local IPs), the call made from the softphone shall be proxied through your SIP servlet based SIP proxy server to its destination.

Hopefully this blog gives you some basic ideas about SIP servlet programming. There are still quite a lot to be covered, such as converged applications, application composition, etc. So stay tuned for more SIP servlet programming blogs.


Want to learn how Voxeo can help unlock your communications and deliver a better customer experience? Please contact us!

If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.