Skip to content

Commit 1645c79

Browse files
authored
Update control-mid-call-media-actions.md
update code snippets for C# for GA
1 parent 3499440 commit 1645c79

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

articles/communication-services/how-tos/call-automation/control-mid-call-media-actions.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@ author: kunaal
66
ms.topic: how-to
77
ms.service: azure-communication-services
88
ms.subservice: call-automation
9-
ms.date: 08/09/2023
9+
ms.date: 11/16/2023
1010
ms.author: kpunjabi
1111
ms.custom: public_preview
1212
services: azure-communication-services
1313
---
1414

1515
# How to control mid-call media actions with Call Automation
1616

17-
[!INCLUDE [Public Preview Disclaimer](../../includes/public-preview-include-document.md)]
18-
1917
Call Automation uses a REST API interface to receive requests for actions and provide responses to notify whether the request was successfully submitted or not. Due to the asynchronous nature of calling, most actions have corresponding events that are triggered when the action completes successfully or fails. This guide covers the actions available to developers during calls, like Send DTMF and Continuous DTMF Recognition. Actions are accompanied with sample code on how to invoke the said action.
2018

2119
Call Automation supports various other actions to manage calls and recording that aren't included in this guide.
@@ -59,11 +57,15 @@ You can send DTMF tones to an external participant, which may be useful when you
5957
Send a list of DTMF tones to an external participant.
6058
### [csharp](#tab/csharp)
6159
```csharp
62-
var tones = new DtmfTone[] { DtmfTone.One, DtmfTone.Two, DtmfTone.Three, DtmfTone.Pound };
60+
var tones =new DtmfTone[] { DtmfTone.One, DtmfTone.Two, DtmfTone.Three, DtmfTone.Pound };
61+
var sendDtmfTonesOptions =newSendDtmfTonesOptions(tones, newPhoneNumberIdentifier(calleePhonenumber))
62+
{
63+
OperationContext ="dtmfs-to-ivr"
64+
};
6365

64-
await callAutomationClient.GetCallConnection(callConnectionId)
65-
.GetCallMedia()
66-
.SendDtmfTonesAsync(tones, new PhoneNumberIdentifier(c2Target), "dtmfs-to-ivr");
66+
var sendDtmfAsyncResult =awaitcallAutomationClient.GetCallConnection(callConnectionId)
67+
.GetCallMedia()
68+
        .SendDtmfTonesAsync(sendDtmfTonesOptions);
6769
```
6870
### [Java](#tab/java)
6971
```java
@@ -204,9 +206,16 @@ When your application no longer wishes to receive DTMF tones from the participan
204206
Stop detecting DTMF tones sent by participant.
205207
### [csharp](#tab/csharp)
206208
```csharp
207-
await callAutomationClient.GetCallConnection(callConnectionId)
208-
.GetCallMedia()
209-
.StopContinuousDtmfRecognitionAsync(new PhoneNumberIdentifier(c2Target), "dtmf-reco-on-c2");
209+
var continuousDtmfRecognitionOptions =newContinuousDtmfRecognitionOptions(newPhoneNumberIdentifier(callerPhonenumber))
210+
{
211+
    OperationContext ="dtmf-reco-on-c2"
212+
};
213+
214+
var startContinuousDtmfRecognitionAsyncResult =awaitcallAutomationClient.GetCallConnection(callConnectionId)
215+
216+
    .GetCallMedia()
217+
218+
    .StartContinuousDtmfRecognitionAsync(continuousDtmfRecognitionOptions);
210219
```
211220
### [Java](#tab/java)
212221
```java
@@ -242,12 +251,11 @@ Your application receives event updates when these actions either succeed or fai
242251
Example of how you can handle a DTMF tone successfully detected.
243252
### [csharp](#tab/csharp)
244253
``` csharp
245-
if (acsEvent is ContinuousDtmfRecognitionToneReceived continuousDtmfRecognitionToneReceived)
254+
if(acsEvent is ContinuousDtmfRecognitionToneReceivedcontinuousDtmfRecognitionToneReceived)
246255
{
247-
logger.LogInformation("Tone detected: sequenceId={sequenceId}, tone={tone}, context={context}",
248-
continuousDtmfRecognitionToneReceived.ToneInfo.SequenceId,
249-
continuousDtmfRecognitionToneReceived.ToneInfo.Tone,
250-
continuousDtmfRecognitionToneReceived.OperationContext);
256+
logger.LogInformation("Tone detected: sequenceId={sequenceId}, tone={tone}",
257+
continuousDtmfRecognitionToneReceived.SequenceId,
258+
        continuousDtmfRecognitionToneReceived.Tone);
251259
}
252260
```
253261
### [Java](#tab/java)

0 commit comments

Comments
 (0)