Reputation: 4773
Using Twilio API I managed to make a call and play one audio file, but I did not succeed to play two files. how can I do it?
Here is my code:
public HttpResponseMessage Call(string callToNumber, string audioUrl)
{
// Set our Account SID and AuthToken
var accountSid = ConfigurationManager.AppSettings["ACCOUNT_SID"];
var authToken = ConfigurationManager.AppSettings["AUTH_TOKEN"];
var twilioNumber = ConfigurationManager.AppSettings["TwilioMobileNumber"];
// Instantiate a new Twilio Rest Client
var client = new TwilioRestClient(accountSid, authToken);
// Initiate a new outbound call
var call = client.InitiateOutboundCall
(
twilioNumber,
callToNumber,
audioUrl
// ,audioUrl2 -- I want to add another file
);
return Request.CreateResponse(HttpStatusCode.OK);
}
Upvotes: 1
Views: 1638
Reputation: 10366
Twilio evangelist here.
Is the audiofile
variable just a URL to a wav or mp3? If it is, then you'll need to change that to a URL that can return some TwiML that includes two <Play>
verbs, like this:
<Response>
<Play>http://example.com/music1.mp3</Play>
<Play>http://example.com/music2.mp3</Play>
</Response>
Hope that helps.
Upvotes: 3