nexmo-dotnet v4.4.0

Adding new Automatic Speech Recognition (ASR) action to NCCO Action set. To start an asr input you will construct a MultiInputAction and return it from your answer webhook:

[HttpGet("/webhooks/answer")]
public string Answer([FromQuery]Answer request)
{
        var host = Request.Host.ToString();
        //Uncomment the next line if using ngrok with --host-header option
        //host = Request.Headers["X-Original-Host"];

        var eventUrl = $"{Request.Scheme}://{host}/webhooks/asr";
        var speechSettings = new SpeechSettings {Language="en-US", EndOnSilence=1, Uuid = new[] { request.Uuid } };
        var inputAction = new MultiInputAction { Speech = speechSettings, EventUrl = new[] { eventUrl } };

        var talkAction = new TalkAction { Text = "Please speak now" };

        var ncco = new Ncco(talkAction, inputAction);
        return ncco.ToString();
}

This will allow a user to perform inputs with speech. After the end conditions are met for the voice input you will then get a webhook returned to you containing an ordered list of guesses for what speech your user said on the EventUrl that you passed through the MultiInputAction. That can be handled like so:

[HttpPost("/webhooks/asr")]
public string OnInput()
{
        MultiInput input;
        using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
        {
            var result = reader.ReadToEndAsync().Result;
            input = JsonConvert.DeserializeObject<MultiInput>(result);
        }
        var talkAction = new TalkAction();
        talkAction.Text = input.Speech.SpeechResults[0].Text;
        var ncco = new Ncco(talkAction);
        return ncco.ToString();
}