Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twilio - Twiml Enqueue timeout or redirect after fixed time

Is there a way to redirect a call in a queue after a certain amount of time? I know in a Twiml <Dial> you can set a timeout. Is there any way to do that in <Enqueue> or even <Play> as part of it's waitURL

Right now I'm doing something like this:

<Response>
    <Enqueue waitUrl="/wait/" method="GET">
        Support
    </Enqueue>
</Response>

and my wait URL is:

<Response>
    <Play>http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3</Play>
</Response>

I want to redirect the caller to voicemail if he/she has been in the queue for more than 60 seconds.

like image 427
Eva611 Avatar asked Oct 23 '25 17:10

Eva611


1 Answers

Twilio evangelist here.

I don't beleive there is a way to set a Timeout attribute on the enqueue verb. I think there are a couple of ways you can approach this:

  1. In your waitUrl, use an mp3 that is shorter than 60 seconds. When the track is done playing, Twilio will make another request to the waitUrl and pass you a QueueTime parameter which will tell you how long the caller has been in the queue. If that time is > 60 seconds you can redirect that call.
  2. Have a process running in your app that uses the REST API to poll the queue members and checks their waitTime. If waittime > 60 seconds, you redirect the call.

Hope that helps.

like image 148
Devin Rader Avatar answered Oct 26 '25 18:10

Devin Rader



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!