Exemplo n.º 1
0
        public async Task <DialogTurnResult> PhraseStepAsync(WaterfallStepContext stepContext,
                                                             CancellationToken cancellationToken)
        {
            var state = await Accessors.CustomerDataState.GetAsync(stepContext.Context, null, cancellationToken);

            var phrase = await VoiceVerifier.GetEnrollmentPhraseAsync();

            var profileEnrollments = await VoiceVerifier.GetNumberOfEnrollments(state.UnAuthorizedCustomer);

            if (profileEnrollments >= 3)
            {
                return(await stepContext.PromptAsync(VoicePrompt, new PromptOptions
                {
                    Prompt = await Chatter.GetActivityAsIsAsync(StaticTexts.UploadVerificationVoiceText(phrase)),
                    RetryPrompt = await Chatter.GetActivityAsIsAsync(StaticTexts.VoiceNotAuthenticText(phrase))
                }, cancellationToken));
            }

            await Chatter.SendMessageAsync(stepContext.Context, StaticTexts.UploadVoicesIntroText);

            return(await stepContext.PromptAsync(PhrasePrompt, new PromptOptions
            {
                Prompt = await Chatter.GetActivityAsIsAsync(
                    StaticTexts.UploadVoiceText(phrase, profileEnrollments + 1))
            }, cancellationToken));
        }