You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# How to control and steer calls with Call Automation
18
19
> [!IMPORTANT]
19
20
> This feature of Azure Communication Services is currently in public preview.
20
21
> 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
25
26
Call Automation supports various other actions to manage call media and recording that aren't included in this guide.
26
27
27
28
> [!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.
29
30
30
31
As a pre-requisite, we recommend you to read the below articles to make the most of this guide:
31
32
1. Call Automation [concepts guide](../../concepts/voice-video-calling/call-automation.md#call-actions) that describes the action-event programming model and event callbacks.
32
33
2. Learn about [user identifiers](../../concepts/identifiers.md#the-communicationidentifier-type) like CommunicationUserIdentifier and PhoneNumberIdentifier used in this guide.
33
34
34
35
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.
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.
46
48
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.
48
50
### [csharp](#tab/csharp)
49
51
```csharp
50
52
UricallBackUri=newUri("https://<myendpoint>/Events"); //the callback endpoint where you want to receive subsequent events
@@ -66,10 +68,11 @@ CreateCallOptions createCallOptions = new CreateCallOptions(callerIdentifier, ta
66
68
.setSourceCallerId("+18001234567"); // This is the ACS provisioned phone number for the caller
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:
70
73
1.`CallConnected` event notifying that the call has been established with the callee.
71
74
2.`ParticipantsUpdated` event that contains the latest list of participants in the call.
72
-

75
+

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:
97
101
1.`CallConnected` event notifying that the call has been established with the caller.
98
102
2.`ParticipantsUpdated` event that contains the latest list of participants in the call.
99
103
100
-

104
+

101
105
102
106
## Reject a call
103
107
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.
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.
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.
147
154
148
155
## Transfer a 1:1 call
149
156
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.
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.
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
-

181
-
187
+

182
188
183
189
## Add a participant to a call
184
190
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.
To add a Communication Services user, provide a CommunicationUserIdentifier instead of PhoneNumberIdentifier. Source caller ID isn't mandatory in this case.
203
210
204
211
AddParticipant will publish a `AddParticipantSucceeded` or `AddParticipantFailed` event, along with a `ParticipantUpdated` providing the latest list of participants in the call.
205
212
206
-

213
+

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
-

232
+

226
233
227
234
## Hang up on a call
228
235
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.
0 commit comments