ADL User's Guide |
See Also
When a caller enters touchtone digits, the digits they type are stored in a digit buffer on the hardware. Each CT ADE Media Resource also has its own digit buffer. The MediaWaitDigits function moves these digits from the hardware digit buffer to the Resource Manager digit buffer, where your program can read them with the MediaGetDigitBuffer function.
1. Optional: Clear the digit buffer with the MediaClearDigitBuffer function. See Digit Buffers for a discussion on when you'd want to clear the digit buffer.
2. Optional: Play a prompt that asks the caller to enter digits.
3. Wait for the caller's digits with the MediaWaitDigits function.
a. Set the DigitCount parameter to the maximum
number of digits you expect from the caller. If you're using stop tones,
don't forget to include the stop tone in your count.
b. Optional: Determine the amount of time to wait for a response before the method times out. Set the MaxSeconds parameter to the total time to wait and the InterDigitDelay parameter to the longest to wait between digits. If you do not specify a MaxSeconds value, ADL will wait for 3 seconds per digit. The default InterDigitDelay is 3 seconds.
c. If you want to let the caller press a digit to indicate that they're finished, set the StopTones parameter to this digit (often the pound key).
When the caller enters the maximum number of digits or a stop tone, or when one of the timeouts is reached, the MediaWaitDigits function returns.
4. Retrieve the digits with the MediaGetDigitBuffer function.
If, for example, you wanted to wait for a caller to enter a 5-digit PIN, you could use
MediaWaitDigits(5);
Digits = MediaGetDigitBuffer();
If, however, you were waiting for a phone number in the US, a caller might enter anywhere between seven and eleven digits. To save time, you could prompt the caller to enter their phone number, followed by the pound sign (#) and use
MediaWaitDigits(12, 36, 5, "#");
Digits = MediaGetDigitBuffer();