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:

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

  2. In the left panel. click Create a resource.

  3. In the right panel, in the search box, enter speech.

  4. In the the drop-down list select Speech. The following is displayed:

    create speech cognitive resource

  5. Click Create and follow the wizard steps.

    For additional 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 Bot Channel Registration or Web App Bot resource, depending on how you deployed the bot.

  3. In the left panel, select Channels.

    selecting channels

  4. In right panel, click the Direct Line Speech icon.

    selecting direct line speech channel

  5. Configure the Direct Line Speech as shown in the picture below. Specifically, add the Cognitive service account (speech service) mentioned in the Prerequisites section.

    configure direct line speech channel

  6. Once you've reviewed the terms of use, click Save to confirm your channel selection. This will add the channel to the 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 panel, select Settings.

  2. In the right panel, check the box by the Enable Streaming Endpoint.

    enable the streaming protocol

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

  4. Navigate to the bot app service.

  5. In the left panel, in the App Service Settings category, select Configuration.

    navigate to app service settings

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

  7. Set Web sockets to On.

    enable websockets for the app service

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

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

voice assistant client

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.