Skip to content

Commit 6827ce8

Browse files
authored
Update audio-streaming-quickstart-js.md
update code snippets for JS with enableDTMF
1 parent f3cd370 commit 6827ce8

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,26 @@ 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
``` JS
37-
var mediaStreamingOptions = new MediaStreamingOptions(
38-
new Uri("wss://YOUR_WEBSOCKET_URL"),
39-
MediaStreamingContent.Audio,
40-
MediaStreamingAudioChannel.Mixed,
41-
startMediaStreaming: true)
42-
{
43-
EnableBidirectional = true,
44-
AudioFormat = AudioFormat.Pcm24KMono
45-
}
46-
var options = new AnswerCallOptions(incomingCallContext, callbackUri)
47-
{
48-
MediaStreamingOptions = mediaStreamingOptions,
37+
const mediaStreamingOptions = {
38+
transportUrl: "wss://YOUR_WEBSOCKET_URL",
39+
transportType: "websocket",
40+
contentType: "audio",
41+
audioChannelType: "mixed",
42+
startMediaStreaming: true,
43+
enableDtmfTones: true,
44+
enableBidirectional: true,
45+
audioFormat: "Pcm24KMono"
4946
};
5047

51-
AnswerCallResult answerCallResult = await client.AnswerCallAsync(options);
48+
const answerCallOptions = {
49+
mediaStreamingOptions: mediaStreamingOptions
50+
};
51+
52+
answerCallResult = await acsClient.answerCall(
53+
incomingCallContext,
54+
callbackUri,
55+
answerCallOptions
56+
);
5257
```
5358

5459
When Azure Communication Services receives the URL for your WebSocket server, it establishes a connection to it. Once the connection is successfully made, streaming is initiated.
@@ -58,11 +63,12 @@ To start media streaming during the call, you can use the API. To do so, set the
5863

5964
``` JS
6065
const mediaStreamingOptions: MediaStreamingOptions = {
61-
transportUrl: transportUrl,
66+
transportUrl: "wss://YOUR_WEBSOCKET_URL",
6267
transportType: "websocket",
6368
contentType: "audio",
6469
audioChannelType: "unmixed",
6570
startMediaStreaming: false,
71+
enableDtmfTones: true,
6672
enableBidirectional: true,
6773
audioFormat: "Pcm24KMono"
6874
}

0 commit comments

Comments
 (0)