Connect a bot to Direct Line Speech
This article describes how to connect a bot to the Direct Line Speech channel. Use this channel to allow users to interact with a bot via voice.
Once you have built your bot, onboarding it with Direct Line Speech will enable low latency, high reliability connection with client applications using the Speech SDK. These connections are optimized for voice in, voice out conversational experiences. For more information on Direct Line Speech and how to build client applications, visit the custom voice-first virtual assistant page.
The Direct Line Speech channel requires a Cognitive Services resource, specifically a speech cognitive service resource. You can either use an existing resource or create a new one. To create a new speech resource follow these steps:
In your browser, navigate to the Azure portal create resources.
In the left panel. click Create a resource.
In the right panel, in the search box, enter speech.
In the the drop-down list select Speech. The following is displayed:
Click Create and follow the wizard steps.
For additional information, see Create a Cognitive Services resource.
Add the Direct Line Speech channel
In your browser, navigate to the Azure Portal.
From your resources, select the Bot Channel Registration or Web App Bot resource, depending on how you deployed the bot.
In the left panel, select Channels.
In right panel, click the
Direct Line Speechicon.
Configure the Direct Line Speech as shown in the picture below. Specifically, add the Cognitive service account (speech service) mentioned in the Prerequisites section.
Saveto confirm your channel selection. This will add the channel to the bot.
Enable the Bot Framework Protocol Streaming Extensions
With the Direct Line Speech channel connected to your bot, you now need to enable Bot Framework Protocol Streaming Extensions support for optimal, low-latency interaction.
In the left panel, select Settings.
In the right panel, check the box by the Enable Streaming Endpoint.
At the top of the page, click Save.
Navigate to the bot app service.
In the left panel, in the App Service Settings category, select Configuration.
In the right panel, select the
Web socketsto On.
Saveat the top of the configuration page.
The Bot Framework Protocol Streaming Extensions are now enabled for your bot. You are now ready to update your bot code and integrate Streaming Extensions support to an existing bot project.
If you have followed all the steps described, you can talk to the bot using the client application downloadable at this location: Windows Voice Assistant Client.
The following picture shows the client application interface when communicating with a simple echo bot. See also Voice-enable your bot using the Speech SDK.
Adding protocol support to your bot
The following step is only needed for bots built before the release of the 4.8 SDKs.
With the Direct Line Speech channel connected and support for the Bot Framework Protocol Streaming Extensions enabled, all that's left is to add code to your bot to support the optimized communication. Follow the instructions on adding Streaming Extensions support to your bot to ensure full compatibility with Direct Line Speech.