Skip to main content

Gather

The Gather verb is used to collect digits for some period of time.

Text Content

There is no text content available to be set for the <Gather> verb.

Attributes

AttributeDescription
gatherUrl(optional) URL to send Gather event to and request new BXML. May be a relative URL.
gatherMethod(optional) The HTTP method to use for the request to gatherUrl. GET or POST. Default value is POST.
gatherFallbackUrl(optional) A fallback url which, if provided, will be used to retry the Gather event callback delivery in case gatherUrl fails to respond.
gatherFallbackMethod(optional) The HTTP method to use to deliver the Gather event callback to gatherFallbackUrl. GET or POST. Default value is POST.
username(optional) The username to send in the HTTP request to gatherUrl.
password(optional) The password to send in the HTTP request to gatherUrl.
fallbackUsername(optional) The username to send in the HTTP request to gatherFallbackUrl.
fallbackPassword(optional) The password to send in the HTTP request to gatherFallbackUrl.
tag(optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared.

May be cleared by setting tag=""

Max length 256 characters.
terminatingDigits(optional) When any of these digits are pressed, it will terminate the Gather. Default value is "", which disables this feature.
maxDigits(optional) Max number of digits to collect. Default value is 50. Range: decimal values between 1 - 50.
interDigitTimeout(optional) Time (in seconds) allowed between digit presses before automatically terminating the Gather. Default value is 5. Range: decimal values between 1 - 60.
firstDigitTimeout(optional) Time (in seconds) to pause after any audio from nested <SpeakSentence> or <PlayAudio> verb is played (in seconds) before terminating the Gather. Default value is 5. Range: decimal values between 0 - 60.
repeatCount(optional) The number of times the audio prompt should be played if no digits are pressed. For example, if this value is 3, the nested audio clip will be played a maximum of three times. The delay between repetitions will be equal to firstDigitTimeout. Default value is 1. repeatCount * number of verbs must not be greater than 20.
input(optional) Specifies the input mode for the Gather verb. Accepted values are dtmf, speech, or dtmf_speech. Default value is dtmf.
hints(optional) Possible and effective only if input value is speech or dtmf_speech. Words or phrases that help improve speech recognition. Useful for phrases with many words. Supported class tokens or keywords vary according to your provider and version. Default: None.
language(optional) Possible and effective only if input value is speech or dtmf_speech. Language code for speech recognition. Supported languages depend on your chosen Supported Languages:

- af-ZA: Afrikaans (South Africa)

- am-ET: Amharic (Ethiopia)

- ar-AE: Arabic (United Arab Emirates)

- ar-BH: Arabic (Bahrain)

- ar-DZ: Arabic (Algeria)

- ar-EG: Arabic (Egypt)

- ar-IL: Arabic (Israel)

- ar-IQ: Arabic (Iraq)

- ar-JO: Arabic (Jordan)

- ar-KW: Arabic (Kuwait)

- ar-LB: Arabic (Lebanon)

- ar-MA: Arabic (Morocco)

- ar-MR: Arabic (Mauritania)

- ar-OM: Arabic (Oman)

- ar-PS: Arabic (State of Palestine)

- ar-QA: Arabic (Qatar)

- ar-SA: Arabic (Saudi Arabia)

- ar-TN: Arabic (Tunisia)

- ar-YE: Arabic (Yemen)

- as-IN: Assamese (India)

- ast-ES: Asturian (Spain)

- az-AZ: Azerbaijani (Azerbaijan)

- az-AZ: Azerbaijani (Azerbaijani)

- be-BY: Belarusian (Belarus)

- bg-BG: Bulgarian (Bulgaria)

- bn-BD: Bengali (Bangladesh)

- bn-IN: Bengali (India)

- bs-BA: Bosnian (Bosnia and Herzegovina)

- bs-BA: Bosnian (Bosnia and Herzgovina)

- ca-ES: Catalan (Spain)

- ceb-PH: Cebuano (Philippines)

- ckb-IQ: Central Kurdish (Iraq)

- cmn-Hans-CN: Chinese, Mandarin (Simplified, China)

- cmn-Hans-CN: Chinese (Simplified, China)

- cmn-Hans-HK: Chinese, Mandarin (Simplified, Hong Kong)

- cmn-Hant-TW: Chinese, Mandarin (Traditional, Taiwan)

- cs-CZ: Czech (Czech Republic)

- cy-GB: Welsh (United Kingdom)

- da-DK: Danish (Denmark)

- de-AT: German (Austria)

- de-CH: German (Switzerland)

- de-CH: German (Switzerland) - Note: supported only in Gather 2.0

- de-DE: German (Germany)

- el-GR: Greek (Greece)

- en-AU: English (Australia)

- en-CA: English (Canada)

- en-GB: English (United Kingdom)

- en-GH: English (Ghana)

- en-HK: English (Hong Kong)

- en-IE: English (Ireland)

- en-IN: English (India)

- en-KE: English (Kenya)

- en-NG: English (Nigeria)

- en-NZ: English (New Zealand)

- en-PH: English (Philippines)

- en-PK: English (Pakistan)

- en-SG: English (Singapore)

- en-TZ: English (Tanzania)

- en-US: English (United States)

- en-ZA: English (South Africa)

- es-419: Spanish (Latin American)

- es-AR: Spanish (Argentina)

- es-BO: Spanish (Bolivia)

- es-CL: Spanish (Chile)

- es-CO: Spanish (Colombia)

- es-CR: Spanish (Costa Rica)

- es-DO: Spanish (Dominican Republic)

- es-EC: Spanish (Ecuador)

- es-ES: Spanish (Spain)

- es-GT: Spanish (Guatemala)

- es-HN: Spanish (Honduras)

- es-MX: Spanish (Mexico)

- es-NI: Spanish (Nicaragua)

- es-PA: Spanish (Panama)

- es-PE: Spanish (Peru)

- es-PR: Spanish (Puerto Rico)

- es-PY: Spanish (Paraguay)

- es-SV: Spanish (El Salvador)

- es-US: Spanish (United States)

- es-UY: Spanish (Uruguay)

- es-VE: Spanish (Venezuela)

- et-EE: Estonian (Estonia)

- eu-ES: Basque (Spain)

- fa-IR: Persian (Iran)

- ff-SN: Fulah (Senegal)

- fi-FI: Finnish (Finland)

- fil-PH: Filipino (Philippines)

- fr-BE: French (Belgium)

- fr-CA: French (Canada)

- fr-CH: French (Switzerland)

- fr-FR: French (France)

- ga-IE: Irish (Ireland)

- gl-ES: Galician (Spain)

- gu-IN: Gujarati (India)

- ha-NG: Hausa (Nigeria)

- hi-IN: Hindi (India)

- hr-HR: Croatian (Croatia)

- hu-HU: Hungarian (Hungary)

- hy-AM: Armenian (Armenia)

- id-ID: Indonesian (Indonesia)

- ig-NG: Igbo (Nigeria)

- is-IS: Icelandic (Iceland)

- it-CH: Italian (Switzerland)

- it-IT: Italian (Italy)

- iw-IL: Hebrew (Israel) - Note: not supported in Google's v2 STT global APIs

- iw-IL: Hebrew (Israel)

- ja-JP: Japanese (Japan)

- jv-ID: Javanese (Indonesia)

- ka-GE: Georgian (Georgia)

- kam-KE: Kamba (Kenya)

- kea-CV: Kabuverdianu (Cape Verde)

- kk-KZ: Kazakh (Kazakhistan)

- kk-KZ: Kazakh (Kazakhstan)

- km-KH: Khmer (Cambodia)

- km-KH: Khmer (Cambodian)

- kn-IN: Kannada (India)

- ko-KR: Korean (South Korea)

- ky-KG: Kyrgyz (Cyrillic)

- lb-LU: Luxembourgish (Luxembourg)

- lg-UG: Ganda (Uganda)

- ln-CD: Lingala (Congo-Kinshasa)

- lo-LA: Lao (Laos)

- lt-LT: Lithuanian (Lithuania)

- luo-KE: Luo (Kenya)

- lv-LV: Latvian (Latvia)

- mi-NZ: Maori (New Zealand)

- mk-MK: Macedonian (North Macedonia)

- ml-IN: Malayalam (India)

- mn-MN: Mongolian (Mongolia)

- mr-IN: Marathi (India)

- ms-MY: Malay (Malaysia)

- mt-MT: Maltese (Malta)

- my-MM: Burmese (Myanmar)

- nb-NO: Norwegian Bokmål (Norway)

- ne-NP: Nepali (Nepal)

- nl-BE: Dutch (Belgium)

- nl-NL: Dutch (Netherlands)

- no-NO: Norwegian Bokmål (Norway)

- nso-ZA: Sepedi (South Africa)

- ny-MW: Nyanja (Malawi)

- oc-FR: Occitan (France)

- om-ET: Oromo (Ethiopia)

- or-IN: Oriya (India)

- pa-Guru-IN: Punjabi (Gurmukhi India)

- pa-guru-IN: Punjabi (Gurmukhi India)

- pl-PL: Polish (Poland)

- ps-AF: Pashto

- pt-BR: Portuguese (Brazil)

- pt-PT: Portuguese (Portugal)

- ro-RO: Romanian (Romania)

- ru-RU: Russian (Russia)

- rup-BG: Aromanian (Bulgaria)

- rw-RW: Kinyarwanda (Rwanda)

- sd-IN: Sindhi (India)

- si-LK: Sinhala (Sri Lanka)

- sk-SK: Slovak (Slovakia)

- sl-SI: Slovenian (Slovenia)

- sn-ZW: Shona (Zimbabwe)

- so-SO: Somali

- sq-AL: Albanian (Albania)

- sr-RS: Serbian (Serbia)

- ss-Latn-ZA: Swati (Latin, South Africa)

- st-ZA: Southern Sotho (South Africa)

- su-ID: Sundanese (Indonesia)

- sv-SE: Swedish (Sweden)

- sw: Swahili

- sw-KE: Swahili (Kenya)

- sw-TZ: Swahili (Tanzania)

- ta-IN: Tamil (India)

- ta-LK: Tamil (Sri Lanka)

- ta-MY: Tamil (Malaysia)

- ta-SG: Tamil (Singapore)

- te-IN: Telugu (India)

- tg-TJ: Tajik (Tajikistan)

- th-TH: Thai (Thailand)

- tn-Latn-ZA: Tswana (Latin, South Africa)

- tr-TR: Turkish (Turkey)

- ts-ZA: Tsonga (South Africa)

- uk-UA: Ukrainian (Ukraine)

- umb-AO: Umbundu (Angola)

- ur-IN: Urdu (India)

- ur-PK: Urdu (Pakistan)

- uz-UZ: Uzbek (Uzbekistan)

- ve-ZA: Venda (South Africa)

- vi-VN: Vietnamese (Vietnam)

- wo-SN: Wolof (Senegal)

- xh-ZA: Xhosa (South Africa)

- yo-NG: Yoruba (Nigeria)

- yue-Hant-HK: Chinese, Cantonese (Traditional, Hong Kong)

- yue-Hant-HK: Chinese, Cantonese (Traditional Hong Kong)

- zu-ZA: Zulu (South Africa)
partialResultCallback(optional) Possible and effective only if input value is speech or dtmf_speech. URL to send Partial Result event to. May be a relative URL.
partialResultCallbackMethod(optional) Possible and effective only if input value is speech or dtmf_speech. The HTTP method to use for the request to partialResultCallback. GET or POST. Default value is POST.
profanityFilter(optional) Possible and effective only if input value is speech or dtmf_speech. Enables or disables filtering of profane words. Accepted values: true, false. Default value is true.
speechModel(optional) Possible and effective only if input value is speech or dtmf_speech. Specifies the speech recognition model to use. Options include:
Generic: default, numbers_and_commands, phone_call, experimental_conversations, experimental_utterances
Google STT V2: googlev2_long, googlev2_short, googlev2_telephony, googlev2_telephony_short
speechTimeout(optional) Possible and effective only if input value is speech or dtmf_speech. Time (in seconds) to wait for speech input before timing out. Accepted values: any positive integer. Default value is 5.

The gather is terminated when one of these conditions is met:

  • The user presses a terminating digit (if specified)
  • The user has pressed at least one key and more than interDigitTimeout seconds have elapsed
  • Any nested audio has ended and firstDigitTimeout seconds have elapsed without the user pressing any digits
  • The user presses maxDigits digits
  • The final transcription result is received if input is set to speech or dtmf_speech

If the gatherUrl attribute is specified, the Gather event is sent to the gatherUrl upon completion of the gather. BXML returned by that callback are then executed. If gatherUrl is specified, verbs following the <Gather> will be ignored.

If no gatherUrl attribute is specified, the gathered digits/text are discarded and execution of verbs following the <Gather> continues.

Nestable Verbs

The following verbs may be nested inside of a <Gather> tag. If using a repeat count of one, up to 20 verbs can be nested. Refer to repeatCount attribute if using a value greater than 1.

VerbDescription
SpeakSentence(optional/) Using the SpeakSentence inside the Gather verb will speak the text until a digit is received.
PlayAudio(optional/) Using the PlayAudio inside the Gather verb will play the media until a digit is received.

Webhooks Received

CallbackCan reply with more BXML
GatherYes

Examples

Simple gather

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather gatherUrl="https://gather.url/nextBXML" firstDigitTimeout="10" terminatingDigits="#">
<SpeakSentence voice="kate">Please press a digit.</SpeakSentence>
</Gather>
</Response>

Gather with Repeated Audio Prompt

<Response>
<Gather gatherUrl="https://gather.url/nextBXML" repeatCount="5" maxDigits="1">
<SpeakSentence>I am going to keep asking you to press a digit.</SpeakSentence>
</Gather>
</Response>

Gather with Multiple Nested Verbs

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather gatherUrl="https://gather.url/nextBXML">
<SpeakSentence>First Sentence.</SpeakSentence>
<PlayAudio>https://audio.url/audio1.wav</PlayAudio>
<PlayAudio>https://audio.url/audio2.mp3</PlayAudio>
<SpeakSentence>Second Sentence.</SpeakSentence>
</Gather>
</Response>