Kingshuk Biswas
Kingshuk Biswas

Reputation: 1

How can I know the key press value during phone call by Twilio

How can I know that, user press 1 or 2 or 3 during phone call by twilio. After pressing the key (1 or 2 or 3) user will get options. Like if he/she presses 1 user will listen some text, if user presses 2 he/she will redirect to another person and so on.

I can do this individually i.e. I can set a message or I can set a phone number of user1 and I make a call to user2. When User2 receives the call he/she will be redirected to user1.

But I can not do this by the pressing value.

Upvotes: 0

Views: 1485

Answers (1)

philnash
philnash

Reputation: 73057

Twilio developer evangelist here.

You can do this using the <Gather> verb in TwiML. <Gather> allows you to set how many keypresses you want to record and then a URL to redirect to once you have received those keypresses. When Twilio makes the request to the next URL you will get a Digits parameter in the request which will contain the keys pressed.

Here's the documentation for <Gather> and a tutorial for a phone menu. Hope this helps!

Upvotes: 1

Related Questions