To create a new voice application, you need to build a Portal Server 7.1 custom provider, or extend an existing provider. For details on creating a custom provider, see the information on leaf providers in the Portal Server 7.1 Sun Java System Portal Server Mobile Access 7.1 Developer's Guide.
Most interactive voice applications use dynamically-generated content. For example, a weather application might report the weather for a particular region when you speak the name of a city or postal code. The dynamic content (the weather in this case) is retrieved from a weather service at runtime. For this reason, voice application dialogs are typically generated dynamically using techniques such as JavaServerTM Pages (JSPTM) technology.
Providers could generate the VoiceXML dialogs programmatically, but the simplest approach is to build template files that contain the static dialog code, and use tags that are interpreted at runtime to retrieve the dynamic content.
The following steps describe how to build a provider that implements a voice-enabled weather application:
Develop a dialog design.
Most voice applications consist of a set of dialogs. Each dialog is responsible for one part of user interaction.
You can use a flow chart to represent the design of your voice application. The flow chart should include phrases spoken by users, shown as transitions between the dialogs. Or, you can develop a script where the conversational flow between the voice application and users is listed in chronological order.
Either way, you must handle cases where users say something that was not understood, or the voice application did not receive any input.
Build a prototype of your voice application in VoiceXML.
For dynamic content, begin by simply including static text as a placeholder content. For example, in a weather application, you might always speak the same report using a <prompt> statement:
<prompt> Here’s the weather forecast for Santa Clara, California.Today will be mostly sunny, with a high of 75 and a low of 68 degrees Fahrenheit. </prompt> |
The static content will be replaced with dynamic content once the prototype is complete.
Test your application, exploring all possible dialog interactions.
Integrate the application with the Portal Server 7.1 software.
Adding a voice application to the Portal Server 7.1 software involves building a custom provider. The simplest approach is to use template files like the NotesProvider described in the previous section. The template approach allows you to take the VoiceXML dialogs from the prototype and use them directly with your provider.
Identify static placeholder text in your VoiceXML prototype.
Review your VoiceXML prototype and identify the places where you use static content as placeholders for dynamic content. In each case, you must build a custom tag that can generate the appropriate dynamic content at runtime. For example, the weather report might be implemented using a custom weather tag.
Build a custom provider using templates.
See information on leaf providers in the Sun Java System Portal Server Mobile Access 7.1 Developer's Guide for details on building a custom provider that uses templates. Follow the instructions for creating a new custom provider. Implement support for the custom tags required for dynamic content in the voice application.
Edit the VoiceXML files.
While building the custom provider, you must make some changes to the VoiceXML files:
Replace the static content with tags. For example, the static weather report in Building a Voice Application would be replaced with the following, assuming you have implemented support for a weather tag in your provider:
<prompt> [tag:weather] </prompt> |
Change the file extensions of the VoiceXML files from .vxml to .template. You must modify references to other dialogs in the VoiceXML code.
Move all files to the appropriate directories.
The files comprising your voice application must reside in specific directories. For a discussion of these directories, see File System Directories for Dialogs, Grammars, and Prompts.
Complete the installation of the new provider.
The basic steps are as follows. For detailed instructions, see information on implementing a custom provider in the Sun Java System Portal Server Mobile Access 7.1 Developer's Guide.
Compile and install the provider class file in the correct location.
Install any resource bundle files.
Create an XML channel entry for the provider and update the Display Profile.
Add the channel to the VoiceJSPDesktopContainer.
Add the channel to the Available and Visible list so that users can select the channel.
Test the new provider.
Create user accounts with a numeric user name and a numeric PIN, then call into the Portal Server 7.1 software and enter that information when required.
At the main menu, speak the add a channel command to add the new channel from the list of available channels:
User:
Add a channel.
System:
Sure;
Here’s the list of channels you can add:
E-Mail, Calendar, Weather
That’s it.
Tell me which one you want to add, or say cancel.
User:
Weather
System:
All right;
Weather has been added.
Would you like to go there?
User:
Yes
System:
OK, Weather.
When you’re done, say main menu.
Here’s the weather forecast for Santa Clara, California:
Today will be mostly sunny, with a high of 75 and a low of 68 degrees Fahrenheit.
OK, we’re back at the portal main menu. What’s next?