gpt4 book ai didi

c# - 使用本地 xml 文件进行 twilio 调用

转载 作者:行者123 更新时间:2023-11-30 15:16:20 25 4
gpt4 key购买 nike

sample code on how-to-make-a-call看起来像这样:

static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "ACc610c3a41a31c91a01396f7bf92c517d";
const string authToken = "your_auth_token";
TwilioClient.Init(accountSid, authToken);

var to = new PhoneNumber("+14155551212");
var from = new PhoneNumber("+15017122661");
var call = CallResource.Create(to,
from,
url: new Uri("http://demo.twilio.com/docs/voice.xml"));

Console.WriteLine(call.Sid);
}

引用的 voice.xml 的 xml 如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice">Thanks for trying our documentation. Enjoy!</Say>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
</Response>

我只想在内存中创建一个 xml 文件,并引用它,而不是远程 uri。无论如何,有没有像下面这样的东西并将它附加到 CallResource.Create 参数?

    System.Xml.XmlDocument xmlDocument = new XmlDocument();
String s = "My custom message!";
xmlDocument.LoadXml(string.Format(@"<Response><Say voice=""alice"">{0}</Say></Response>", s));

最佳答案

此处为 Twilio 开发人员布道师。

目前无法发送 TwiML对于请求创建调用的调用。您确实需要将 TwiML 托管在某处。

如果您很难托管 TwiML,那么您可以查看 TwiML BinsTwilio Functions了解在 Twilio 中托管 TwiML 的静态和动态方式。

关于c# - 使用本地 xml 文件进行 twilio 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49905568/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com