Skip to contentSkip to navigationSkip to topbar
On this page

Gather Input On Call Widget


Studio uses Widgets to represent various parts of Twilio's functionality that can then be stitched together in your Studio Flow to build out robust applications that require no coding on your part.

(information)

Info

New to Twilio Studio? Check out our Getting Started Guide!

The Gather Input on Call Widget allows you to gather a user's keypress or voice input while they are on a call. This Widget will collect DTMF keypresses or text from speech recognition(link takes you to an external page), which you can then save for your own data purposes or send along to another Widget to send your user down the right path.

Gather input on call widget.

Required configuration for Gather Input on Call

required-configuration-for-gather-input-on-call page anchor

There is no required configuration for the Gather Input on Call Widget. However, to make the best use of this Widget, we recommend configuring at least a few of the available configuration options listed in the next section.


Optional configuration for Gather Input on Call

optional-configuration-for-gather-input-on-call page anchor

The Gather Input on Call Widget accepts a number of configuration options that you can use to customize the message your Flow says to callers and the way(s) you may wish to collect data.

See the Say/Play widget for more details of these options.

NameDescriptionSupported ValuesDefault
Say or Play a Message"Say a Message" will read a message via text-to-speech. "Play a Message" will play a pre-recorded message.Select Say a Message or Play a Message from the dropdownSay a Message
Text to sayThe text to say on the call if you selected "Say a Message"Strings like "Welcome!", templates like Hello {{first_name}}, and SSML like <emphasis level="strong">Thanks for calling!</emphasis>.N/A
LanguageLanguage and regional dialect for the message being said if you selected "Say a Message"Select a supported language from the dropdown, or enter a Liquid variable for dynamic selectionen-US (U.S. English)
Message voiceThe voice that will read your message on the callSelect a supported voice from the dropdown or enter a Liquid variable for dynamic selection. Note that the dropdown will not populate until you select a languageAlice
URL of audio fileThe URL of media to play, if you selected "Play a Message"https://api.twilio.com/cowbell.mp3N/A
Number of loopsThe number of times your message will loopAny positive integer between 1 and 991
(information)

Info

Studio Say/Play and Gather widgets now support SSML.

(information)

Info

For a list of supported Amazon Polly and Neural voices and dialects that you can reference with Liquid variables when setting Message Language and Voice, see this list.

Keypress options for Gather Input on Call

keypress-options-for-gather-input-on-call page anchor

A number of additional options are available when configuring the Gather Input on Call Widget to accept DTMF keypresses as input.

NameDescriptionSupported ValuesDefault
Stop gathering after __ secondsTime in seconds that the Flow will wait for a caller to press a key0 - 30 seconds5 seconds
Stop gathering on keypress?Stop gathering digits after a user presses a specific key. If "no," the Widget will gather and submit all keypresses when the Stop Gathering After timeout is reached or the expected Number of Digits are collectedYes or NoYes
Stop gathering on keypress ___The key that triggers data submission of a user's inputDigits 0-9, #, *#
Stop gathering after number of digitsThe number of digits you are expecting from a caller. A caller's input will be submitted as soon as this number of keypresses has been reached.0-30N/A
(warning)

Warning

Note that the value set for Stop Gathering Keypress is a control key, meaning that its value is not submitted with the rest of the gathered digits. For example, if your Stop Gathering On Keypress is # and a user enters 123#, only 123 will be submitted with your data.

Speech recognition options for Gather Input on Call

speech-recognition-options-for-gather-input-on-call page anchor

Consider the following options when configuring the Gather Input on Call Widget to accept a caller's speech as input:

NameDescriptionSupported ValuesDefault
Speech recognition languageThe language Twilio's speech engine will try to recognizeSelect a supported language from the dropdown, or enter a Liquid variable for dynamic selectionen-US (U.S. English)
Speech recognition hintsA list of comma-separated values that give Twilio's speech engine specific words you expect to hear from your callerscomma-separated list of words (e.g., "sales, reservations, hours")N/A
Profanity filterRedact profanity from speech resultsTrue or FalseTrue

Advanced speech settings

advanced-speech-settings page anchor

You may choose to enable a few advanced speech settings in the Gather Input on Call Widget by expanding the Advanced speech settings box in the Widget configuration panel.

Advanced settings for Gather Input on Call widget can be toggled by clicking on the carat (^) underneath all other configuration settings.
(error)

Danger

The advanced speech settings of Gather should be used carefully, as certain combinations are incompatible with each other. Please consult the Voice <Gather> docs for full details of the options and how to use them.

NameDescriptionSupported ValuesDefault
Speech timeoutThe limit (in seconds) that Twilio will wait before it stops speech recognition.auto, or any integerauto
Speech modelWhich model the recognition engine should use to interpret speechSelect None, Default, Numbers & Commands,or Phone Call from the drop-down. Alternatively, you may enter a Liquid variable for dynamic selectionN/A
(information)

Info

When Speech timeout is set to auto, Twilio will stop speech recognition when there is a pause in speech and return the results immediately.


Gather Input on Call Transitions

gather-input-on-call-transitions page anchor

The Gather Input on Call Widget has three possible transition states that can lead to any other Widget in your Flow. For more information on working with Studio transitions, see this guide.

NameDescription
User pressed keysThe user pressed digits while on the call.
User said somethingThe user spoke a message while on the call.
No inputThe user did not perform any input while on the call.

Gather Input on Call Variables

gather-input-on-call-variables page anchor

When the Gather Input on Call Widget executes, it will have stored the following variables for use throughout your Studio Flow. When accessing these variables, make sure you replace MY_WIDGET_NAME with the name of your Widget. For more information on working with variables in Studio, see this guide.

Find definitions and examples for Gather variables such as SpeechResult, Confidence, or Digits at the TwiML Voice: <Gather> page.

Find definitions and examples for Call variables at the Call Resource page.

NameLiquid Template Language
Account SID{{widgets.MY_WIDGET_NAME.AccountSid}}
API Version{{widgets.MY_WIDGET_NAME.ApiVersion}}
Called{{widgets.MY_WIDGET_NAME.Called}}
Caller{{widgets.MY_WIDGET_NAME.Caller}}
Call Status{{widgets.MY_WIDGET_NAME.CallStatus}}
Caller City{{widgets.MY_WIDGET_NAME.CallerCity}}
Caller Country{{widgets.MY_WIDGET_NAME.CallerCountry}}
Caller State{{widgets.MY_WIDGET_NAME.CallerState}}
Caller ZIP{{widgets.MY_WIDGET_NAME.CallerZip}}
Call SID{{widgets.MY_WIDGET_NAME.CallSid}}
Called City{{widgets.MY_WIDGET_NAME.CalledCity}}
Called Country{{widgets.MY_WIDGET_NAME.CalledCountry}}
Called State{{widgets.MY_WIDGET_NAME.CalledState}}
Called ZIP{{widgets.MY_WIDGET_NAME.CalledZip}}
Confidence{{widgets.MY_WIDGET_NAME.Confidence}}
Digits{{widgets.MY_WIDGET_NAME.Digits}}
Direction{{widgets.MY_WIDGET_NAME.Direction}}
From{{widgets.MY_WIDGET_NAME.From}}
From City{{widgets.MY_WIDGET_NAME.FromCity}}
From Country{{widgets.MY_WIDGET_NAME.FromCountry}}
From State{{widgets.MY_WIDGET_NAME.FromState}}
From ZIP{{widgets.MY_WIDGET_NAME.FromZip}}
Speech Result{{widgets.MY_WIDGET_NAME.SpeechResult}}
To{{widgets.MY_WIDGET_NAME.To}}
To City{{widgets.MY_WIDGET_NAME.ToCity}}
To Country{{widgets.MY_WIDGET_NAME.ToCountry}}
To State{{widgets.MY_WIDGET_NAME.ToState}}
To ZIP{{widgets.MY_WIDGET_NAME.ToZip}}
(information)

Info

Find more details about Confidence and Speech Result at the TwiML Voice: <Gather> page.


Example: routing calls with Gather Input on Call

example-routing-calls-with-gather-input-on-call page anchor

There are many real-world applications for using the Gather Input on Call Widget. One common example is creating an IVR, or Interactive Voice Response to help route callers to the correct number or extension.

A full example Flow for using the Gather Input on Call widget. When a call comes in, we trigger a Gather Input on Call Widget that asks users to press 1 or say 'sales' for sales, press 2 or say 'support' for support. Based on the outcome of the user&#x27;s action, we will route to a Split Based On... Widget, one for keypress and one for voice input.

Here we can see a Studio Flow that takes an incoming call and asks the caller to press a number or say a keyword to reach either a Sales or Support department. When the caller says "sales" or presses 1, the Widget will transition to a Split Based On… Widget, passing along the number pressed or keyword spoken so that we can then route the call accordingly.


Want to go more in-depth with Gather Input on Call? Follow along with one of these step-by-step tutorials that show how to create real-world applications that leverage this Widget

We can't wait to see what you build!

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.