У меня есть этот проект, мне нужно позвонить на один из моих номеров в Twilio, что-то сказать, и после того, как пользовательский голос с его голосом воспроизведет аудио, у меня уже «есть» код, но SpeechResult и UnstableSpeechResults всегда имеют нулевое значение.Это мой код:
[HttpPost]
public ActionResult ReceiveCall()
{
var response = new VoiceResponse();
var gather = new Gather(input: new List<Gather.InputEnum> { Gather.InputEnum.Speech },
action: new Uri("http://eb4cdc87.ngrok.io/Voice/GatherProcess"),
speechTimeout: "5",
method: HttpMethod.Post,
partialResultCallback: new Uri("http://eb4cdc87.ngrok.io/Voice/WriteVoice") ,
partialResultCallbackMethod: HttpMethod.Post);
gather.Say("Say Something to record and after press pound");
gather.Pause(5);
gather.Play(new Uri("https://corn-collie-1715.twil.io/assets/demo.mp3"));
response.Append(gather);
return TwiML(response);
}
[HttpPost]
public void GatherProcess()
{
var response = new VoiceResponse();
var gather = new Gather(input: new List<Gather.InputEnum> { Gather.InputEnum.Speech, Gather.InputEnum.Dtmf });//(input: "speech dtmf", timeout: 3, numDigits: 1);
gather.Say("You say this: " + Request.QueryString["SpeechResult"].ToString());
gather.Pause(5);
gather.Play(new Uri("https://corn-collie-1715.twil.io/assets/demo.mp3"));
response.Append(gather);
}
[HttpPost]
public void WriteVoice()
{
var speech = Request.QueryString["UnstableSpeechResult"].ToString();
if (!String.IsNullOrEmpty(speech))
{
System.IO.File.AppendAllText(Server.MapPath(Path.Combine("~/Content/", "Voice.txt")), "You entered: " + speech + "\n");
}
}
Мне действительно нужна помощь по этому вопросу, я знаю, что что-то упустил, но я не знаю, что это, я начинаю с twilio, поэтому у меня мало опыта.
Спасибо