@@ -9,7 +9,8 @@ ms.subservice: call-automation
9
9
ms.topic : include
10
10
ms.date : 03/28/2023
11
11
ms.author : visho
12
- ms.custom : private_preview
12
+ ms.custom : devx-track-extended-java, devx-track-js, devx-track-python
13
+ zone_pivot_groups : acs-js-csharp-java-python
13
14
services : azure-communication-services
14
15
---
15
16
@@ -78,7 +79,8 @@ Response:
78
79
## Step 3: Add a Teams user to an existing Communication Services call controlled by Call Automation APIs
79
80
You need to complete the prerequisite step and have a web service app to control a Communication Services call. Using the callConnection object, add a participant to the call.
80
81
81
- ## [ csharp] ( #tab/csharp )
82
+ ::: zone pivot="programming-language-csharp"
83
+
82
84
``` csharp
83
85
CallAutomationClient client = new CallAutomationClient ('<Connection_String>' );
84
86
AnswerCallResult answer = await client .AnswerCallAsync (incomingCallContext , new Uri ('<Callback_URI>' ));
@@ -89,24 +91,46 @@ await answer.Value.CallConnection.AddParticipantAsync(
89
91
});
90
92
```
91
93
92
- ## [ Java] ( #tab/java )
94
+ ::: zone-end
95
+
96
+ ::: zone pivot="programming-language-java"
93
97
94
98
``` java
95
- CallAutomationClient client = new CallAutomationClientBuilder (). connectionString(" <resource_connection_string>" ). buildClient();
99
+ CallAutomationClient client = new CallAutomationClientBuilder (). connectionString(" <resource_connection_string>" ). buildClient();
100
+ AnswerCallResult answer = client. answerCall(incomingCallContext, " <Callback_URI>" ));
101
+ answer. getCallConnection(). addParticipant(
102
+ new CallInvite (new MicrosoftTeamsUserIdentifier (" <Teams_User_Guid>" ))
103
+ .setSourceDisplayName(" Jack (Contoso Tech Support)" ));
96
104
```
97
105
98
- ## [ JavaScript] ( #tab/javascript )
106
+ ::: zone-end
107
+
108
+ ::: zone pivot="programming-language-javascript"
99
109
100
- ``` javascript
110
+ ``` typescript
101
111
const client = new CallAutomationClient (" <resource_connection_string>" );
112
+ const answer = await client .answerCall (incomingCallContext , " <Callback_URI>" ));
113
+ answer .callConnection .addParticipant ({
114
+ targetParticipant: { microsoftTeamsUserId: " <Teams_User_Guid>" },
115
+ sourceDisplayName: " Jack (Contoso Tech Support)"
116
+ });
102
117
```
103
118
104
- ## [ Python] ( #tab/python )
119
+ ::: zone-end
120
+
121
+ ::: zone pivot="programming-language-python"
105
122
106
123
``` python
107
124
call_automation_client = CallAutomationClient.from_connection_string(" <resource_connection_string>" )
125
+ answer = call_automation_client.answer_call(incoming_call_context = incoming_call_context, callback_url = " <Callback_URI>" )
126
+ call_connection_client = call_automation_client.get_call_connection(answer.call_connection_id)
127
+ call_connection_client.add_participant(target_participant = CallInvite(
128
+ target = MicrosoftTeamsUserIdentifier(user_id = " <USER_ID>" ),
129
+ source_display_name = " Jack (Contoso Tech Support)" ))
108
130
```
109
131
132
+ ::: zone-end
133
+
110
134
-----
111
135
112
136
On the Microsoft Teams desktop client, Jack's call will be sent to the Microsoft Teams user through an incoming call toast notification.
@@ -117,57 +141,75 @@ After the Microsoft Teams user accepts the call, the in-call experience for the
117
141
![ Screenshot of Microsoft Teams user accepting the call and entering the in-call experience for the Microsoft Teams user.] ( ./media/active-call-teams-user.png )
118
142
119
143
## Step 4: Remove a Teams user from an existing Communication Services call controlled by Call Automation APIs
120
- ## [ csharp] ( #tab/csharp )
144
+
145
+ ::: zone pivot="programming-language-csharp"
121
146
122
147
``` csharp
123
148
await answer .Value .CallConnection .RemoveParticipantAsync (new MicrosoftTeamsUserIdentifier ('<Teams_User_Guid>' ));
124
149
```
125
150
126
- ## [ Java ] ( #tab/java )
151
+ ::: zone-end
127
152
128
- ``` java
153
+ ::: zone pivot="programming-language- java"
129
154
155
+ ``` java
156
+ answer. getCallConnection(). removeParticipant(new MicrosoftTeamsUserIdentifier (" <Teams_User_Guid>" ));
130
157
```
131
158
132
- ## [ JavaScript ] ( #tab/javascript )
159
+ ::: zone-end
133
160
134
- ``` javascript
161
+ ::: zone pivot="programming-language- javascript"
135
162
163
+ ``` typescript
164
+ answer .callConnection .removeParticipant ({ microsoftTeamsUserId: " <Teams_User_Guid>" });
136
165
```
137
166
138
- ## [ Python ] ( #tab/python )
167
+ ::: zone-end
139
168
140
- ``` python
169
+ ::: zone pivot="programming-language- python"
141
170
171
+ ``` python
172
+ call_connection_client.remove_participant(target_participant = MicrosoftTeamsUserIdentifier(user_id = " <USER_ID>" ))
142
173
```
143
174
175
+ ::: zone-end
176
+
144
177
-----
145
178
146
179
### Optional feature: Transfer to a Teams user from an existing Communication Services call controlled by Call Automation APIs
147
- ## [ csharp] ( #tab/csharp )
180
+
181
+ ::: zone pivot="programming-language-csharp"
148
182
149
183
``` csharp
150
- await answer .Value .CallConnection .TransferCallToParticipantAsync (new CallInvite ( new MicrosoftTeamsUserIdentifier ('<Teams_User_Guid>' ) ));
184
+ await answer .Value .CallConnection .TransferCallToParticipantAsync (new MicrosoftTeamsUserIdentifier ('<Teams_User_Guid>' ));
151
185
```
152
186
153
- ## [ Java ] ( #tab/java )
187
+ ::: zone-end
154
188
155
- ``` java
189
+ ::: zone pivot="programming-language- java"
156
190
191
+ ``` java
192
+ answer. getCallConnection(). transferCallToParticipant(new MicrosoftTeamsUserIdentifier (" <Teams_User_Guid>" ));
157
193
```
158
194
159
- ## [ JavaScript ] ( #tab/javascript )
195
+ ::: zone-end
160
196
161
- ``` javascript
197
+ ::: zone pivot="programming-language- javascript"
162
198
199
+ ``` typescript
200
+ answer .callConnection .transferCallToParticipant ({ microsoftTeamsUserId: " <Teams_User_Guid>" });
163
201
```
164
202
165
- ## [ Python ] ( #tab/python )
203
+ ::: zone-end
166
204
167
- ``` python
205
+ ::: zone pivot="programming-language- python"
168
206
207
+ ``` python
208
+ call_connection_client.transfer_call_to_participant(target_participant = MicrosoftTeamsUserIdentifier(user_id = " <USER_ID>" ))
169
209
```
170
210
211
+ ::: zone-end
212
+
171
213
-----
172
214
173
215
### How to tell if your Tenant isn't enabled for this preview?
0 commit comments