Twilio电话:播放两个音频文件

时间:2015-01-25 08:19:33

标签: twilio

使用Twilio API我设法拨打电话并播放一个音频文件,但我没有成功播放两个文件。我怎么能这样做?

这是我的代码:

 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);
        }

1 个答案:

答案 0 :(得分:3)

Twilio传道者在这里。

audiofile变量只是wav或mp3的URL吗?如果是,那么您需要将其更改为可以返回包含两个<Play>动词的TwiML的URL,如下所示:

<Response>
    <Play>http://example.com/music1.mp3</Play>
    <Play>http://example.com/music2.mp3</Play>
</Response> 

希望有所帮助。