Skip to main content

Gather

The <Gather> verb collects DTMF tones during a call. <Say> can be nested within <Gather> to create an interactive IVR with text-to-speech.

Attributes

ATTRIBUTEDESCRIPTIONOPTIONSDEFAULT
action URL where TeXML will send the gathered result and message history. Same method (GET/POST) as set for the TexML application is used. Transfers control of the current call to the TeXML file returned. -
timeout Time in seconds between digits before the <Gather> digits are sent to your action URL. Telnyx will wait until all nested verbs have been executed before beginning the timeout period. 1 - 120 5
finishOnKey The set of digits, (0-9, *, #), that indicates the end of the gather. #
numDigits The number of digits to be gathered. -
language The language used. See RESTful API documentation for supported values. By default en-US. en-US
validDigits The set of valid digits for the gather action. -
invalidDigitsAction URL where TeXML will send the invalid gathered digits. The same method (GET/POST) as set for the TeXML application is used. Transfers control of the current call to the TeXML file returned. -
minDigits Minimum number of digits to be gathered. 1 - 128 1
maxDigits Maximum number of digits to be gathered. 1 - 128 128

Child verbs/nouns

NOUN/VERBDESCRIPTION
Say
Play

Examples

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather timeout="5" numDigits="1" finishOnKey="#">
<Say>Press 1 for sales, press 2 for support.</Say>
</Gather>
</Response>

Expected callbacks

If action is set, the following callback can be expected with the gathered digits

{
"AccountSid":"cb6cfbbc-eb00-41af-a3f3-0d7b32009e4b",
"CallSid":"v2:DPNqxVjTNtQYaKdcKbU0QgRFrQ3YzuAQrVYC4Ggcuq7zTpDkUB7A4w",
"CallSidLegacy":"v2:DPNqxVjTNtQYaKdcKbU0QgRFrQ3YzuAQrVYC4Ggcuq7zTpDkUB7A4w",
"Digits":"1",
"From":"Defaultj35z6@sip.telnyx.com",
"To":"+12132045020"
}

Action callback attributes

ATTRIBUTEDESCRIPTION
AccountSidA unique identifier for the account generating this call.
CallSidA unique identifier for this call, generated by Telnyx.
CallSidLegacyA unique identifier for the call sent to keep backward compatibility.
FromThe outbound caller number.
ToThe inbound callee number.
DigitsThe digits entered in the gathering process by the callee.