Skip to content

Commit a7c9b88

Browse files
authored
Merge pull request #279966 from huachuandeng/james/add_connectapi
add connect api to how to and remove not supporting room
2 parents c37bcf9 + 79fc9d5 commit a7c9b88

File tree

3 files changed

+97
-17
lines changed

3 files changed

+97
-17
lines changed

articles/communication-services/concepts/call-automation/call-automation.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ ms.author: askaur
1313

1414
Azure Communication Services Call Automation provides developers the ability to build server-based, intelligent call workflows, and call recording for voice and Public Switched Telephone Network(PSTN) channels. The SDKs, available in C#, Java, JavaScript and Python, use an action-event model to help you build personalized customer interactions. Your communication applications can listen to real-time call events and perform control plane actions (like answer, transfer, play audio, start recording, etc.) to steer and control calls based on your business logic.
1515

16-
> [!NOTE]
17-
> Call Automation currently doesn't support [Rooms](../rooms/room-concept.md) calls.
18-
1916
## Common use cases
2017

2118
Some of the common use cases that can be built using Call Automation include:
@@ -42,6 +39,7 @@ The following list presents the set of features that are currently available in
4239
| | Place new outbound call to one or more endpoints | ✔️ | ✔️ | ✔️ | ✔️ |
4340
| | Redirect* (forward) a call to one or more endpoints | ✔️ | ✔️ | ✔️ | ✔️ |
4441
| | Reject an incoming call | ✔️ | ✔️ | ✔️ | ✔️ |
42+
| | Connect to an ongoing call or Room | ✔️ | ✔️ | ✔️ | ✔️ |
4543
| Mid-call scenarios | Add one or more endpoints to an existing call | ✔️ | ✔️ | ✔️ | ✔️ |
4644
| | Cancel adding an endpoint to an existing call | ✔️ | ✔️ | ✔️ | ✔️ |
4745
| | Play Audio from an audio file | ✔️ | ✔️ | ✔️ | ✔️ |
@@ -92,6 +90,9 @@ Using the IncomingCall event from Event Grid, a call can be redirected to one or
9290
**Create Call**
9391
Create Call action can be used to place outbound calls to phone numbers and to other communication users. Use cases include your application placing outbound calls to proactively inform users about an outage or notify about an order update.
9492

93+
**Connect Call**
94+
Connect Call action can be used to connect to an ongoing call and take call actions on it. You can also use this action to connect and manage a Rooms call programmatically, like performing PSTN dial outs for Room using your service.
95+
9596
### Mid-call actions
9697

9798
These actions can be performed on the calls that are answered or placed using Call Automation SDKs. Each mid-call action has a corresponding success or failure web hook callback event.
@@ -159,17 +160,18 @@ The Call Automation events are sent to the web hook callback URI specified when
159160

160161
| Event | Description |
161162
| ----------------- | ------------ |
162-
| CallConnected | Your application’s call leg is connected (inbound or outbound) |
163-
| CallDisconnected | Your application’s call leg is disconnected |
164-
| CallTransferAccepted | Your application’s call leg has been transferred to another endpoint |
165-
| CallTransferFailed | The transfer of your application’s call leg failed |
166-
| AddParticipantSucceeded| Your application added a participant |
167-
| AddParticipantFailed | Your application was unable to add a participant |
168-
| CancelAddParticipantSucceeded| Your application canceled adding a participant |
169-
| CancelAddParticipantFailed | Your application was unable to cancel adding a participant |
170-
| RemoveParticipantSucceeded| Your application has successfully removed a participant from the call. |
171-
| RemoveParticipantFailed | Your application was unable to remove a participant from the call. |
172-
| ParticipantsUpdated | The status of a participant changed while your application’s call leg was connected to a call |
163+
| CallConnected | The call has successfully started (when using Answer or Create action) or your application has successfully connected to an ongoing call (when using Connect action)|
164+
| CallDisconnected | Your application has been disconnected from the call |
165+
| ConnectFailed | Your application failed to connect to a call (for connect call action only)|
166+
| CallTransferAccepted | Transfer action has successfully completed and the transferee is connected to the target participant |
167+
| CallTransferFailed | The transfer action has failed |
168+
| AddParticipantSucceeded| Your application has successfully added a participant to the call |
169+
| AddParticipantFailed | Your application was unable to add a participant to the call (due to an error or the participant didn't accept the invite |
170+
| CancelAddParticipantSucceeded| Your application canceled an AddParticipant request successfully (i.e. the participant was not added to the call) |
171+
| CancelAddParticipantFailed | Your application was unable to cancel an AddParticipant request (this could be because the request has already been processed) |
172+
| RemoveParticipantSucceeded| Your application has successfully removed a participant from the call |
173+
| RemoveParticipantFailed | Your application was unable to remove a participant from the call |
174+
| ParticipantsUpdated | The status of a participant changed while your application was connected to a call |
173175
| PlayCompleted | Your application successfully played the audio file provided |
174176
| PlayFailed | Your application failed to play audio |
175177
| PlayCanceled | The requested play action has been canceled |

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

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ Call Automation uses a REST API interface to receive requests for actions and pr
1818

1919
Call Automation supports various other actions to manage call media and recording that have separate guides.
2020

21-
> [!NOTE]
22-
> Call Automation currently doesn't support [Rooms](../../concepts/rooms/room-concept.md) calls.
23-
2421
As a prerequisite, we recommend you to read these articles to make the most of this guide:
2522

2623
1. Call Automation [concepts guide](../../concepts/call-automation/call-automation.md#call-actions) that describes the action-event programming model and event callbacks.
@@ -169,6 +166,87 @@ The response provides you with CallConnection object that you can use to take fu
169166
2. `ParticipantsUpdated` event that contains the latest list of participants in the call.
170167
![Sequence diagram for placing an outbound call.](media/make-call-flow.png)
171168

169+
## Connect to a call
170+
Connect action enables your service to establish a connection with an ongoing call and take actions on it. This is useful to manage a Rooms call or when client applications started a 1:1 or group call that Call automation isn't part of. Connection is established using the CallLocator property and can be of types: ServerCallLocator, GroupCallLocator, and RoomCallLocator. These IDs can be found when the call is originally established or a Room is created, and also published as part of [CallStarted](./../../../event-grid/communication-services-voice-video-events.md#microsoftcommunicationcallstarted) event.
171+
172+
To connect to any 1:1 or group call, use the ServerCallLocator. If you started a call using GroupCallId, you can also use the GroupCallLocator.
173+
### [csharp](#tab/csharp)
174+
175+
```csharp
176+
Uri callbackUri = new Uri("https://<myendpoint>/Events"); //the callback endpoint where you want to receive subsequent events
177+
CallLocator serverCallLocator = new ServerCallLocator("<ServerCallId>");
178+
ConnctCallResult response = await client.ConnectAsync(serverCallLocator, callbackUri);
179+
```
180+
181+
### [Java](#tab/java)
182+
183+
```java
184+
String callbackUri = "https://<myendpoint>/Events"; //the callback endpoint where you want to receive subsequent events
185+
CallLocator serverCallLocator = new ServerCallLocator("<ServerCallId>");
186+
ConnectCallResult response = client.connectCall(serverCallLocator, callbackUri).block();
187+
```
188+
189+
### [JavaScript](#tab/javascript)
190+
191+
```javascript
192+
const callbackUri = "https://<myendpoint>/Events"; // the callback endpoint where you want to receive subsequent events
193+
const serverCallLocator = { kind: "serverCallLocator", id: "<serverCallId>" };
194+
const response = await client.connectCall(serverCallLocator, callbackUri);
195+
```
196+
197+
### [Python](#tab/python)
198+
199+
```python
200+
callback_uri = "https://<myendpoint>/Events" # the callback endpoint where you want to receive subsequent events
201+
server_call_locator = ServerCallLocator("<server_call_id>")
202+
call_connection_properties = client.connect_call(call_locator=server_call_locator, callback_url=callback_uri)
203+
```
204+
205+
-----
206+
207+
To connect to a Rooms call, use RoomCallLocator which takes RoomId.
208+
### [csharp](#tab/csharp)
209+
210+
```csharp
211+
Uri callbackUri = new Uri("https://<myendpoint>/Events"); //the callback endpoint where you want to receive subsequent events
212+
CallLocator roomCallLocator = new RoomCallLocator("<RoomId>");
213+
ConnctCallResult response = await client.ConnectAsync(roomCallLocator, callbackUri);
214+
```
215+
216+
### [Java](#tab/java)
217+
218+
```java
219+
String callbackUri = "https://<myendpoint>/Events"; //the callback endpoint where you want to receive subsequent events
220+
CallLocator roomCallLocator = new RoomCallLocator("<RoomId>");
221+
ConnectCallResult response = client.connectCall(roomCallLocator, callbackUri).block();
222+
```
223+
224+
### [JavaScript](#tab/javascript)
225+
226+
```javascript
227+
const roomCallLocator = { kind: "roomCallLocator", id: "<RoomId>" };
228+
const callbackUri = "https://<myendpoint>/Events"; // the callback endpoint where you want to receive subsequent events
229+
const response = await client.connectCall(roomCallLocator, callbackUri);
230+
```
231+
232+
### [Python](#tab/python)
233+
234+
```python
235+
callback_uri = "https://<myendpoint>/Events" # the callback endpoint where you want to receive subsequent events
236+
room_call_locator = RoomCallLocator("<room_id>")
237+
call_connection_properties = client.connect_call(call_locator=room_call_locator, callback_url=callback_uri)
238+
```
239+
240+
-----
241+
242+
A successful response provides you with CallConnection object that you can use to take further actions on this call. Two events are published to the callback endpoint you provided earlier:
243+
1. `CallConnected` event notifying that you successfully connect to the call.
244+
2. `ParticipantsUpdated` event that contains the latest list of participants in the call.
245+
246+
At any point after a successful connection, if your service is disconnected from this call you will be notified via a CallDisconected event. Failure to connect to the call in the first place results in ConnectFailed event.
247+
248+
![Sequence diagram for connecting to call.](media/connect-call-flow.png)
249+
172250
## Answer an incoming call
173251

174252
Once you've subscribed to receive [incoming call notifications](../../concepts/call-automation/incoming-call-notification.md) to your resource, you will answer an incoming call. When answering a call, it's necessary to provide a callback url. Communication Services post all subsequent events about this call to that url.
15 KB
Loading

0 commit comments

Comments
 (0)