4
votes

How can you play music in a call with (preferably) a TwiML XML file? I have gotten so far as:

<!-- page located at http://example.com/simple_dial.xml -->
<Response>
<Dial>PHONE NUMBER</Dial>
<Play>
AUDIO FILE URL
</Play>
</Response>

but it waits until PHONE NUMBER hangs up to play the audio. How can I call a phone number, and then play an mp3 in the call?

1

1 Answers

2
votes

Initiate a new call via the REST API, using a URL that returns the following TwiML:

<Response>
    <Play>AUDIO FILE URL</Play>
</Response>

Here's a quickstart tutorial that talks through the process of making an outbound call with the PHP helper library. It's equally easy with the libraries in the other languages as well.