Getting Variable Values from TouchTones
Variables may also be set from information entered by the caller on the touch-tone keypad. This information is retrieved using the $get_var command. This command works in conjunction with the $validate, $confirm_desc and other commands to allow you to:
•specify the minimum number of digits to be entered (which can be 0)
•specify the maximum number of digits to be entered (after which the entry is terminated), or a larger number than needed (which then requires either # or a pause specified by $repeat_msg to terminate entry)
•allow * and/or # to be treated as data values instead of the default functions of restart and terminate entry respectively.
•speak back the entry for the caller to confirm.
•detect fax tones when DTMF entry is requested
•query a dBase index for the entry, specified using $infobox.
•validate the entry against the $phone_mask specifications
•translate the entry to alpha characters
•validate the entry as a credit card and expiration date (format check only)
•to wait a specified time for sound to be detected on the line.
•specify automatic transformation of the entered number using $infobox.
It is important to note that listening for DTMF keys does not start until the module containing the $get_var command has been fully processed, so the results are not available until you have branched to a different module. You should never perform any testing of or any reference to the variable assigned using $get_var until you reach the next module, and CopiaFacts will display a warning in the trace if you attempt to do this. Once set, a variable retains its value across all subsequent modules and may be referenced or modified in any of them until the end of the call.
The $get_var command can only be placed in a module of $type question. This module type is used to ask the caller a question and to get back a response. The question is a recorded sound file that is identified by the $image_desc command. Most scripts use the command:
where s is an abbreviation for the keyword standard (which can also be spelled out instead). This form of the command tells the script to look for a sound file that has the same base name as the module file name but with a file extension of .VOX or .WAV instead of .IIF. Wave files should only be used if your fax/voice board supports the .WAV format. When you use the $image_desc command, you should always include one or more $script commands to document what the message in the sound file actually says. These commands are optional, but they will help you keep track of what you are asking the caller.