// This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // Create the Bot Framework Adapter
            services.AddSingleton <IBotFrameworkHttpAdapter, AdapterWithErrorHandler>();

            // Create the storage we'll be using for User and Conversation state.
            // (Memory is great for testing purposes - examples of implementing storage with
            // Azure Blob Storage or Cosmos DB are below).
            var storage = new MemoryStorage();

            // Create the Conversation state passing in the storage layer.
            var conversationState = new ConversationState(storage);

            services.AddSingleton(conversationState);

            // Register our voice font of choice. Here we are using en-US-AriaNeural.
            // Visit this page for a list of all our voice fonts - https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support#text-to-speech
            // Please note that neural voice fonts are only available in certain regions - https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/regions#text-to-speech
            var voiceFactory = new VoiceFactory("Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)", "en-US", "customerservice");

            services.AddSingleton(voiceFactory);

            // Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
            services.AddTransient <IBot, EchoBotWithRecording>();
        }
Exemple #2
0
        // Dependency injection uses this constructor to instantiate MainDialog
        public MainDialog(IVRRecognizer luisRecognizer, VoiceFactory voiceFactory, CustomerDialog customerDialog, NearestStoreDialog nearestStoreDialog, OrderStatusDialog orderStatusDialog, EmployeeDialog employeeDialog, PurchaseOrderStatusDialog purchaseOrderStatusDialog, LeavePolicyDialog leavePolicyDialog, ILogger <MainDialog> logger)
            : base(nameof(MainDialog))
        {
            _luisRecognizer = luisRecognizer;
            VoiceFactory    = voiceFactory;
            Logger          = logger;

            AddDialog(new OrderNumberPrompt());
            AddDialog(new PurchaseOrderNumberPrompt());
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));

            AddDialog(new WaterfallDialog("DTMF", new WaterfallStep[]
            {
                DTMFIntroStepAsync,
                DTMFActStepAsync
            }));

            AddDialog(customerDialog);
            AddDialog(nearestStoreDialog);
            AddDialog(orderStatusDialog);

            AddDialog(employeeDialog);
            AddDialog(purchaseOrderStatusDialog);
            AddDialog(leavePolicyDialog);

            // The initial child Dialog to run.
            InitialDialogId = "DTMF";
        }
Exemple #3
0
        public OrderStatusDialog(VoiceFactory voiceFactory) : base(nameof(OrderStatusDialog))
        {
            VoiceFactory = voiceFactory;

            AddStep(OrderNumberStepAsync);
            AddStep(FinalStepAsync);
        }
        public NearestStoreDialog(VoiceFactory voiceFactory) : base(nameof(NearestStoreDialog))
        {
            VoiceFactory = voiceFactory;

            AddStep(StateStepAsync);
            AddStep(CityStepAsync);
            AddStep(FinalStepAsync);
        }
Exemple #5
0
        public PurchaseOrderStatusDialog(VoiceFactory voiceFactory, IConfiguration configuration) : base(nameof(PurchaseOrderStatusDialog))
        {
            VoiceFactory = voiceFactory;

            AddStep(OrderNumberStepAsync);
            AddStep(FinalStepAsync);

            //Get transfer number from config
            TransferNumber = configuration["TransferNumber"];
        }
Exemple #6
0
        public LeavePolicyDialog(VoiceFactory voiceFactory, IConfiguration configuration) : base(nameof(LeavePolicyDialog))
        {
            VoiceFactory = voiceFactory;

            AddStep(PolicyTypeStepAsync);
            AddStep(FinalStepAsync);

            //Get transfer number from config
            TransferNumber = configuration["TransferNumber"];
        }
        public EmployeeDialog(IVRRecognizer luisRecognizer, VoiceFactory voiceFactory, ILogger <MainDialog> logger)
            : base(nameof(EmployeeDialog))
        {
            _luisRecognizer = luisRecognizer;
            Logger          = logger;
            VoiceFactory    = voiceFactory;

            AddStep(IntroStepAsync);
            AddStep(ActStepAsync);
            AddStep(FinalStepAsync);
        }
Exemple #8
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // Create the Bot Framework Adapter with error handling enabled.
            services.AddSingleton <IBotFrameworkHttpAdapter, AdapterWithErrorHandler>();

            // Create the storage we'll be using for User and Conversation state. (Memory is great for testing purposes.)
            services.AddSingleton <IStorage, MemoryStorage>();

            // Create the User state. (Used in this bot's Dialog implementation.)
            services.AddSingleton <UserState>();

            // Create the Conversation state. (Used by the Dialog system itself.)
            services.AddSingleton <ConversationState>();

            // Register LUIS recognizer
            services.AddSingleton <IVRRecognizer>();

            // Register our dialog tree
            services.AddSingleton <CustomerDialog>();
            services.AddSingleton <NearestStoreDialog>();
            services.AddSingleton <OrderStatusDialog>();

            services.AddSingleton <EmployeeDialog>();
            services.AddSingleton <PurchaseOrderStatusDialog>();
            services.AddSingleton <LeavePolicyDialog>();

            // The MainDialog that will be run by the bot.
            services.AddSingleton <MainDialog>();

            // Register our voice font of choice. Here we are using en-US-AriaNeural.
            // Visit this page for a list of all our voice fonts - https://docs.microsoft.com/azure/cognitive-services/speech-service/language-support#text-to-speech
            // Please note that neural voice fonts are only available in certain regions - https://docs.microsoft.com/azure/cognitive-services/speech-service/regions#text-to-speech
            var voiceFactory = new VoiceFactory("en-US-AriaNeural", "en-US", "customerservice");

            services.AddSingleton(voiceFactory);

            // Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
            services.AddTransient <IBot, DialogBot <MainDialog> >();
        }
Exemple #9
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // Create the Bot Framework Adapter with error handling enabled.
            services.AddSingleton <IBotFrameworkHttpAdapter, AdapterWithErrorHandler>();

            // Create the storage we'll be using for User and Conversation state. (Memory is great for testing purposes.)
            services.AddSingleton <IStorage, MemoryStorage>();

            // Create the User state. (Used in this bot's Dialog implementation.)
            services.AddSingleton <UserState>();

            // Create the Conversation state. (Used by the Dialog system itself.)
            services.AddSingleton <ConversationState>();

            // Register LUIS recognizer
            services.AddSingleton <IVRRecognizer>();

            // Register our dialog tree
            services.AddSingleton <CustomerDialog>();
            services.AddSingleton <NearestStoreDialog>();
            services.AddSingleton <OrderStatusDialog>();

            services.AddSingleton <EmployeeDialog>();
            services.AddSingleton <PurchaseOrderStatusDialog>();
            services.AddSingleton <LeavePolicyDialog>();

            // The MainDialog that will be run by the bot.
            services.AddSingleton <MainDialog>();

            //Register our voice font of choice. Here we are using JessaNeural. Visit
            var voiceFactory = new VoiceFactory("Microsoft Server Speech Text to Speech Voice (en-US, JessaNeural)", "en-US", "customerservice");

            services.AddSingleton(voiceFactory);

            // Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
            services.AddTransient <IBot, DialogBot <MainDialog> >();
        }