<GetDigits> element collects digits that a caller enters into their phone keypad. When the caller is done entering data, Plivo submits that data to the provided ‘action’ URL in an HTTP GET or POST request.
If no input is received before timeout,
<GetDigits> falls through to the next element.
You may optionally nest
<Wait>elements within a
<GetDigits> element while waiting for input. This allows you to read menu options to the caller while letting them enter a menu selection at any time. After the first digit is received the audio will stop playing.
<GetDigits> element supports the following attributes that modify its behavior:
|Attribute Name||Allowed Values||Default Value|
||positive integer||5 seconds|
||any digit, #, *||#|
||integer >= 1||99|
||integer >= 1||1|
||Any local .mp3 file||none|
Plivo will pass the following parameters to the ‘action’ URL once the input has been captured:
||The digits the caller pressed, excluding the finishOnKey digit if used.|
Example 1: Action/method and nested
After the caller enters digits on the keypad, Plivo sends them in a request to the ‘action’ URL. We also add a nested
<Speak> element. This means that input can be gathered at any time during
1 2 3 4 5 6 7 8 9 10
<?xml version="1.0" encoding="UTF-8"?> <Response> <GetDigits action="http://www.foo.com/process_gather.php" method="GET"> <Speak> Please enter your 6-digit account number, followed by the hash key </Speak> </GetDigits> <Speak>Input not received. Bye bye!</Speak> </Response>
- If the caller enters a digit during the speaking of the text, the
<Speak>element will stop speaking and wait for digits, ‘#’ sign, or a timeout.
<GetDigits>tag times out without input, the
<Speak>element will complete and the
<GetDigits>element will exit without submitting. Plivo will then process the next element in the document, which in this case is a
<Speak>element which informs the caller that no input was received.
- If the caller enters 123456 and then hits # or allows five seconds to pass, Plivo will submit the digits as a GET request to http://ww.foo.com/process_gather.php?Digits=123456.