I need to know how can we get keys input from user while Outgoing call in Twilio. I didn't find something useful in Twilio's Documentation. If someone does this functionality please help.
1 Answers
For this you can use the <Gather>
TwiML verb. When you place the outgoing call, it connects to the user's phone and then Twilio makes the webhook request to your application to find out what to do next. Return a <Gather>
, nesting a <Say>
or <Play>
to instruct the user what to do.
Also, add an action
attribute to the <Gather>
, this will be the URL that Twilio makes a request to once the user has completed inputting their data. The action
URL will receive a request including the parameter Digits
which will include the buttons the user pressed.
<Response>
<Gather action="/result" input="dtmf">
<Say>Press 1 to speak to sales or press 2 to speak to support.</Say>
</Gather>
</Response>
There are other attributes for the <Gather>
element, such as numDigits
which allows you to set the number of digits you expect from your caller. Once the caller enters the number of digits, Twilio automatically submits the data to your action URL.
You can also gather speech input from a user using <Gather>
and that is also documented.

- 70,667
- 10
- 60
- 88