To use ASP to create a dynamic VoiceXML application, you need to change the file extension from .vxml to .asp. Doing so forces the application to use the ASP engine. Now, you can begin to add dynamic features to the application. (To review the VoiceXML code sample, click Download the Code from the Article Info box at the right.) The code demonstrates how to use ASP to add dynamic functionality to the VoiceXML code example presented in my previous Wireless & Mobile UPDATE Tips and Tricks article.
The new code shows the application's first new dynamic aspect: the ability to use the Response object to generate the Welcome menu. I used a static string to output in this example, but you can use any variable from dynamic content.
Embedded grammar is the application's second new dynamic aspect. At the top of the VoiceXML file, I dimensioned variables, created a connection to the VoiceXML database, defined a SQL statement, and established a recordset with all the English and Spanish grammar and option values, which are used to match verbal input for use of the application.
After you create the recordset, you can use it to dynamically generate the grammar definition. When you use the correct syntax and the grammar tags, you can loop through the recordset and output the grammar values. You can also see that the "hangup" option remains static, so you can use a combination of static and dynamic content for the grammar or any other VoiceXML content. The advantage? You can leave static such commonly used grammar as "back" and "help."
The real world doesn't always welcome new VoiceXML applications with open arms. At the Tellme.com studio, I created and tested this article's examples and several commercial VoiceXML applications. As the commercial applications neared completion, I tried to organize deployment with Tellme.com's voice-browser Voice ASP service. Tellme.com's representative, however, told me that my client's estimated call volume was so small that the company couldn't use the applications. Voice ASPs Voxeo and BeVocal expressed more interest. If you want to deploy VoiceXML applications on a small scale, visit Voxeo or BeVocal online.
The next Wireless & Mobile Tips and Tricks column will address wireless middleware, infrastructure that facilitates the delivery of wireless applications.