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.

Prerequisites

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:

  1. Go to the Azure portal to create resources.

  2. In the right pane, enter "speech" in the search box.

  3. Select Speech from the list. It will open a page describing this resource type.

    create speech cognitive resource

  4. Select Create and follow the wizard steps.

    For more information, see Create a Cognitive Services resource.

Add the Direct Line Speech channel

  1. In your browser, navigate to the Azure portal.

  2. From your resources, select the Azure Bot resource.

  3. Select the Channels pane.

    selecting channels

  4. In right panel, select Direct Line Speech.

    selecting direct line speech channel

  5. Add your Speech Cognitive Service to the Direct Line Speech channel. See Prerequisites for more about the Speech resource.

  6. Once you've reviewed the terms of use, select Save to confirm your channel selection. This adds the channel to your bot.

    saving the enabled of Direct Line Speech channel

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.

  1. In the left pane, select Settings.

  2. In the right pane, select Enable Streaming Endpoint.

    enable the streaming protocol

  3. At the bottom of the page, select Apply.

  4. Navigate to the bot app service.

  5. In the App Service instance, under the Settings category, select Configuration.

    navigate to app service settings

  6. In the right pane, select the General settings tab.

  7. Set Web sockets to On.

    enable websockets for the app service

  8. Select Save at 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.

Example

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.

voice assistant client

Adding protocol support to your bot

Note

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.