我使用Twilio Rest API (带有C#)来发送语音呼叫通知。消息正在成功地传递给用户,但消息重复多次。如何将消息限制为只说一次?
发布于 2016-09-20 04:40:50
您的making the call脚本可能看起来像这样:
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/user/account
string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
string AuthToken = "your_auth_token";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var options = new CallOptions();
options.Url = "http://demo.twilio.com/docs/voice.xml";
options.To = "+1XXXXXXXXXX";
options.From = "+1XXXXXXXXXX";
var call = twilio.InitiateOutboundCall(options);
Console.WriteLine(call.Sid);
}
}这里的URL指向您的某个URL,其中包含您的TwiML,可能类似于下面的in C#:
public void Example()
{
var response = new TwilioResponse();
response.Say("This shall only be heard once.");
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}另外,在你的<Say>上使用note if you have a loop parameter specified:
loop属性指定要将文本重复多少次。默认值为一次。指定'0‘将导致谓词循环,直到呼叫挂起。
https://stackoverflow.com/questions/39480147
复制相似问题