Speech Service not working in custom QnA bot, Error Code 1002 and status code 405

Dev Shah 0 Reputation points
2023-04-01T06:28:42.08+00:00

Hello,

I have been working on creating an Azure Bot connected to a custom QnA knowledge base. I have built this and have successfully tested this in the web chat. I am now working on enabling speech capabilities and have integrated the bot with an azure speech resource using direct channel. According to this thread, I have also made sure, HttpGet and UseWebSockets have been added to the code, as well enable streaming endpoints, and allow websockets has been checked. I get the following error when trying to connect my bot using the Windows Voice Assistant client:

"Error (ConnectionFailure) : Connection was closed by the remote host. Error code: 1002. Error details: The server returned status code '405' when status code '101' was expected."

Analyzing the same using application insights shows this error is generated when GET is called on the /api/message endpoint.

Any help would be appreciated.

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
941 questions
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,061 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,598 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VasimTamboli 5,215 Reputation points
    2023-05-14T14:32:03.24+00:00

    The error you are encountering ("Error code: 1002") indicates that the connection to the Speech Service endpoint was closed unexpectedly, and the server returned a status code of '405' instead of the expected '101' status code.

    The HTTP status code '405' typically represents a "Method Not Allowed" error, which suggests that the HTTP method being used is not supported by the endpoint. In this case, it seems that the GET method is not allowed for the /api/message endpoint of your bot.

    To resolve this issue, you can try the following steps:

    1. Ensure that you have correctly configured the Speech Service integration in your bot's code and that the endpoint and credentials are accurate.
    2. Verify that the Speech Service resource is properly configured in the Azure portal and that it is accessible.
    3. Double-check the code implementation and make sure that the appropriate HTTP methods, such as GET and POST, are used for the correct API endpoints. Ensure that the HttpGet and UseWebSockets middleware are correctly added to your bot's code.
    4. Review any firewall or network settings that might be blocking the connection between the client and the Speech Service endpoint.
    5. Check if there are any recent updates or changes to the Speech Service or Bot Framework that might require adjustments to your code or configurations.
    6. Monitor the Azure portal logs and application insights for any additional error details or exceptions that could provide further insight into the issue.

    If the problem persists, you may consider reaching out to Azure Support for further assistance. They can help investigate the specific details of your scenario and provide tailored guidance to resolve the issue.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.