Volume 1, Issue 8 - August/September 2001
   
 

Integrating VoiceXML and an Application Server: A Case Study

By Lionel Lavallee

(Continued from Part 1)

Implementation

General overview

The implementation strategy separates content from business logic. We create the static VoiceXML dialogs, grammars, and audio prompts first. Next we secure a gateway-application server link via the Voxeo developer site so that we may test the voice portion of the application (see Footnote 4). Business logic is then implemented independently.

Development

Following is a discussion of the application components that were developed. As mentioned earlier, each of the components support independent efforts by developers specializing in an area of expertise.

Presentation Tier

Voice content is comprised of three basic components: dialogs, grammars and prompts. Each plays a part in the state flow of a voice application. Following is a brief description of these components for the Airline Directory Listings demo.

Dialogs

Dialogs roughly equate to pages in the text world: HTML, WML, HDML, etc. The dialog in voice applications is the VoiceXML markup. As we shall see, there is not a strict one-to-one relationship between the markup languages. In this example, there are five static and one dynamic VoiceXML dialog files:

  • airlineDirMain.vxml - This dialog presents both the initial greeting and final farewell to the application.

  • firstGroupSel.vxml - Prompts the user to select from the first list of 5 airlines

  • secondGroupSel.vxml - Prompts the user to select from the second list of 5 airlines

  • playNumber.vxml - responsible for invoking the call after the user selects the airline.

  • error.vxml - Error handling dialog. This dialog handles unrecognized utterances.

  • Dynamic vxml - Dynamic content is generated by the application server and rendered by the gateway.

The complete implementation for VoiceXML is shown in Listing 1.

Grammars

The interpreter utilizes grammars as comparators and definitions for user utterances. Grammars can become extremely complex for commercial applications, listing all acceptable variations on the desired response. For example if the desired response is "Yes", acceptable responses might be "Yeah", "Yup", "Okay", "Sure", "Yes", or "Uh-huh". Creating the appropriate grammars is a key part of developing user-friendly voice applications. The Airline Directory Listings demo has been kept simple so that no outside grammar references were needed. A look at the source in firstGroupSel.vxml shows a grammar embedded in the VoiceXML markup.

Prompts

Prompts can be text, pre-recorded audio or a mixture of each. Text prompts need to be synthesized into speech via a TTS engine, while audio prompts need to be pre-recorded. Audio files need to be recorded in an 8 kHz, 8 Bit, Mono u-Law format for the system (see Footnote 5). For "Airline Directory Listings", there are five pre-recorded audio files:

  • greeting.wav - The preliminary greeting at the beginning of the application
  • farewell.wav - The farewell message.
  • firstGroup.wav - The audio menu for the first five airlines.
  • secondGroup.wav - The audio menu for the last five airlines.
  • error.wav - An expanded error message explaining that the utterance was not recognized as one of the offered options.

Business Logic

Approach

We set out to accomplish two things with our "Airline Directory" application: (1) demonstrate a VoiceXML implementation and (2) show integration with HP Bluestone's application server, including dynamic VoiceXML generation. We did not want to create an EJB tutorial, however, so we opted to limit ourselves to a single EJB entity requiring fewer Java objects.

Server-side work consisted of database setup and implementation of classes necessary for the Entity EJB and DirectoryServlet servlet.

Database Setup

Airline Directory requires the following table and data:

Directory Table

Field
Type
ID [primary key] number (38)
TELE_NUMBER varchar(128)


Populate the data as follows:

ID
TELE_NUMBER
101 The number for Alaska Airlines is 1, 800, 2 5 2, 7 5 2 2
102 The number for America West is 1, 800, 2 3 5, 9 2 9 2
103 The number for American Airlines is 1, 800, 4 3 3, 7 3 0 0
104 The number for Continental Airlines is 1, 800, 5 2 5, 0 2 8 0
105 The number for Delta Air Lines is 1, 800, 2 2 1, 1 2 1 2
106 The number for Midwest Express is 1, 800, 4 5 2, 2 0 2 2
107 The number for Southwest Airlines is 1, 800, 4 3 5, 9 7 9 2
108 The number for T W A is 1, 800, 2 2 1, 2 0 0 0
109 The number for United Airlines is 1, 800, 2 4 1, 6 5 2 2
110 The number for U S Air is 1, 800, 4 2 8, 4 3 2 2

 

Entity EJB

The Entity Bean requires four Java classes:

  • Directory.java - the remote interface
  • DirectoryBean.java - the Entity Bean class
  • DirectoryHome.java - the home interface
  • DirectoryPK.java - the primary key implementation

As a side note, we opted for Bean Managed Persistence in order to expose the database interactions. These class implementations may be seen in Listing 2. Bluestone's J2EE Developer tool was utilized to create the XML deployment descriptor and deploy the EJB jar file. It should be noted that the tool also made all the necessary changes to configuration files for this application.

DirectoryServlet & Formatter

The DirectoryServlet servlet invokes the Java Naming and Directory Interface (JNDI) to discover and request a remote interface, which it then utilizes to retrieve the 800 number as a String object. It also formats the content into dynamic VoiceXML through a transformation engine which is an embedded service in the application server. The Formatter.java is a convenience class utilized to wrap the returned text string into XML for the transformation engine. The implementation is shown in Listing 3.

Requirements

Following is a list of software requirements necessary to run the application. The evaluation software may be freely downloaded from HP Bluestone's site at: http://www.bluestone.com/

Software requirements

As mentioned earlier, the software is freely downloadable from HP Bluestone.

HP Bluestone

The evaluation software, when downloaded, includes:

  • Evaluation version of Bluestone Universal Business Server and Core Services Framework - this will include the EJB container and other necessary application server components.
  • Configuration files - necessary for deployment.
  • Total-e-Mobile - this includes a full range of demonstrations and documentation for deploying mobile device support.

Database

The Total-e-Mobile download includes PointBase, which is a small footprint database sufficient for this demonstration. Since this demonstration depends on EJB entity beans, a data source is required. We could have demonstrated with a flat file mock up, but utilizing the database is more "real world."

Conclusion

By now you should have been able to run our demo "Airline Directory Listings" application and complete transactions between the voice application and Bluestone's EJB Container through the Universal Business Server. You should see a slight latency when the application is first started, but as the EJB objects and VoiceXML dialogs are cached, this delay will become unnoticeable. By integrating voice and middleware, we take advantage of the strengths of both. As mentioned at the beginning of this article, "Airline Directory Listings" was a simple demonstration.

Further resources can be found at the following sites:

VoiceXML and voice related sites:

http://www.voicexml.org/
http://www.w3c.org/voice/

EJB:

http://javasoft.com/
Enterprise JavaBeans: Richard Monson-Haefel, O'Reilly press
Mastering Enterprise JavaBeans and the Java2 Platform, Enterprise Edition, Ed Roman, John Wiley & Sons, Inc.

Telephony:

Telecommunications: A Software Professional's Guide, Clive Tomlinson, Addison Wesley.

Footnote 4: Voxeo.com supports a rich developer community complete with a freely downloadable designer tool. Developers should see http://community.voxeo.com/ (back to text)

Footnote 5: Voxeo utilizes Nuance's ASR which has this requirement. Other ASR engines may require different formats. (back to text)

back to the top

 

Copyright © 2001 VoiceXML Forum. All rights reserved.
The VoiceXML Forum is a program of the
IEEE Industry Standards and Technology Organization (IEEE-ISTO).