The GetDigits Element

The GetDigits element is used to collect the digits entered by a caller. Once the caller has finished entering the digits, the API submits the data to the provided action URL using a HTTP GET or POST request.

You could play a message nested inside the GetDigits element while the digits are being received in the background. This is useful for creating a phone tree (IVR).

Nesting Rules

You can nest Speak and Play elements within the GetDigits element.

Attributes

action string

The URL to which the digits are sent. See the action Request Parameters table below for more information

Allowed values - a full qualified URL

method string

Method used to send HTTP request to the action URL.

Allowed values - GET, POST. Defaults to POST.

timeout integer

Time in seconds to wait to receive the first digit. If the user fails to provide an input within the timeout period, the next element in the response is processed.

Allowed values - any positive integer. Defaults to 5.

digitTimeout integer

Time in seconds allowed between consecutive digit inputs. If input is not provided within the digitTimeout period, digits entered until then will be processed.

Allowed values - any positive integer. Defaults to 2.

finishOnKey string

This can be any number or a special character, such as, an asterisk (*) or a pound (#) that is used to complete the task of capturing digits. If finishOnKey is set to None or is not set, the default option is disabled and timeout will occur based on digitTimeout or numDigits parameters. If these parameters are not specified, timeout will occur according to the default value of the digitTimeout parameter.

Allowed values - any digit, #, *. Defaults to #.

numDigits integer

Maximum number of digits to be processed in the current operation. Only the number of numDigits is captured and any additional digits entered are ignored.

Allowed values - integer >= 1. Defaults to 99.

retries integer

Indicates the number of retries the user is allowed to input the digits, if digits are not received within the time specified by timeout.

Allowed values - integer >= 1. Defaults to 1.

redirect boolean

Redirect to action URL if true. If false, only request the URL and continue to next element.

Allowed values - true, false. Defaults to true.

playBeep boolean

Plays a beep when all Speak and Play elements finish executing.

Allowed values - true, false. Defaults to false.

validDigits string

Set of digits which the user is allowed enter.

Allowed values - any digit, #, *. Defaults to 1234567890*#

invalidDigitsSound string

URL of the sound file to be played when the user enters an invalid digit.

Allowed values - Any remote sound file URL (MP3 or WAV)

log boolean

If true, Plivo will log digits entered by the caller and you can view the same in debug logs. If false, logging will disabled while processing GetDigits Element.

Allowed values - true, false. Default is true.

Parameters sent to the action URL

The following parameters are sent to the action URL after a DTMF input has been captured.

Digits

The digits inputted by the caller, excluding the finishOnKey digit if used.