private async Task GetActionListFromBotService(DirectLineClient client, CallState callState, List <ActionBase> actionList) { var result = await ReadBotMessagesAsync(client, callState); bool hangup = false; string promptForRecord = null; for (int i = 0; i < result.Count; ++i) { if (result[i] == BotResponses.RootLuisDialog_EndConversation) { hangup = true; } if (i < result.Count - 1 || result[i] == BotResponses.RootLuisDialog_EndConversation) { var speech = VoiceHelper.GetPromptForText(result[i]); await SendSTTResultToUser(result[i], callState.Participants); actionList.Add(speech); } else { // This is the last element that we will use for the recording prompt promptForRecord = result[i]; } } if (hangup) { actionList.Add(new Hangup() { OperationId = Guid.NewGuid().ToString() }); } else { actionList.Add(await GetRecordingAction(promptForRecord, callState)); } //var record = GetRecordingAction(promptForRecord); //actionList.Add(record); }
private async Task <Record> GetRecordingAction(string promptText, CallState callState) { var id = Guid.NewGuid().ToString(); var prompt = VoiceHelper.GetPromptForText(promptText); await SendSTTResultToUser(promptText, callState.Participants); var record = new Record { OperationId = id, PlayPrompt = prompt, MaxDurationInSeconds = 60, InitialSilenceTimeoutInSeconds = 5, MaxSilenceTimeoutInSeconds = 4, PlayBeep = true, RecordingFormat = RecordingFormat.Wav, StopTones = new List <char> { '#' } }; return(record); }