Skip to content

Commit f6cd864

Browse files
committed
fix build errors
1 parent 5255dac commit f6cd864

File tree

1 file changed

+51
-40
lines changed

1 file changed

+51
-40
lines changed
Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
2-
title: Azure Communication Services Call Automation how-to for call controls and actions
2+
title: Azure Communication Services Call Automation how-to for managing calls with Call Automation
33
titleSuffix: An Azure Communication Services how-to document
44
description: Provides a how-to guide on using call actions to steer and manage a call with Call Automation.
55
author: ashwinder
66

7+
ms.topic: how-to
78
ms.service: azure-communication-services
89
ms.subservice: call-automation
910
ms.date: 11/03/2022
@@ -14,7 +15,7 @@ services: azure-communication-services
1415
zone_pivot_groups: acs-csharp-java
1516
---
1617

17-
# How to control and steer calls
18+
# How to control and steer calls with Call Automation
1819
> [!IMPORTANT]
1920
> This feature of Azure Communication Services is currently in public preview.
2021
> Preview APIs and SDKs are provided without a service-level agreement, and are not recommended for production workloads. Certain features might not be supported or might have constrained capabilities.
@@ -25,26 +26,27 @@ Call Automation uses a REST API interface to receive requests for actions and pr
2526
Call Automation supports various other actions to manage call media and recording that aren't included in this guide.
2627

2728
> [!NOTE]
28-
> Call Automation currently doesnt interoperate with Microsoft Teams. Actions like making, redirecting a call to a Teams user or adding them to a call using Call Automation isnt supported.
29+
> Call Automation currently doesn't interoperate with Microsoft Teams. Actions like making, redirecting a call to a Teams user or adding them to a call using Call Automation isn't supported.
2930
3031
As a pre-requisite, we recommend you to read the below articles to make the most of this guide:
3132
1. Call Automation [concepts guide](../../concepts/voice-video-calling/call-automation.md#call-actions) that describes the action-event programming model and event callbacks.
3233
2. Learn about [user identifiers](../../concepts/identifiers.md#the-communicationidentifier-type) like CommunicationUserIdentifier and PhoneNumberIdentifier used in this guide.
3334

3435
For all the code samples, `client` is CallAutomationClient object that can be created as shown and `callConnection` is the CallConnection object obtained from Answer or CreateCall response.
35-
### [csharp](#tab/csharp)
36+
## [csharp](#tab/csharp)
3637
```csharp
3738
var client = new CallAutomationClient("<resource_connection_string>");
3839
```
39-
### [Java](#tab/java)
40+
## [Java](#tab/java)
4041
```java
4142
CallAutomationClient client = new CallAutomationClientBuilder().connectionString("<resource_connection_string>").buildClient();
4243
```
44+
-----
4345

4446
## Make an outbound call
4547
You can place a 1:1 or group call to a communication user or phone number (public or Communication Services owned number). Below sample makes an outbound call from your service application to a phone number.
4648
callerIdentifier is used by Call Automation as your application's identity when making an outbound a call. When calling a PSTN endpoint, you also need to provide a phone number that will be used as the source caller ID and shown in the call notification to the target PSTN endpoint.
47-
To place a call to a Communication Services user, you will need to provide a CommunicationUserIdentifier object instead of PhoneNumberIdentifier.
49+
To place a call to a Communication Services user, you'll need to provide a CommunicationUserIdentifier object instead of PhoneNumberIdentifier.
4850
### [csharp](#tab/csharp)
4951
```csharp
5052
Uri callBackUri = new Uri("https://<myendpoint>/Events"); //the callback endpoint where you want to receive subsequent events
@@ -66,10 +68,11 @@ CreateCallOptions createCallOptions = new CreateCallOptions(callerIdentifier, ta
6668
.setSourceCallerId("+18001234567"); // This is the ACS provisioned phone number for the caller
6769
Response<CreateCallResult> response = client.createCallWithResponse(createCallOptions).block();
6870
```
71+
-----
6972
The response provides you with CallConnection object that you can use to take further actions on this call once it's connected. Once the call is answered, two events will be published to the callback endpoint you provided earlier:
7073
1. `CallConnected` event notifying that the call has been established with the callee.
7174
2. `ParticipantsUpdated` event that contains the latest list of participants in the call.
72-
![Sequence diagram for answering an incoming call](media/make-call-flow.png)
75+
![Sequence diagram for placing an outbound call.](media/make-call-flow.png)
7376

7477

7578
## Answer an incoming call
@@ -87,102 +90,105 @@ CallConnection callConnection = answerResponse.CallConnection;
8790
### [Java](#tab/java)
8891

8992
```java
90-
String incomingCallContext = "<IncomingCallContext_From_IncomingCall_Event>";
93+
String incomingCallContext = "<IncomingCallContext_From_IncomingCall_Event>";
9194
String callbackUri = "https://<myendpoint>/Events";
9295

9396
AnswerCallOptions answerCallOptions = new AnswerCallOptions(incomingCallContext, callbackUri);
9497
Response<AnswerCallResult> response = client.answerCallWithResponse(answerCallOptions).block();
9598
```
99+
-----
96100
The response provides you with CallConnection object that you can use to take further actions on this call once it's connected. Once the call is answered, two events will be published to the callback endpoint you provided earlier:
97101
1. `CallConnected` event notifying that the call has been established with the caller.
98102
2. `ParticipantsUpdated` event that contains the latest list of participants in the call.
99103

100-
![Sequence diagram for answering an incoming call](media/answer-flow.png)
104+
![Sequence diagram for answering an incoming call.](media/answer-flow.png)
101105

102106
## Reject a call
103107
You can choose to reject an incoming call as shown below. You can provide a reject reason: none, busy or forbidden. If nothing is provided, none is chosen by default.
104-
### [csharp](#tab/csharp)
108+
# [csharp](#tab/csharp)
105109
```csharp
106110
string incomingCallContext = "<IncomingCallContext_From_IncomingCall_Event>";
107111
var rejectOption = new RejectCallOptions(incomingCallContext);
108112
rejectOption.CallRejectReason = CallRejectReason.Forbidden;
109113
_ = await client.RejectCallAsync(rejectOption);
110114
```
111-
### [Java](#tab/java)
115+
# [Java](#tab/java)
112116

113117
```java
114118
String incomingCallContext = "<IncomingCallContext_From_IncomingCall_Event>";
115119
RejectCallOptions rejectCallOptions = new RejectCallOptions(incomingCallContext)
116120
.setCallRejectReason(CallRejectReason.BUSY);
117121
Response<Void> response = client.rejectCallWithResponse(rejectCallOptions).block();
118122
```
123+
-----
119124
No events are published for reject action.
120125

121126
## Redirect a call
122127
You can choose to redirect an incoming call to one or more endpoints without answering it. Redirecting a call will remove your application's ability to control the call using Call Automation.
123-
### [csharp](#tab/csharp)
128+
# [csharp](#tab/csharp)
124129
```csharp
125130
string incomingCallContext = "<IncomingCallContext_From_IncomingCall_Event>";
126-
var target = new CommunicationUserIdentifier("<userid_of_target>"); //user id looks like 8:a1b1c1-...
131+
var target = new CommunicationUserIdentifier("<user_id_of_target>"); //user id looks like 8:a1b1c1-...
127132
var redirectOption = new RedirectCallOptions(incomingCallContext, target);
128133
_ = await client.RedirectCallAsync(redirectOption);
129134
```
130-
### [Java](#tab/java)
135+
# [Java](#tab/java)
131136
```java
132137
String incomingCallContext = "<IncomingCallContext_From_IncomingCall_Event>";
133-
CommunicationIdentifier target = new CommunicationUserIdentifier("<userid_of_target>"); //user id looks like 8:a1b1c1-...
138+
CommunicationIdentifier target = new CommunicationUserIdentifier("<user_id_of_target>"); //user id looks like 8:a1b1c1-...
134139
RedirectCallOptions redirectCallOptions = new RedirectCallOptions(incomingCallContext, target);
135140
Response<Void> response = client.redirectCallWithResponse(redirectCallOptions).block();
136141
```
142+
-----
137143
To redirect the call to a phone number, set the target to be PhoneNumberIdentifier.
138-
### [csharp](#tab/csharp)
144+
# [csharp](#tab/csharp)
139145
```csharp
140146
var target = new PhoneNumberIdentifier("+16041234567");
141147
```
142-
### [Java](#tab/java)
148+
# [Java](#tab/java)
143149
```java
144150
CommunicationIdentifier target = new PhoneNumberIdentifier("+18001234567");
145151
```
152+
-----
146153
No events are published for redirect. If the target is a Communication Services user or a phone number owned by your resource, it will generate a new IncomingCall event with 'to' field set to the target you specified.
147154

148155
## Transfer a 1:1 call
149156
When your application answers a call or places an outbound call to an endpoint, that endpoint can be transferred to another destination endpoint. Transferring a 1:1 call will remove your application from the call and hence remove its ability to control the call using Call Automation.
150-
### [csharp](#tab/csharp)
157+
# [csharp](#tab/csharp)
151158
```csharp
152159
var transferDestination = new CommunicationUserIdentifier("<user_id>");
153160
var transferOption = new TransferToParticipantOptions(transferDestination);
154161
TransferCallToParticipantResult result = await callConnection.TransferCallToParticipantAsync(transferOption);
155162
```
156-
### [Java](#tab/java)
157-
163+
# [Java](#tab/java)
158164
```java
159165
CommunicationIdentifier transferDestination = new CommunicationUserIdentifier("<user_id>");
160166
TransferToParticipantCallOptions options = new TransferToParticipantCallOptions(transferDestination);
161167
Response<TransferCallResult> transferResponse = callConnectionAsync.transferToParticipantCallWithResponse(options).block();
162168
```
169+
-----
163170
When transferring to a phone number, it's mandatory to provide a source caller ID. This ID serves as the identity of your application(the source) for the destination endpoint.
164-
### [csharp](#tab/csharp)
171+
# [csharp](#tab/csharp)
165172
```csharp
166173
var transferDestination = new PhoneNumberIdentifier("+16041234567");
167174
var transferOption = new TransferToParticipantOptions(transferDestination);
168175
transferOption.SourceCallerId = new PhoneNumberIdentifier("+16044561234");
169176
TransferCallToParticipantResult result = await callConnection.TransferCallToParticipantAsync(transferOption);
170177
```
171-
### [Java](#tab/java)
172-
178+
# [Java](#tab/java)
173179
```java
174180
CommunicationIdentifier transferDestination = new PhoneNumberIdentifier("+16471234567");
175181
TransferToParticipantCallOptions options = new TransferToParticipantCallOptions(transferDestination)
176182
.setSourceCallerId(new PhoneNumberIdentifier("+18001234567"));
177183
Response<TransferCallResult> transferResponse = callConnectionAsync.transferToParticipantCallWithResponse(options).block();
178184
```
185+
-----
179186
The below sequence diagram shows the expected flow when your application places an outbound 1:1 call and then transfers it to another endpoint.
180-
![Sequence diagram for answering an incoming call](media/transfer-flow.png)
181-
187+
![Sequence diagram for placing a 1:1 call and then transferring it.](media/transfer-flow.png)
182188

183189
## Add a participant to a call
184190
You can add one or more participants (Communication Services users or phone numbers) to an existing call. When adding a phone number, it's mandatory to provide source caller ID. This caller ID will be shown on call notification to the participant being added.
185-
### [csharp](#tab/csharp)
191+
# [csharp](#tab/csharp)
186192
```csharp
187193
var addThisPerson = new PhoneNumberIdentifier("+16041234567");
188194
var listOfPersonToBeAdded = new List<CommunicationIdentifier>();
@@ -191,78 +197,83 @@ var addParticipantsOption = new AddParticipantsOptions(listOfPersonToBeAdded);
191197
addParticipantsOption.SourceCallerId = new PhoneNumberIdentifier("+16044561234");
192198
AddParticipantsResult result = await callConnection.AddParticipantsAsync(addParticipantsOption);
193199
```
194-
### [Java](#tab/java)
200+
# [Java](#tab/java)
195201
```java
196202
CommunicationIdentifier target = new PhoneNumberIdentifier("+16041234567");
197203
List<CommunicationIdentifier> targets = new ArrayList<>(Arrays.asList(target));
198204
AddParticipantsOptions addParticipantsOptions = new AddParticipantsOptions(targets)
199205
.setSourceCallerId(new PhoneNumberIdentifier("+18001234567"));
200206
Response<AddParticipantsResult> addParticipantsResultResponse = callConnectionAsync.addParticipantsWithResponse(addParticipantsOptions).block();
201207
```
208+
-----
202209
To add a Communication Services user, provide a CommunicationUserIdentifier instead of PhoneNumberIdentifier. Source caller ID isn't mandatory in this case.
203210

204211
AddParticipant will publish a `AddParticipantSucceeded` or `AddParticipantFailed` event, along with a `ParticipantUpdated` providing the latest list of participants in the call.
205212

206-
![Sequence diagram for answering an incoming call](media/add-participant-flow.png)
213+
![Sequence diagram for adding a participant to the call.](media/add-participant-flow.png)
207214

208215
## Remove a participant from a call
209-
### [csharp](#tab/csharp)
216+
# [csharp](#tab/csharp)
210217
```csharp
211218
var removeThisUser = new CommunicationUserIdentifier("<user_id>");
212219
var listOfParticipantsToBeRemoved = new List<CommunicationIdentifier>();
213220
listOfParticipantsToBeRemoved.Add(removeThisUser);
214221
var removeOption = new RemoveParticipantsOptions(listOfParticipantsToBeRemoved);
215222
RemoveParticipantsResult result = await callConnection.RemoveParticipantsAsync(removeOption);
216223
```
217-
### [Java](#tab/java)
224+
# [Java](#tab/java)
218225
```java
219226
CommunicationIdentifier removeThisUser = new CommunicationUserIdentifier("<user_id>");
220227
RemoveParticipantsOptions removeParticipantsOptions = new RemoveParticipantsOptions(new ArrayList<>(Arrays.asList(removeThisUser)));
221228
Response<RemoveParticipantsResult> removeParticipantsResultResponse = callConnectionAsync.removeParticipantsWithResponse(removeParticipantsOptions).block();
222229
```
223-
230+
-----
224231
RemoveParticipant only generates `ParticipantUpdated` event describing the latest list of participants in the call. The removed participant is excluded if remove operation was successful.
225-
![Sequence diagram for answering an incoming call](media/remove-participant-flow.png)
232+
![Sequence diagram for removing a participant from the call.](media/remove-participant-flow.png)
226233

227234
## Hang up on a call
228235
Hang Up action can be used to remove your application from the call or to terminate a group call by setting forEveryone parameter to true. For a 1:1 call, hang up will terminate the call with the other participant by default.
229236

230-
### [csharp](#tab/csharp)
237+
# [csharp](#tab/csharp)
231238
```csharp
232239
_ = await callConnection.HangUpAsync(true);
233240
```
234-
### [Java](#tab/java)
241+
# [Java](#tab/java)
235242
```java
236243
Response<Void> response1 = callConnectionAsync.hangUpWithResponse(new HangUpOptions(true)).block();
237244
```
245+
-----
238246
CallDisconnected event is published once the hangUp action has completed successfully.
239247

240248
## Get information about a call participant
241-
### [csharp](#tab/csharp)
249+
# [csharp](#tab/csharp)
242250
```csharp
243251
CallParticipant participantInfo = await callConnection.GetParticipantAsync("<user_id>")
244252
```
245-
### [Java](#tab/java)
253+
# [Java](#tab/java)
246254
```java
247255
CallParticipant participantInfo = callConnection.getParticipant("<user_id>").block();
248256
```
257+
-----
249258

250259
## Get information about all call participants
251-
### [csharp](#tab/csharp)
260+
# [csharp](#tab/csharp)
252261
```csharp
253262
List<CallParticipant> participantList = (await callConnection.GetParticipantsAsync()).Value.ToList();
254263
```
255-
### [Java](#tab/java)
264+
# [Java](#tab/java)
256265
```java
257266
List<CallParticipant> participantsInfo = Objects.requireNonNull(callConnection.listParticipants().block()).getValues();
258267
```
268+
-----
259269

260270
## Get latest info about a call
261-
### [csharp](#tab/csharp)
271+
# [csharp](#tab/csharp)
262272
```csharp
263273
CallConnectionProperties thisCallsProperties = callConnection.GetCallConnectionProperties();
264274
```
265-
### [Java](#tab/java)
275+
# [Java](#tab/java)
266276
```java
267277
CallConnectionProperties thisCallsProperties = callConnection.getCallProperties().block();
268278
```
279+
-----

0 commit comments

Comments
 (0)