I have an application that runs with Twilio. The idea is that you will call a phone number twilio will answer and give you menu options. Once you press a digit it will submit the post data and then hang up (That part all works correctly) The problem I'm having is finding out if there is a way to submit post data if the user just hangs up as soon as twilio answers... I found the following code on their documentation.
<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://example.com/gather_hints.xml -->
<Response>
<Gather action="/process_gather.php" method="GET">
<Say>Enter something, or not</Say>
</Gather>
<Redirect method="GET">
/process_gather.php?Digits=TIMEOUT
</Redirect>
</Response>
The problem with this is you need to wait until the end of the message for gather to time out. Is there a way to make it so as soon as starts, if the user hangs up it'll do something like go to the redirect tag?
Thanks!
Edit: So on the process_gather.php page, I can save the completed status as a variable?
$Completed = $_POST["completed"]; //which would set $Completed == 'completed'
and then in that page I can just basically say if if(!empty($Completed)) do something (I have to work it into my logic, but I just want to make sure I get the general idea)
/call_ended.php
) that checks to see if the/process_gather.php
has run yet.