Connect a bot to Direct Line Speech
APPLIES TO: SDK v4
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've 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 and 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:
Go to the Azure portal to create resources.
In the right pane, enter "speech" in the search box.
Select Speech from the list. It will open a page describing this resource type.
Select Create and follow the wizard steps.
For more 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 Azure Bot resource.
Select the Channels pane.
In right panel, select Direct Line Speech.
Add your Speech Cognitive Service to the Direct Line Speech channel. See Prerequisites for more about the Speech resource.
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 pane, select Settings.
In the right pane, select Enable Streaming Endpoint.
At the bottom of the page, select Apply.
Navigate to the bot app service.
In the App Service instance, under the Settings category, select Configuration.
In the right pane, select the General settings tab.
Set Web sockets to On.
Saveat the top of the configuration page.
The Bot Framework Protocol Streaming Extensions are now enabled for your bot. You're now ready to update your bot code and integrate Streaming Extensions support to an existing bot project.
If you followed all the steps described, you can now 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 the v4.8 SDK release.
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.