C# 用twilio录制块
twilio的新成员。我正试着打一个twilio电话到我公司的IVR并录制语音片段。例如,当我拨打IVR时,我得到: 你好,欢迎来到。。。按1获取。。。 我们的菜单最近改变了,因为。。。按1 我可以使用以下方式拨号:C# 用twilio录制块,c#,twilio,C#,Twilio,twilio的新成员。我正试着打一个twilio电话到我公司的IVR并录制语音片段。例如,当我拨打IVR时,我得到: 你好,欢迎来到。。。按1获取。。。 我们的菜单最近改变了,因为。。。按1 我可以使用以下方式拨号: static void Main(string[] args) { string accountSid = "xxxxxxxx"; string authToken = "xxxxxxx"; Twilio.TwilioClient.Init(accountSid, authTok
static void Main(string[] args)
{
string accountSid = "xxxxxxxx";
string authToken = "xxxxxxx";
Twilio.TwilioClient.Init(accountSid, authToken);
var call = CallResource.Create( 9876543210, 1234567890,
record: true,
recordingChannels: "dual",
url: new Uri("http://www.mycompany.com/DialOption"),
sendDigits: "wwww1234wwww1234567890")
}
在我的Web服务器上,我有:
public class DialOptionController : TwilioController
{
[HttpPost]
public TwiMLResult Index(VoiceRequest request)
{
var response = new VoiceResponse();
response.Pause(19);
response.Play(digits: "1");
response.Pause(19);
response.Play(digits: "1");
response.Pause(9);
response.Play(digits: "1");
return TwiML(response);
}
}
在我选择该选项之前,如何获取通话记录以提供通话块,而不是将整个通话记录保存在一个文件中?我相信您无法获取通话记录的通话块。您只能在通话结束时获得整个录音的链接 如果选择input=speech或input=speech dtmf而不是默认的input=dtmf,并且为partialResultCallback参数提供一个值,则可以在块中获得的唯一记录是聚集谓词期间的记录。例如:
var response = new VoiceResponse();
var gather = new Gather(input: "speech",
action: new Uri("/completed"),
partialResultCallback: new Uri("/partial"));
gather.Say("Welcome to Twilio, please tell us why you're calling");
response.Append(gather);
Console.WriteLine(response.ToString());