我正在使用Twilio Rest API(带有C#)来发送语音通话通知。消息正在成功传递给用户,但消息会重复多次。如何限制只发送一次消息?
答案 0 :(得分:0)
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指向你的某个包含你的TwiML的URL,看起来像这样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
属性指定您希望重复文本的次数。默认值是一次。指定&#39; 0&#39;会导致动词循环,直到通话挂断。