An Azure communication platform for deploying applications across devices and platforms.
Hi @Abhishek Pandey
Thank you for reaching out regarding the error you're encountering with the Azure Communication Services (ACS) Call Automationquickstart: "Action failed, Transport url is not valid or web socket server is not operational" (HTTP 400, Subcode 8581). After reviewing the logs you shared, we found that this issue happens because the WebSocket server URL (transport_url) used for media streaming in your setup (from this GitHub repository) is either invalid or not publicly accessible.
The call seems to connect successfully (CallConnected), but media streaming does not work because of the WebSocket configuration. This is a frequent issue when running the sample locally, and we've provided a solution below to help resolve it.
Please follow below steps to the Solution:
- Use ngrok to expose your local server:
- Download and install ngrok from ngrok.com (you'll need to create a free account).
- Start your local server, such as the FastAPI app in app.py, usually running on port 8000.
- In a terminal, run ngrok http 8000 to generate a public URL (for example, https://abc123.ngrok-free.app).
- Please update the Transport URL.
- Please update the transport_url in your code (most likely where StartMediaStreamingOptions is configured) to use the ngrok WebSocket endpoint.
from azure.communication.callautomation import StartMediaStreamingOptions streaming_options = StartMediaStreamingOptions( transport_url="wss://<your-ngrok-url>.ngrok-free.app/ws/media", subscribed_content_types=['audio'] ) - Make sure the WebSocket path (/ws/media) aligns with your server’s configuration.
- Please update the transport_url in your code (most likely where StartMediaStreamingOptions is configured) to use the ngrok WebSocket endpoint.
- Verify the Setup:
- Restart your server and initiate a new call through the quickstart.
- Review the logs to confirm that the MediaStreamingSubscription state is set to active, rather than inactive as previously shown.
- If the issue continues, check that the WebSocket URL is accessible using a tool like wscat or a browser.
- If problems persist:
- Make sure ngrok is running and that the URL can be accessed from outside your network.
- Review your ACS resource’s network settings in the Azure Portal to confirm there are no firewall rules blocking ngrok domains.
- Turn on diagnostics by going to Azure Portal > Communication Services > Your resource > Monitoring > Diagnostic settings.
Reference :
Kindly let us know if the above helps or you need further assistance on this issue.
Please "upvote" if the information helped you. This will help us and others in the community as well.