Reputation: 21
I am new to Twilio and to programming in general.
I have a simple Arduino based App running on an ESP8266. Basically it rings an alarm on a scheduled basis, and requires the user to press a button to silence the beeping alarm. If the alarm beeps 10 times, it then places a voice call from Twilio to a specific number and announces "the alarm is ringing". Everything is working great to that point.
I would like the voice call to say "The alarm is ringing. Press 1 to silence the alarm."
I have no clue as to how to 'accept' the buttonpress . Everything that I can find seems to be about routing internally within Twilio (forwarding, voicemail, etc), but nothing about Twilio posting a response outside.
Any guidance? Any PHP sample code anywhere that does this kind of thing?
Upvotes: 2
Views: 528
Reputation: 6981
You'll want to use a gather in your TwiML
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather timeout="10" numDigits="1">
<Say>The alarm is ringing. Press 1 to silence the alarm.</Say>
</Gather>
</Response>
https://www.twilio.com/docs/api/twiml/gather#attributes
once the user presses a digit then your server will be hit with another request with the Digits param set, check if it equals 1
Upvotes: 2