Connect a bot to Direct Line Speech

APPLIES TO: yesSDK v4 no SDK v3

You can configure your bot to allow client applications to communicate with it through the Direct Line Speech channel.

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.

Add the Direct Line Speech channel

  1. To add the Direct Line Speech Channel, first open the bot in the Azure Portal, From your resources, select your Bot Channel Registration resource. Click on Channels in the configuration blade.

    highlight of the location for selecting channels to connect to

  2. In the channel selection page, find and click Direct Line Speech to choose the channel.

    selecting direct line speech channel

  3. Configure the Direct Line Speech as shown in the picture below.

    selecting direct line speech channel

    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:

    • Go to the Azure portal create resources.

    • Search for Speech and select it from the drop-down list. The following is displayed:

      create speech cognitive resource

    • Follow the wizard steps.

    For additional information, see Create a Cognitive Services resource.

  4. Once you've reviewed the terms of use, click Save to confirm your channel selection.

    saving the enablement 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. If you haven't already, open the blade for your bot in the Azure Portal.

  2. Click on Settings under the Bot Management category (right below Channels). Click the checkbox for Enable Streaming Endpoint.

    enable the streaming protocol

  3. At the top of the page, click Save.

  4. On the same blade, under the App Service Settings category, click Configuration.

    navigate to app service settings

  5. Click on General settings and then select the option to enable Web socket support.

    enable websockets for the app service

  6. Click Save at the top of the configuration page.

  7. 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.

Adding protocol support to your bot

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.