Skip to main content
You can use the Gather XML element to collect user input through automatic speech recognition or DTMF “digit press” inputs. When collecting speech as input, Vobiz transcribes and relays a user’s speech to the specified action URL in real time. When collecting input through digit press, Vobiz relays the digits entered to the specified action URL. The Gather XML element supports simultaneous detection of both speech and digit press inputs.

Nesting elements

You can nest Speak XML (text-to-speech) and Play XML elements inside Gather XML to prompt users for inputs. This is useful for building interactive voice response (IVR) experiences.

Attributes

Parameters sent to the action URL

In addition to the standard action URL request parameters, these parameters are sent to the action URL specified.

Parameters sent to the interimSpeechResultsCallback URL

In addition to the standard callback URL request parameters, these parameters are sent to the interim speech results callback URL.

Examples

Collect a single DTMF digit (IVR menu)

Nest a Speak or Play element to prompt the caller. With numDigits="1", Vobiz posts to the action URL as soon as one digit is pressed.

Collect a multi-digit number with finishOnKey

For variable-length input such as an account number, set finishOnKey="#" and let the caller signal completion.

Collect speech input

Accept either speech or digits

With inputType="dtmf speech", whichever input Vobiz detects first is the one relayed to the action URL.

Webhook payload sent to the action URL

After the caller responds (or input ends), Vobiz POSTs the standard call parameters plus the Gather-specific parameters to your action URL.
DTMF input
Speech input

Edge cases and tips

  • No input / timeout. If the caller provides no input within executionTimeout seconds (counted after nested Play/Speak finishes), Vobiz moves on to the next element in the document. Always place fallback XML (a retry, a Redirect back to the menu, or a Hangup) after the Gather. By default, Vobiz still POSTs to the action URL with empty Digits and Speech on timeout - check for empty values in your handler.
  • Use executionTimeout, never timeout. Gather has no timeout attribute. Use Dial timeout to limit how long Vobiz waits for a B-leg to answer. The valid range for executionTimeout is 5-60 seconds (default 15).
  • finishOnKey is excluded from Digits. The terminating key (default #) is not included in the Digits parameter. Set finishOnKey="" or finishOnKey="none" to rely solely on numDigits or the timeout.
  • numDigits ends collection early. Vobiz posts as soon as it collects numDigits digits, before the timeout or finishOnKey. For single-key menus, set numDigits="1" for the snappiest response.
  • DTMF vs speech. Use dtmf for menus and structured input (account numbers, PINs) - it is precise and free. Use speech for open-ended intent capture; it incurs a per-request charge (see Pricing for speech recognition) and returns a SpeechConfidenceScore you should threshold before acting. Combine with dtmf speech when you want to accept both.
  • Improve recognition. Pass domain words via hints, set the correct language (see supported languages), and pick a speechModel suited to the input (command_and_search for short commands, phone_call/telephony for call audio).
  • Validate input server-side. Never trust Digits or Speech directly in queries or business logic - sanitize and range-check them in your handler.