0

Hello I am new at twilio. I build a small project for school that gathers some details (like account number, zip, street number) The compiled script is:

<?xml version="1.0" encoding="UTF-8"?>
    <Response>
        <Gather input="dtmf" numDigits="5" timeout="20" finishOnKey="#" action="http://mywebsite.com/handle-user-input.php">
            <Say voice="woman">Welcome</Say>
            <Say voice="woman" language="es">para servicio en espaniol marque 9</Say>
            <Say voice="alice">For account access, or questions, enter your account number followed by pound</Say>
            <Say voice="alice">For everything else, say other options </Say>
        </Gather>

        <!-- If they didnt put an input say this then retry -->
        <Say voice="woman">For account access, say or enter your acount number, one digit at a time, followed by pound. You can also say "other options" or press 2</Say>
        <Redirect>http://mywebsite. com/handle-incoming-call.xml</Redirect>
    </Response>`

and handle-user-input.php content is:

<?php
echo '<?xml version="1.0" encoding="UTF-8"?>';
$digits = $_REQUEST['Digits'];
if ( $digits == 5 ) {

} else {
    echo '<Response>';
    echo '<Say voice="alice">Thank you, redirecting you to your account</Say>';
    echo '<Redirect>second_step.xml</Redirect>';
    echo '</Response>';
}

Now, I don't want to go get the details I receive every-time, from Twilio dashboard. I heard I can retrieve the "results" in a .txt on my website, or a log. I searched everywhere but I couldn't find a script for this! Found some fwrite() functions but I can't format everything correctly. Please help!

g152xx
  • 1
  • 2
  • You already have them. They are here: $digits = $_REQUEST['Digits']; – miknik Oct 11 '17 at 00:23
  • @miknik And where do the details go? Where do I see them? – g152xx Oct 11 '17 at 00:29
  • They go wherever you tell them to go. How would you like to see them? – miknik Oct 11 '17 at 00:38
  • @miknik I need them posted on a log on my website, to see results I get live. For example a log formatted into something like this: [from] +35XXXXXXXXX [account number] : $digits I GET [pin] : $digits I GET and so on. – g152xx Oct 11 '17 at 00:39
  • I would probably store them in your database then, and poll it with an ajax script every minute or so, or set up a websocket connection to display it on your webpage in almost real time – miknik Oct 11 '17 at 01:19
  • @miknik Ok, too complicated. What if I want them stored in a simple log for later viewing? Isn't it simpler? – g152xx Oct 11 '17 at 01:26
  • If that's the case, then use Monolog (https://github.com/Seldaek/monolog) to log them as required/desired. – Matthew Setter May 10 '23 at 08:37

0 Answers0