The following sections describe the implementation of simple Voice Response applications in V.
There are a few Ski Resorts in the Seattle area. Some of the more famous ski resorts are Crystal Mountain, White Pass, and Stevens. Let us develop a simple voice response application that prompts the caller for a choice of available reports and depending on the caller's input provides the snow report for the selected ski resort. Let this Voice Response Application be called "snow". Let the directory under which all voice messages related to this application reside be called "c:/snow". Let the voice message that prompts the caller for a selection be called "choose.vox". Let the voice message that thanks the caller be called "thankyou.vox". Let the voice message that contains the snow report for Crystal resort be called "crystal.vox". Let the voice message that contains the snow report for Stevens resort be called "stevens.vox". Let the voice message that contains the snow report for White resort be called "white.vox".
If the caller does not enter a touch-tone key or if an unexpected touch-tone key is detected, reports for all three resorts will be played.
Figure (2) is a V program that implements the above mentioned voice response application.
/*
* File Name: snow.v
* Snow Report Application.
* The user is prompted for a number of Ski resorts,
* Once a selection is made the snow condition for
* that resort is reported.
*
*/
#define SNOW_APP "snow" /* Pre-Processor Commands */
#define SNOW_DIR "/snow"
appdef SNOW_APP
basedir SNOW_DIR
answer
play1 "choose.vox"
key "1"
play0 "white.vox"
break
key "2"
play0 "stevens.vox"
break
key "3"
play0 "crystal.vox"
break
nokey
otherkey
/* nokey and otherkey do the same thing */
play0 "white.vox"
play0 "stevens.vox"
play0 "crystal.vox"
break
endplay
play0 "thankyou.vox"
hangup
Once an application has been defined, it can be assigned to one or more Phone-Port. This can be done in a file other than the one that contains the definition of the application. Several applications can independently be executed within the system. Let the name of the file that contains the definition of snow application be "snow.v". Figure (3) presents a file that inculdes "snow.v" and then assigns the snow application to Phone-Ports one and four.
/* * File Name: config.v * * Include the applications of interest and * assign them to telephone ports. */ #include "snow.v" assign 1 SNOW_APP assign 4 SNOW_APP