Question

I would like to limit the amount of music a caller hears before updating them on their status in the queue.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say>The average hold time is 15 seconds and you are in position 2.</Say>
    <Gather timeout="30" action="http://someURL.com?nextStep=OptOut" method="GET" numDigits="1">
        <Play>http://com.twilio.sounds.music.s3.amazonaws.com/BusyStrings.mp3</Play>
    </Gather>
    <Redirect method="GET">http://someURL.com?nextStep=Hold</Redirect>
</Response>

The AWESOME music I am playing is much longer than 30 seconds. I was hoping that it would drop down to the Redirect after the timeout of 30 seconds specified in the Gather but it plays the entire MP3 and then hits the Redirect. I understand I could shorten the MP3 to 30 seconds but I would like something more flexible.

Thanks and regards.

Was it helpful?

Solution

You can't do that with twilio, but you could have a service that cuts an mp3 to the duration you want, and give twilio that URL. It would be something like

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say>The average hold time is 15 seconds and you are in position 2.</Say>
    <Gather timeout="30" action="http://someURL.com?nextStep=OptOut" method="GET" numDigits="1">
        <Play>http://example.com/cut?url=http%3A%2F%2Fcom.twilio.sounds.music.s3.amazonaws.com%2FBusyStrings.mp3&length=30</Play>
    </Gather>
    <Redirect method="GET">http://someURL.com?nextStep=Hold</Redirect>
</Response>

You can take a look into this blog post on how to using mtpsplit or mp3cut to get the first 30 seconds of your awesome music.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top