Azure / Azure/azure-sdk-for-python

[azure-communication-callautomation] Streaming back data via WebSocket not working, can't hear my voice repeated back in the call.

Open
#37,766 1 comment 0 reactions 0 assignees View on GitHub
Client Communication - Call Automation customer-reported needs-team-attention question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

- **Package Name**: azure-communication-callautomation
- **Package Version**: 1.3.0b1
- **Operating System**: MacOS 15.0.1 (24A348)
- **Python Version**: 3.11.7

**Describe the bug**
When using `MediaStreamingOptions` with custom `transport_url` to create a new call, then receive audio data and send it back immediately, no audio can be heard. I cannot seem to find any documentation talking about sending WebSocket data back to Azure.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a new call
```
media_streaming_options = MediaStreamingOptions(
transport_url=ws_base_url,
transport_type=MediaStreamingTransportType.WEBSOCKET,
content_type=MediaStreamingContentType.AUDIO,
audio_channel_type=MediaStreamingAudioChannelType.MIXED,
start_media_streaming=record,
)

call_conn_props: CallConnectionProperties = (
await call_automation_client.create_call(
target_participant=target,
callback_url=AzureClientService._gen_events_callback_url(
base_url=base_url, call_id=call_id
),
source_caller_id_number=source,
media_streaming=media_streaming_options,
)
)
```
2. Receive the WebSocket connection. Send back the data (The whole object), I've tried sending back only the data, too, and it still won't work
```
@router.websocket("/connect_call/{id}/azure")
async def connect_call_azure(id: str, websocket: WebSocket) -> None:
await ws.accept()
while True:
try:
message: str = await ws.receive_text()
await ws.send_text(data=message)
except Exception as e:
logger.error(
message=f"Unknown Exception:{e}\n traceback:{traceback.format_exc()}"
)
break
```

**Expected behavior**
In the call, I can hear my voice back when I speak.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Any documentation discussing this feature when using `create_call` with `MediaStreamingOptions`, how to handle the WebSocket connection, the format, and the data specifications would be great. Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.