mirror of
https://github.com/jambonz/next-static-site.git
synced 2026-10-13 06:54:20 +00:00
2.8 KiB
2.8 KiB
gather
The gather command is used to collect dtmf or speech input.
{
"verb": "gather",
"actionHook": "http://example.com/collect",
"input": ["digits", "speech"],
"finishOnKey": "#",
"numDigits": 5,
"timeout": 8,
"recognizer": {
"vendor": "Google",
"language": "en-US"
},
"say": {
"text": "To speak to Sales press 1. To speak to customer support press 2.",
"synthesizer": {
"vendor": "Google",
"language": "en-US"
}
}
}
You can use the following options in the gather command:
| option | description | required |
|---|---|---|
| actionHook | webhook POST to invoke with the collected digits or speech. The payload will include a 'speech' or 'dtmf' property along with the standard attributes. See below for more detail. | yes |
| finishOnKey | dmtf key that signals the end of input | no |
| input | array, specifying allowed types of input: ['digits'], ['speech'], or ['digits', 'speech']. Default: ['digits'] | no |
| numDigits | number of dtmf digits expected to gather | no |
| partialResultHook | webhook to send interim transcription results to. Partial transcriptions are only generated if this property is set. | no |
| play | nested play command that can be used to prompt the user | no |
| recognizer.hints | array of words or phrases to assist speech detection | no |
| recognizer.language | language code to use for speech detection. Defaults to the application level setting, or 'en-US' if not set | no |
| recognizer.profanityFilter | if true, filter profanity from speech transcription. Default: no | no |
| recognizer.vendor | speech vendor to use (currently only Google supported) | no |
| say | nested say command that can be used to prompt the user | no |
| timeout | The number of seconds of silence or inaction that denote the end of caller input. The timeout timer will begin after any nested play or say command completes. Defaults to 5 | no |
In the case of speech input, the actionHook payload will include a speech object with the response from Google speech:
"speech": {
"stability": 0,
"is_final": true,
"alternatives": [{
"confidence": 0.858155,
"transcript": "sales please"
}]
}
In the case of digits input, the payload will simple include a digits property indicating the dtmf keys pressed:
"digits": "0276"
Note: an HTTP POST will be used for both the action and the partialResultCallback since the body may need to contain nested JSON objects for speech details.
Note: the partialResultCallback web callback should not return content; any returned content will be discarded.