You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/communication-services/how-tos/call-automation/includes/audio-streaming-quickstart-csharp.md
+26-68Lines changed: 26 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,16 +16,17 @@ ms.author: alvinhan
16
16
- An Azure Communication Services resource. See [Create an Azure Communication Services resource](../../../quickstarts/create-communication-resource.md?tabs=windows&pivots=platform-azp).
17
17
- A new web service application created using the [Call Automation SDK](../../../quickstarts/call-automation/callflows-for-customer-interactions.md).
18
18
- The latest [.NET library](https://dotnet.microsoft.com/download/dotnet-core) for your operating system.
19
-
- A websocket server that can receive media streams.
19
+
- A websocket server that can send and receive media streams.
20
20
21
21
## Set up a websocket server
22
22
Azure Communication Services requires your server application to set up a WebSocket server to stream audio in real-time. WebSocket is a standardized protocol that provides a full-duplex communication channel over a single TCP connection.
23
-
You can optionally use Azure services Azure WebApps that allows you to create an application to receive audio streams over a websocket connection. Follow this [quickstart](https://azure.microsoft.com/blog/introduction-to-websockets-on-windows-azure-web-sites/).
23
+
24
+
You can review documentation [here](https://azure.microsoft.com/blog/introduction-to-websockets-on-windows-azure-web-sites/) to learn more about websockets and how to use them.
24
25
25
26
## Receiving and Sending audio streaming data
26
27
There are multiple ways to start receiving audio stream, which can be configured using the `startMediaStreaming` flag in the `mediaStreamingOptions` setup. You can also specify the desired sample rate used for recieving or sending audio data using the `audioFormat` parameter. Currently supported formats are PCM 24K mono and PCM 16K mono, with the default being PCM 16K mono.
27
28
28
-
To enable bidirectional audio streaming, where you're sending audio data into the call, you can enable the `EnableBidirectional` flag.
29
+
To enable bidirectional audio streaming, where you're sending audio data into the call, you can enable the `EnableBidirectional` flag. For more details refer to the [API specifications](https://learn.microsoft.com/rest/api/communication/callautomation/answer-call/answer-call?view=rest-communication-callautomation-2024-06-15-preview&tabs=HTTP#mediastreamingoptions).
29
30
30
31
### Start streaming audio to your webserver at time of answering the call
31
32
Enable automatic audio streaming when the call is established by setting the flag `startMediaStreaming: true`.
// Add your code here to process the received audio chunk
116
111
}
117
112
}
118
-
} catch (Exceptionex) {
119
-
Console.WriteLine($"Exception -> {ex}");
120
113
}
121
114
}
122
115
```
@@ -158,58 +151,23 @@ Once Azure Communication Services begins streaming audio to your WebSocket serve
158
151
The example below demonstrates how to transmit the audio data back into the call after it has been processed by another service, for instance Azure OpenAI or other such voice based Large Language Models.
You can also control the playback of audio in the call when streaming back to Azure Communication Services, based on your logic or business flow. For example, when voice activity is detected and you want to stop the queued up audio, you can send a stop message via the WebSocket to stop the audio from playing in the call.
0 commit comments