twiliotwilio-php

Timeout on Gather verb (Twilio)


I am currently working on user interactive Twilio TwiLM. Here is my TwiLM and when it times out, it just hung up the call. I am not even sure if that is possible in Twilio, but can I keep it repeat to call the action (URL) over and over when it times out.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather numDigits="1" timeout="10" action="twilio_handler.php">
        <Say voice="alice">Please press 1 to continue</Say>
    </Gather>
</Response>

Thanks.


Solution

  • Twilio evangelist here.

    If a <Gather> times out Twilio will look for the next TwiML verb in the document to execute, so if you want to repeat the prompt, what you could do is use the <Redirect> verb to redirect Twilio back to the same TwiML:

    <?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">
            /gather_hints.xml
        </Redirect>
    </Response>
    

    You can find this sample code and more info on <Redirect> on our website.

    Hope that helps.