Skip to main content
This page covers the XML elements for collecting user input: DTMF digit presses and automatic speech recognition.

GetDigits

The <GetDigits> element collects DTMF (touch-tone) digits entered by the caller. Use it for IVR menus, PIN entry, and numeric input.
Recommendation: Use GetInput instead of GetDigits for new applications. GetInput supports both speech and digit input.

Basic Usage

GetDigits Attributes

AttributeTypeDefaultDescription
actionURL-URL to receive the digits
methodstringPOSTHTTP method (GET, POST)
numDigitsinteger99Maximum digits to collect
timeoutinteger5Seconds to wait for first digit
digitTimeoutinteger2Seconds between consecutive digits
finishOnKeystring#Key to submit input (digit, #, *, none)
retriesinteger1Retry attempts if no input
redirectbooleantrueRedirect to action URL
playBeepbooleanfalsePlay beep after nested elements
validDigitsstring1234567890*#Allowed digits
invalidDigitsSoundURL-Audio for invalid digit
logbooleantrueLog digits (disable for sensitive input)

Nested Elements

<GetDigits> can contain:
  • <Speak> - Text-to-speech prompt
  • <Play> - Audio file prompt
Prompts play while waiting for input. Input collection starts as soon as the first digit is pressed.

Phone Tree (IVR)

Handle the input on your server:

PIN Entry

Collect a specific number of digits:
Note: Set log="false" for sensitive input like PINs.

Variable Length Input

Use finishOnKey for variable-length input:

Restrict Valid Digits

Only accept specific digits:

No Redirect

Collect digits without redirecting (fire and forget):

GetDigits Action URL Parameters

When digits are collected, these parameters are sent:
ParameterDescription
DigitsThe digits entered (excluding finishOnKey)
Plus all standard request parameters.

GetDigits Flow Behavior

  1. Nested <Speak> or <Play> elements execute
  2. If playBeep="true", a beep plays
  3. Digit collection starts
  4. Collection ends when:
    • numDigits reached
    • finishOnKey pressed
    • timeout or digitTimeout expires
  5. Digits sent to action URL
  6. Response XML from action URL executes
If no digits are received after retries attempts, execution continues to the next element.

GetInput

The <GetInput> element collects user input through automatic speech recognition (ASR) or DTMF digit presses. It’s the recommended replacement for <GetDigits>, supporting both speech and digit input.

Basic Usage

GetInput Attributes

Core Settings

AttributeTypeDefaultDescription
actionURLrequiredURL to receive the input
methodstringPOSTHTTP method (GET, POST)
inputTypestring-Input type: dtmf, speech, dtmf speech
redirectbooleantrueRedirect to action URL after input
logbooleantrueLog input (disable for sensitive data)

Timing

AttributeTypeDefaultDescription
executionTimeoutinteger15Max seconds to wait for input (5-60)
digitEndTimeoutstringautoSeconds between digits (2-10, or auto)
speechEndTimeoutstringautoSeconds of silence to end speech (2-10, or auto)
startInputTimeoutinteger-Seconds to wait for the caller to begin providing input. Distinct from executionTimeout (total time), digitEndTimeout (between digits), and speechEndTimeout (end of speech)
retriesinteger1Number of times to retry input collection if no valid input is received

DTMF Settings

AttributeTypeDefaultDescription
numDigitsinteger32Maximum digits to collect (1-32)
finishOnKeystring#Key to submit input (digit, #, *, none)

Speech Settings

AttributeTypeDefaultDescription
languagestringen-USSpeech recognition language
speechModelstringdefaultASR model: default, command_and_search, phone_call
hintsstring-Comma-separated phrases to boost recognition
profanityFilterbooleanfalseFilter profane words

Callbacks

AttributeTypeDefaultDescription
interimSpeechResultsCallbackURL-URL for real-time speech results
interimSpeechResultsCallbackMethodstringPOSTHTTP method for interim callback

Input Types

DTMF Only

Collect only digit presses:

Speech Only

Collect only speech input:

Both Speech and DTMF

Accept either input type (first detected wins):

Speech Recognition Models

ModelBest For
defaultGeneral long-form audio
command_and_searchShort commands and voice search
phone_callPhone call audio (varied quality)

Improve Speech Recognition

Use hints to boost recognition of specific words:
Limits:
  • Max 500 phrases per request
  • Max 10,000 characters total
  • Max 100 characters per phrase

Real-Time Speech Results

Get interim transcription results as the user speaks:

Interim Callback Parameters

ParameterDescription
StableSpeechConfident transcription so far
UnstableSpeechCurrent guess (may change)
StabilityConfidence score (0.0-1.0)
SequenceNumberOrder of callbacks

Supported Languages

Common languages include:
LanguageCode
English (US)en-US
English (UK)en-GB
English (Australia)en-AU
Spanish (US)es-US
Spanish (Spain)es-ES
Frenchfr-FR
Germande-DE
Italianit-IT
Portuguese (Brazil)pt-BR
Japaneseja-JP
Chinese (Mandarin)zh-CN

GetInput Action URL Parameters

When input is collected:
ParameterDescription
InputTypedtmf or speech
DigitsDigits entered (empty if speech)
SpeechTranscribed text (empty if DTMF)
SpeechConfidenceScoreConfidence (0.0-1.0)
BilledAmountTranscription cost
Plus all standard request parameters.

Handling Input on Your Server

GetInput Nested Elements

<GetInput> can contain:
  • <Speak> - Voice prompt
  • <Play> - Audio prompt

Speech Recognition Pricing

Speech recognition is billed per 15-second increment.