Skip to content

Commit 3b2d8ab

Browse files
Merge pull request #259550 from valindrae/mid-call-actions-ga2
Mid call actions ga2
2 parents 260c45d + fd22692 commit 3b2d8ab

File tree

2 files changed

+65
-48
lines changed

2 files changed

+65
-48
lines changed

articles/communication-services/concepts/call-automation/azure-communication-services-azure-cognitive-services-integration.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ author: kunaal
66
ms.service: azure-communication-services
77
ms.subservice: call-automation
88
ms.topic: include
9-
ms.date: 08/17/2023
9+
ms.date: 11/27/2023
1010
ms.author: kpunjabi
1111
ms.custom: references_regions
1212
services: azure-communication-services
1313
---
1414

1515
# Connect Azure Communication Services with Azure AI services
1616

17-
[!INCLUDE [Public Preview Disclaimer](../../includes/public-preview-include-document.md)]
18-
19-
20-
Azure Communication Services Call Automation APIs provide developers the ability to steer and control the Azure Communication Services Telephony, VoIP or WebRTC calls using real-time event triggers to perform actions based on custom business logic specific to their domain. Within the Call Automation APIs developers can use simple AI powered APIs, which can be used to play personalized greeting messages, recognize conversational voice inputs to gather information on contextual questions to drive a more self-service model with customers, use sentiment analysis to improve customer service overall. These content specific APIs are orchestrated through **Azure Cognitive Services** with support for customization of AI models without developers needing to terminate media streams on their services and streaming back to Azure for AI functionality.
17+
Azure Communication Services Call Automation APIs provide developers the ability to steer and control the Azure Communication Services Telephony, VoIP or WebRTC calls using real-time event triggers to perform actions based on custom business logic specific to their domain. Within the Call Automation APIs developers can use simple AI powered APIs, which can be used to play personalized greeting messages, recognize conversational voice inputs to gather information on contextual questions to drive a more self-service model with customers, use sentiment analysis to improve customer service overall. These content specific APIs are orchestrated through **Azure AI Services** with support for customization of AI models without developers needing to terminate media streams on their services and streaming back to Azure for AI functionality.
2118

2219
All this is possible with one-click where enterprises can access a secure solution and link their models through the portal. Furthermore, developers and enterprises don't need to manage credentials. Connecting your Azure AI services uses managed identities to access user-owned resources. Developers can use managed identities to authenticate any resource that supports Microsoft Entra authentication.
2320

2421
BYO Azure AI services can be easily integrated into any application regardless of the programming language. When creating an Azure Resource in Azure portal, enable the BYO option and provide the URL to the Azure AI services. This simple experience allows developers to meet their needs, scale, and avoid investing time and resources into designing and maintaining a custom solution.
2522

2623
> [!NOTE]
27-
> This integration is only supported in limited regions for Azure AI services, for more information about which regions are supported please view the limitations section at the bottom of this document. This integration only supports Multi-service Cognitive Service resource, so we recommend if you're creating a new Azure Cognitive Service resource you create a Multi-service Cognitive Service resource or when you're connecting an existing resource confirm that it is a Multi-service Cognitive Service resource.
24+
> This integration is supported in limited regions for Azure AI services, for more information about which regions are supported please view the limitations section at the bottom of this document. This integration only supports Multi-service Cognitive Service resource, we recommend if you're creating a new Azure AI Service resource you create a Multi-service Cognitive Service resource or when you're connecting an existing resource confirm that it is a Multi-service Cognitive Service resource.
2825
2926
## Common use cases
3027

@@ -124,8 +121,17 @@ This integration between Azure Communication Services and Azure AI services is o
124121
- northcentralus
125122
- southcentralus
126123
- westcentralus
127-
- westeu
124+
- westeurope
128125
- uksouth
126+
- northeurope
127+
- southafricanorth
128+
- canadacentral
129+
- centralindia
130+
- eastasia
131+
- southeastasia
132+
- australiaeast
133+
- brazilsouth
134+
- uaenorth
129135

130136
## Next steps
131137
- Learn about [playing audio](../../concepts/call-automation/play-action.md) to callers using Text-to-Speech.

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

Lines changed: 52 additions & 41 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,19 +57,25 @@ 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
7072
List<DtmfTone> tones = Arrays.asList(DtmfTone.ONE, DtmfTone.TWO, DtmfTone.THREE, DtmfTone.POUND);
73+
SendDtmfTonesOptions options =new SendDtmfTonesOptions(tones, new PhoneNumberIdentifier(c2Target));
74+
options.setOperationContext("dtmfs-to-ivr");
7175
callAutomationClient.getCallConnectionAsync(callConnectionId)
72-
.getCallMediaAsync()
73-
.sendDtmfTonesWithResponse(tones, new PhoneNumberIdentifier(c2Target), "dtmfs-to-ivr")
74-
.block();
76+
.getCallMediaAsync()
77+
.sendDtmfTonesWithResponse(options)
78+
.block();
7579
```
7680
### [JavaScript](#tab/javascript)
7781
```javascript
@@ -169,10 +173,12 @@ await callAutomationClient.GetCallConnection(callConnectionId)
169173
```
170174
### [Java](#tab/java)
171175
```java
176+
ContinuousDtmfRecognitionOptions options =new ContinuousDtmfRecognitionOptions(new PhoneNumberIdentifier(c2Target));
177+
options.setOperationContext("dtmf-reco-on-c2");
172178
callAutomationClient.getCallConnectionAsync(callConnectionId)
173-
.getCallMediaAsync()
174-
.startContinuousDtmfRecognitionWithResponse(new PhoneNumberIdentifier(c2Target), "dtmf-reco-on-c2")
175-
.block();
179+
.getCallMediaAsync()
180+
.startContinuousDtmfRecognitionWithResponse(options)
181+
.block();
176182
```
177183
### [JavaScript](#tab/javascript)
178184
```javascript
@@ -204,16 +210,23 @@ When your application no longer wishes to receive DTMF tones from the participan
204210
Stop detecting DTMF tones sent by participant.
205211
### [csharp](#tab/csharp)
206212
```csharp
207-
await callAutomationClient.GetCallConnection(callConnectionId)
208-
.GetCallMedia()
209-
.StopContinuousDtmfRecognitionAsync(new PhoneNumberIdentifier(c2Target), "dtmf-reco-on-c2");
213+
var continuousDtmfRecognitionOptions =newContinuousDtmfRecognitionOptions(newPhoneNumberIdentifier(callerPhonenumber))
214+
{
215+
    OperationContext ="dtmf-reco-on-c2"
216+
};
217+
218+
var startContinuousDtmfRecognitionAsyncResult =awaitcallAutomationClient.GetCallConnection(callConnectionId)
219+
    .GetCallMedia()
220+
    .StartContinuousDtmfRecognitionAsync(continuousDtmfRecognitionOptions);
210221
```
211222
### [Java](#tab/java)
212223
```java
224+
ContinuousDtmfRecognitionOptions options =new ContinuousDtmfRecognitionOptions(new PhoneNumberIdentifier(c2Target));
225+
options.setOperationContext("dtmf-reco-on-c2");
213226
callAutomationClient.getCallConnectionAsync(callConnectionId)
214-
.getCallMediaAsync()
215-
.stopContinuousDtmfRecognitionWithResponse(new PhoneNumberIdentifier(c2Target), "dtmf-reco-on-c2")
216-
.block();
227+
.getCallMediaAsync()
228+
.stopContinuousDtmfRecognitionWithResponse(options)
229+
.block();
217230
```
218231
### [JavaScript](#tab/javascript)
219232
```javascript
@@ -242,40 +255,38 @@ Your application receives event updates when these actions either succeed or fai
242255
Example of how you can handle a DTMF tone successfully detected.
243256
### [csharp](#tab/csharp)
244257
``` csharp
245-
if (acsEvent is ContinuousDtmfRecognitionToneReceived continuousDtmfRecognitionToneReceived)
258+
if(acsEvent is ContinuousDtmfRecognitionToneReceivedcontinuousDtmfRecognitionToneReceived)
246259
{
247-
logger.LogInformation("Tone detected: sequenceId={sequenceId}, tone={tone}, context={context}",
248-
continuousDtmfRecognitionToneReceived.ToneInfo.SequenceId,
249-
continuousDtmfRecognitionToneReceived.ToneInfo.Tone,
250-
continuousDtmfRecognitionToneReceived.OperationContext);
260+
logger.LogInformation("Tone detected: sequenceId={sequenceId}, tone={tone}",
261+
continuousDtmfRecognitionToneReceived.SequenceId,
262+
        continuousDtmfRecognitionToneReceived.Tone);
251263
}
252264
```
253265
### [Java](#tab/java)
254266
``` java
255-
if (acsEvent instanceof ContinuousDtmfRecognitionToneReceived) {
256-
ContinuousDtmfRecognitionToneReceived event = (ContinuousDtmfRecognitionToneReceived) acsEvent;
257-
log.info("Tone detected: sequenceId=" + event.getToneInfo().getSequenceId()
258-
+ ", tone=" + event.getToneInfo().getTone().convertToString()
259-
+ ", context=" + event.getOperationContext());
267+
if (acsEventinstanceof ContinuousDtmfRecognitionToneReceived) {
268+
ContinuousDtmfRecognitionToneReceived event = (ContinuousDtmfRecognitionToneReceived) acsEvent;
269+
log.info("Tone detected: sequenceId=" + event.getSequenceId()
270+
+", tone=" + event.getTone().convertToString()
271+
+", context=" + event.getOperationContext());
260272
}
261273
```
262274
### [JavaScript](#tab/javascript)
263275
```javascript
264-
if (event.type === "Microsoft.Communication.ContinuousDtmfRecognitionToneReceived") {
265-
console.log("Tone detected: sequenceId=%s, tone=%s, context=%s",
266-
eventData.toneInfo.sequenceId,
267-
eventData.toneInfo.tone,
268-
eventData.operationContext);
269-
270-
}
276+
if (event.type === "Microsoft.Communication.ContinuousDtmfRecognitionToneReceived") {
277+
console.log("Tone detected: sequenceId=%s, tone=%s, context=%s",
278+
        eventData.sequenceId,
279+
        eventData.tone,
280+
eventData.operationContext);
281+
}
271282
```
272283
### [Python](#tab/python)
273284
```python
274-
if event.type == "Microsoft.Communication.ContinuousDtmfRecognitionToneReceived":
275-
app.logger.info("Tone detected: sequenceId=%s, tone=%s, context=%s",
276-
event.data['toneInfo']['sequenceId'],
277-
event.data['toneInfo']['tone'],
278-
event.data['operationContext'])
285+
if event.type == "Microsoft.Communication.ContinuousDtmfRecognitionToneReceived":
286+
app.logger.info("Tone detected: sequenceId=%s, tone=%s, context=%s",
287+
event.data['sequenceId'],
288+
                event.data['tone'],
289+
event.data['operationContext'])
279290
```
280291
-----
281292

0 commit comments

Comments
 (0)