从 C# 在 Twilio 中进行呼叫转移
Call forwarding in Twilio from C#
我正在使用最新版本的 Twilio Rest API .NET nuget 库,我想转发现有的语音呼叫。
我确实找到了一些现有代码
[HttpPost]
public async Task<ActionResult> Connect(string from, string to)
{
var response = new TwilioResponse();
response.Say("Please wait while we contact the other party");
response.Dial("+14085993263", new { callerId = "+1234567890" });
return TwiML(response);
}
但是 Dial 方法的第二个参数似乎不再起作用。
鉴于没有 Twilio 身份验证详细信息,我也看不出上面的代码如何工作。
有没有人有任何使用最新的 nuget 库的示例代码,说明如何从 C# 执行呼叫转发(它不必是 Web 方法)
我确实在这里找到了 Twilio 示例
https://www.twilio.com/docs/voice/tutorials/call-forwarding-csharp-mvc
但老实说,这确实帮助不大。
提前致谢
马克
此处为 Twilio 开发人员布道师。
Dial
方法已更新为将所有参数作为命名参数。现在最好创建单独的 Say
和 Dial
对象并使用 Append
方法。所以现在你需要:
[HttpPost]
public async Task<ActionResult> Connect(string from, string to)
{
var response = new TwilioResponse();
var say = new Say("Please wait while we contact the other party");
var dial = new Dial(callerId: "+1234567890");
var number = new Number("+14085993263");
dial.Append(number);
response.Append(say);
response.Append(dial);
return TwiML(response);
}
有关详细信息,请查看 examples in the TwiML documentation。
我正在使用最新版本的 Twilio Rest API .NET nuget 库,我想转发现有的语音呼叫。 我确实找到了一些现有代码
[HttpPost]
public async Task<ActionResult> Connect(string from, string to)
{
var response = new TwilioResponse();
response.Say("Please wait while we contact the other party");
response.Dial("+14085993263", new { callerId = "+1234567890" });
return TwiML(response);
}
但是 Dial 方法的第二个参数似乎不再起作用。 鉴于没有 Twilio 身份验证详细信息,我也看不出上面的代码如何工作。 有没有人有任何使用最新的 nuget 库的示例代码,说明如何从 C# 执行呼叫转发(它不必是 Web 方法) 我确实在这里找到了 Twilio 示例 https://www.twilio.com/docs/voice/tutorials/call-forwarding-csharp-mvc 但老实说,这确实帮助不大。 提前致谢 马克
此处为 Twilio 开发人员布道师。
Dial
方法已更新为将所有参数作为命名参数。现在最好创建单独的 Say
和 Dial
对象并使用 Append
方法。所以现在你需要:
[HttpPost]
public async Task<ActionResult> Connect(string from, string to)
{
var response = new TwilioResponse();
var say = new Say("Please wait while we contact the other party");
var dial = new Dial(callerId: "+1234567890");
var number = new Number("+14085993263");
dial.Append(number);
response.Append(say);
response.Append(dial);
return TwiML(response);
}
有关详细信息,请查看 examples in the TwiML documentation。