Skip to content

Commit d73e2f9

Browse files
authored
Update audio-streaming-quickstart-csharp.md
update code snippets based on GA changes with enabledtmf tones too
1 parent 6827ce8 commit d73e2f9

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

articles/communication-services/how-tos/call-automation/includes/audio-streaming-quickstart-csharp.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ Enable automatic audio streaming when the call is established by setting the fla
3434
This setting ensures that audio streaming starts automatically as soon as the call is connected.
3535

3636
``` C#
37-
var mediaStreamingOptions = new MediaStreamingOptions(
38-
new Uri("wss://YOUR_WEBSOCKET_URL"),
39-
MediaStreamingContent.Audio,
40-
MediaStreamingAudioChannel.Mixed,
41-
startMediaStreaming: true) {
42-
EnableBidirectional = true,
43-
AudioFormat = AudioFormat.Pcm24KMono
44-
}
37+
MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(MediaStreamingAudioChannel.Unmixed);
38+
mediaStreamingOptions.TransportUri = new Uri(websocketUri);
39+
mediaStreamingOptions.EnableBidirectional = true;
40+
mediaStreamingOptions.AudioFormat = AudioFormat.Pcm24KMono;
41+
mediaStreamingOptions.EnableDtmfTones = true;
42+
4543
var options = new AnswerCallOptions(incomingCallContext, callbackUri) {
4644
MediaStreamingOptions = mediaStreamingOptions,
4745
};
@@ -56,14 +54,12 @@ When Azure Communication Services receives the URL for your WebSocket server, it
5654
To start media streaming during the call, you can use the API. To do so, set the `startMediaStreaming` parameter to `false` (which is the default), and later in the call, you can use the start API to enable media streaming.
5755

5856
``` C#
59-
var mediaStreamingOptions = new MediaStreamingOptions(
60-
new Uri("wss://<YOUR_WEBSOCKET_URL"),
61-
MediaStreamingContent.Audio,
62-
MediaStreamingAudioChannel.Mixed,
63-
startMediaStreaming: false) {
64-
EnableBidirectional = true,
65-
AudioFormat = AudioFormat.Pcm24KMono
66-
}
57+
MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions(MediaStreamingAudioChannel.Unmixed);
58+
mediaStreamingOptions.TransportUri = new Uri(websocketUri);
59+
mediaStreamingOptions.EnableBidirectional = true;
60+
mediaStreamingOptions.AudioFormat = AudioFormat.Pcm24KMono;
61+
mediaStreamingOptions.EnableDtmfTones = true;
62+
6763
var options = new AnswerCallOptions(incomingCallContext, callbackUri) {
6864
MediaStreamingOptions = mediaStreamingOptions,
6965
};
@@ -72,10 +68,11 @@ AnswerCallResult answerCallResult = await client.AnswerCallAsync(options);
7268

7369
Start media streaming via API call
7470
StartMediaStreamingOptions options = new StartMediaStreamingOptions() {
75-
OperationContext = "startMediaStreamingContext"
71+
OperationContext = "startMediaStreamingContext",
72+
OperationCallbackUri = eventCallbackUri
7673
};
7774

78-
await callMedia.StartMediaStreamingAsync();
75+
await callMedia.StartMediaStreamingAsync(options);
7976
```
8077

8178

@@ -86,10 +83,11 @@ To stop receiving audio streams during a call, you can use the **Stop streaming
8683

8784
``` C#
8885
StopMediaStreamingOptions options = new StopMediaStreamingOptions() {
89-
OperationContext = "stopMediaStreamingContext"
86+
OperationContext = "stopMediaStreamingContext",
87+
OperationCallbackUri = eventCallbackUri
9088
};
9189

92-
await callMedia.StopMediaStreamingAsync();
90+
await callMedia.StopMediaStreamingAsync(options);
9391
```
9492

9593
## Handling audio streams in your websocket server

0 commit comments

Comments
 (0)