Skip to content

Commit cd6c876

Browse files
Merge pull request #271120 from williamzhao87/williamzhao/update-ca-quickstart
Update CA quickstart with Teams add participant
2 parents 30ef911 + 537838f commit cd6c876

5 files changed

+73
-16
lines changed

articles/communication-services/how-tos/call-automation/teams-interop-call-automation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In this quickstart, we use the Azure Communication Services Call Automation APIs
2323
## Prerequisites
2424

2525
- An Azure account with an active subscription.
26-
- A Microsoft Teams phone license and a Teams tenant with administrative privileges. Teams phone license is a must in order to use this feature, learn more about Teams licenses [here](https://www.microsoft.com/en-us/microsoft-teams/compare-microsoft-teams-bundle-options). Administrative privileges are required to authorize Communication Services resource to call Teams users, explained later in Step 1.
26+
- A Microsoft Teams phone license and a Teams tenant with administrative privileges. Teams phone license is a must in order to use this feature, learn more about Teams licenses [here](https://www.microsoft.com/microsoft-teams/compare-microsoft-teams-bundle-options). Administrative privileges are required to authorize Communication Services resource to call Teams users, explained later in Step 1.
2727
- A deployed [Communication Service resource](../../quickstarts/create-communication-resource.md) and valid connection string found by selecting Keys in left side menu on Azure portal.
2828
- [Acquire a PSTN phone number from the Communication Service resource](../../quickstarts/telephony/get-phone-number.md). Note the phone number you acquired to use in this quickstart.
2929
- An Azure Event Grid subscription to receive the `IncomingCall` event.
@@ -222,4 +222,4 @@ If you want to clean up and remove a Communication Services subscription, you ca
222222
- Learn more about [Call Automation](../../concepts/call-automation/call-automation.md) and its features.
223223
- Learn more about capabilities of [Teams Interoperability support with Azure Communication Services Call Automation](../../concepts/call-automation/call-automation-teams-interop.md)
224224
- Learn about [Play action](../../concepts/call-automation/play-Action.md) to play audio in a call.
225-
- Learn how to build a [call workflow](../../quickstarts/call-automation/callflows-for-customer-interactions.md) for a customer support scenario.
225+
- Learn how to build a [call workflow](../../quickstarts/call-automation/callflows-for-customer-interactions.md) for a customer support scenario.

articles/communication-services/quickstarts/call-automation/includes/quickstart-make-an-outbound-call-using-callautomation-csharp.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ ms.custom: mode-other
1919
- Create and host an Azure Dev Tunnel. Instructions [here](/azure/developer/dev-tunnels/get-started).
2020
- Create and connect [a Multi-service Azure AI services to your Azure Communication Services resource](../../../concepts/call-automation/azure-communication-services-azure-cognitive-services-integration.md).
2121
- Create a [custom subdomain](../../../../ai-services/cognitive-services-custom-subdomains.md) for your Azure AI services resource.
22+
- (Optional) A Microsoft Teams user with a phone license. Teams phone license is required to add Teams users to the call. Learn more about Teams licenses [here](https://www.microsoft.com/microsoft-teams/compare-microsoft-teams-bundle-options).
2223

2324
## Sample code
24-
Download or clone quickstart sample code from [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/CallAutomation_OutboundCalling).
2525

26+
Download or clone quickstart sample code from [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/CallAutomation_OutboundCalling).
2627

2728
Navigate to `CallAutomation_OutboundCalling` folder and open the solution in a code editor.
2829

@@ -45,6 +46,7 @@ Next update your `Program.cs` file with the following values:
4546
- `acsPhonenumber`: update this field with the Azure Communication Services phone number you have acquired. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
4647
- `targetPhonenumber`: update field with the phone number you would like your application to call. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
4748
- `cognitiveServiceEndpoint`: update field with your Azure AI services endpoint.
49+
- `targetTeamsUserId`: (Optional) update field with the Microsoft Teams user Id you would like to add to the call. See [Use Graph API to get Teams user Id](../../../how-tos/call-automation/teams-interop-call-automation.md#step-2-use-the-graph-api-to-get-microsoft-entra-object-id-for-teams-users-and-optionally-check-their-presence).
4850

4951
```csharp
5052
// Your ACS resource connection string
@@ -60,7 +62,10 @@ var targetPhonenumber = "<TARGET_PHONE_NUMBER>";
6062
var callbackUriHost = "<CALLBACK_URI_HOST_WITH_PROTOCOL>";
6163

6264
// Your cognitive service endpoint
63-
var cognitiveServiceEndpoint = "<COGNITIVE_SERVICE_ENDPOINT>";
65+
var cognitiveServiceEndpoint = "<COGNITIVE_SERVICE_ENDPOINT>";
66+
67+
// (Optional) User Id of the target teams user you want to receive the call.
68+
var targetTeamsUserId = "<TARGET_TEAMS_USER_ID>";
6469
```
6570

6671
## Make an outbound call
@@ -99,6 +104,18 @@ app.MapPost("/api/callbacks", async (CloudEvent[] cloudEvents, ILogger < Program
99104
});
100105
```
101106

107+
## (Optional) Add a Microsoft Teams user to the call
108+
109+
You can add a Microsoft Teams user to the call using the `AddParticipantAsync` method with a `MicrosoftTeamsUserIdentifier` and the Teams user's Id. You first need to complete the prerequisite step [Authorization for your Azure Communication Services Resource to enable calling to Microsoft Teams users](../../../how-tos/call-automation/teams-interop-call-automation.md#step-1-authorization-for-your-azure-communication-services-resource-to-enable-calling-to-microsoft-teams-users). Optionally, you can also pass in a `SourceDisplayName` to control the text displayed in the toast notification for the Teams user.
110+
111+
```csharp
112+
await callConnection.AddParticipantAsync(
113+
new CallInvite(new MicrosoftTeamsUserIdentifier(targetTeamsUserId))
114+
{
115+
SourceDisplayName = "Jack (Contoso Tech Support)"
116+
});
117+
```
118+
102119
## Start recording a call
103120

104121
The Call Automation service also enables the capability to start recording and store recordings of voice and video calls. You can learn more about the various capabilities in the Call Recording APIs [here](../../voice-video-calling/get-started-call-recording.md).
@@ -109,9 +126,9 @@ var recordingResult = await callAutomationClient.GetCallRecording().StartAsync(n
109126
recordingId = recordingResult.Value.RecordingId;
110127
```
111128

112-
## Play welcome message and recognize
129+
## Play welcome message and recognize
113130

114-
Using the `TextSource`, you can provide the service with the text you want synthesized and used for your welcome message. The Azure Communication Services Call Automation service plays this message upon the `CallConnected` event.
131+
Using the `TextSource`, you can provide the service with the text you want synthesized and used for your welcome message. The Azure Communication Services Call Automation service plays this message upon the `CallConnected` event.
115132

116133
Next, we pass the text into the `CallMediaRecognizeChoiceOptions` and then call `StartRecognizingAsync`. This allows your application to recognize the option the caller chooses.
117134

@@ -192,8 +209,8 @@ async Task HandlePlayAsync(CallMedia callConnectionMedia, string text) {
192209
};
193210
await callConnectionMedia.PlayToAllAsync(GoodbyePlaySource);
194211
}
195-
196212
```
213+
197214
## Hang up and stop recording
198215

199216
Finally, when we detect a condition that makes sense for us to terminate the call, we can use the `HangUpAsync` method to hang up the call.
@@ -220,5 +237,3 @@ dotnet run
220237
# [Visual Studio](#tab/visual-studio)
221238

222239
Press Ctrl+F5 to run without the debugger.
223-
224-

articles/communication-services/quickstarts/call-automation/includes/quickstart-make-an-outbound-call-using-callautomation-java.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ ms.custom: mode-other
2121
- Create a [custom subdomain](../../../../ai-services/cognitive-services-custom-subdomains.md) for your Azure AI services resource.
2222
- [Java Development Kit (JDK) version 11 or above](/azure/developer/java/fundamentals/java-jdk-install).
2323
- [Apache Maven](https://maven.apache.org/download.cgi).
24+
- (Optional) A Microsoft Teams user with a phone license. Teams phone license is required to add Teams users to the call. Learn more about Teams licenses [here](https://www.microsoft.com/microsoft-teams/compare-microsoft-teams-bundle-options).
2425

2526
## Sample code
26-
Download or clone quickstart sample code from [GitHub](https://github.com/Azure-Samples/communication-services-java-quickstarts/tree/main/CallAutomation_OutboundCalling).
27+
28+
Download or clone quickstart sample code from [GitHub](https://github.com/Azure-Samples/communication-services-java-quickstarts/tree/main/CallAutomation_OutboundCalling).
2729

2830
Navigate to `CallAutomation_OutboundCalling` folder and open the solution in a code editor.
2931

@@ -46,14 +48,16 @@ Then open the `application.yml` file in the `/resources` folder to configure the
4648
- `callerphonenumber`: update this field with the Azure Communication Services phone number you have acquired. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
4749
- `targetphonenumber`: update field with the phone number you would like your application to call. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
4850
- `cognitiveServiceEndpoint`: update field with your Azure AI services endpoint.
51+
- `targetTeamsUserId`: (Optional) update field with the Microsoft Teams user Id you would like to add to the call. See [Use Graph API to get Teams user Id](../../../how-tos/call-automation/teams-interop-call-automation.md#step-2-use-the-graph-api-to-get-microsoft-entra-object-id-for-teams-users-and-optionally-check-their-presence).
4952

5053
```yaml
5154
acs:
5255
  connectionstring: <YOUR ACS CONNECTION STRING>
5356
  basecallbackuri: <YOUR DEV TUNNEL ENDPOINT>
5457
  callerphonenumber: <YOUR ACS PHONE NUMBER ex. "+1425XXXAAAA">
5558
  targetphonenumber: <YOUR TARGET PHONE NUMBER ex. "+1425XXXAAAA">
56-
  cognitiveServiceEndpoint: <YOUR COGNITIVE SERVICE ENDPOINT>
59+
  cognitiveServiceEndpoint: <YOUR COGNITIVE SERVICE ENDPOINT>
60+
targetTeamsUserId: <(OPTIONAL) YOUR TARGET TEAMS USER ID ex. "ab01bc12-d457-4995-a27b-c405ecfe4870">
5761
```
5862
5963
@@ -68,7 +72,17 @@ CallInvite callInvite = new CallInvite(target, caller);
6872
CreateCallOptions createCallOptions = new CreateCallOptions(callInvite, appConfig.getCallBackUri());
6973
CallIntelligenceOptions callIntelligenceOptions = new CallIntelligenceOptions().setCognitiveServicesEndpoint(appConfig.getCognitiveServiceEndpoint());
7074
createCallOptions = createCallOptions.setCallIntelligenceOptions(callIntelligenceOptions);
71-
Response < CreateCallResult > result = client.createCallWithResponse(createCallOptions, Context.NONE);
75+
Response<CreateCallResult> result = client.createCallWithResponse(createCallOptions, Context.NONE);
76+
```
77+
78+
## (Optional) Add a Microsoft Teams user to the call
79+
80+
You can add a Microsoft Teams user to the call using the `addParticipant` method with a `MicrosoftTeamsUserIdentifier` and the Teams user's Id. You first need to complete the prerequisite step [Authorization for your Azure Communication Services Resource to enable calling to Microsoft Teams users](../../../how-tos/call-automation/teams-interop-call-automation.md#step-1-authorization-for-your-azure-communication-services-resource-to-enable-calling-to-microsoft-teams-users). Optionally, you can also pass in a `SourceDisplayName` to control the text displayed in the toast notification for the Teams user.
81+
82+
```java
83+
client.getCallConnection(callConnectionId).addParticipant(
84+
new CallInvite(new MicrosoftTeamsUserIdentifier(targetTeamsUserId))
85+
.setSourceDisplayName("Jack (Contoso Tech Support)"));
7286
```
7387

7488
## Start recording a call
@@ -90,7 +104,6 @@ Response<RecordingStateResult> response = client.getCallRecording()
90104
recordingId = response.getValue().getRecordingId();
91105
```
92106

93-
94107
## Respond to calling events
95108

96109
Earlier in our application, we registered the `basecallbackuri` to the Call Automation Service. The URI indicates endpoint the service will use to notify us of calling events that happen. We can then iterate through the events and detect specific events our application wants to understand. In the code be below we respond to the `CallConnected` event.

articles/communication-services/quickstarts/call-automation/includes/quickstart-make-an-outbound-call-using-callautomation-node.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ ms.custom: mode-other
2121
- Create a [custom subdomain](../../../../ai-services/cognitive-services-custom-subdomains.md) for your Azure AI services resource.
2222
- [Node.js](https://nodejs.org/en/) LTS installation.
2323
- [Visual Studio Code](https://code.visualstudio.com/download) installed.
24+
- (Optional) A Microsoft Teams user with a phone license. Teams phone license is required to add Teams users to the call. Learn more about Teams licenses [here](https://www.microsoft.com/microsoft-teams/compare-microsoft-teams-bundle-options).
2425

2526
## Sample code
27+
2628
Download or clone quickstart sample code from [GitHub](https://github.com/Azure-Samples/communication-services-javascript-quickstarts/tree/main/CallAutomation_OutboundCalling).
2729

2830
Navigate to `CallAutomation_OutboundCalling` folder and open the solution in a code editor.
@@ -54,16 +56,17 @@ Then update your `.env` file with following values:
5456
- `TARGET_PHONE_NUMBER`: update field with the phone number you would like your application to call. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
5557
- `ACS_RESOURCE_PHONE_NUMBER`: update this field with the Azure Communication Services phone number you have acquired. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
5658
- `COGNITIVE_SERVICES_ENDPOINT`: update field with your Azure AI services endpoint.
59+
- `TARGET_TEAMS_USER_ID`: (Optional) update field with the Microsoft Teams user Id you would like to add to the call. See [Use Graph API to get Teams user Id](../../../how-tos/call-automation/teams-interop-call-automation.md#step-2-use-the-graph-api-to-get-microsoft-entra-object-id-for-teams-users-and-optionally-check-their-presence).
5760

5861
```dosini
5962
CONNECTION_STRING="<YOUR_CONNECTION_STRING>"
6063
ACS_RESOURCE_PHONE_NUMBER ="<YOUR_ACS_NUMBER>"
6164
TARGET_PHONE_NUMBER="<+1XXXXXXXXXX>"
6265
CALLBACK_URI="<VS_TUNNEL_URL>"
63-
COGNITIVE_SERVICES_ENDPOINT="<COGNITIVE_SERVICEs_ENDPOINT>"
66+
COGNITIVE_SERVICES_ENDPOINT="<COGNITIVE_SERVICES_ENDPOINT>"
67+
TARGET_TEAMS_USER_ID="<TARGET_TEAMS_USER_ID>"
6468
```
6569

66-
6770
## Make an outbound call and play media
6871

6972
To make the outbound call from Azure Communication Services, you use the phone number you provided to the environment. Ensure that the phone number is in the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
@@ -86,6 +89,17 @@ console.log("Placing outbound call...");
8689
acsClient.createCall(callInvite, process.env.CALLBACK_URI + "/api/callbacks", options);
8790
```
8891

92+
## (Optional) Add a Microsoft Teams user to the call
93+
94+
You can add a Microsoft Teams user to the call using the `addParticipant` method with the `microsoftTeamsUserId` property. You first need to complete the prerequisite step [Authorization for your Azure Communication Services Resource to enable calling to Microsoft Teams users](../../../how-tos/call-automation/teams-interop-call-automation.md#step-1-authorization-for-your-azure-communication-services-resource-to-enable-calling-to-microsoft-teams-users). Optionally, you can also pass in a `sourceDisplayName` to control the text displayed in the toast notification for the Teams user.
95+
96+
```typescript
97+
await acsClient.getCallConnection(callConnectionId).addParticipant({
98+
targetParticipant: { microsoftTeamsUserId: TARGET_TEAMS_USER_ID },
99+
sourceDisplayName: "Jack (Contoso Tech Support)"
100+
});
101+
```
102+
89103
## Start recording a call
90104

91105
The Call Automation service also enables the capability to start recording and store recordings of voice and video calls. You can learn more about the various capabilities in the Call Recording APIs [here](../../voice-video-calling/get-started-call-recording.md).

articles/communication-services/quickstarts/call-automation/includes/quickstart-make-an-outbound-call-using-callautomation-python.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ ms.custom: mode-other
2020
- Create and connect [a Multi-service Azure AI services to your Azure Communication Services resource](../../../concepts/call-automation/azure-communication-services-azure-cognitive-services-integration.md).
2121
- Create a [custom subdomain](../../../../ai-services/cognitive-services-custom-subdomains.md) for your Azure AI services resource.
2222
- [Python](https://www.python.org/downloads/) 3.7+.
23+
- (Optional) A Microsoft Teams user with a phone license. Teams phone license is required to add Teams users to the call. Learn more about Teams licenses [here](https://www.microsoft.com/microsoft-teams/compare-microsoft-teams-bundle-options).
2324

2425
## Sample code
26+
2527
Download or clone quickstart sample code from [GitHub](https://github.com/Azure-Samples/communication-services-python-quickstarts/tree/main/callautomation-outboundcalling).
2628

2729
Navigate to `CallAutomation_OutboundCalling` folder and open the solution in a code editor.
@@ -53,7 +55,7 @@ Then update your `main.py` file with the following values:
5355
- `TARGET_PHONE_NUMBER`: update field with the phone number you would like your application to call. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
5456
- `ACS_PHONE_NUMBER`: update this field with the Azure Communication Services phone number you have acquired. This phone number should use the [E164](https://en.wikipedia.org/wiki/E.164) phone number format (e.g +18881234567)
5557
- `COGNITIVE_SERVICES_ENDPOINT`: update field with your Azure AI services endpoint.
56-
58+
- `TARGET_TEAMS_USER_ID`: (Optional) update field with the Microsoft Teams user Id you would like to add to the call. See [Use Graph API to get Teams user Id](../../../how-tos/call-automation/teams-interop-call-automation.md#step-2-use-the-graph-api-to-get-microsoft-entra-object-id-for-teams-users-and-optionally-check-their-presence).
5759

5860
```python
5961
# Your ACS resource connection string
@@ -71,6 +73,9 @@ CALLBACK_EVENTS_URI = CALLBACK_URI_HOST + "/api/callbacks"
7173

7274
#Your Cognitive service endpoint
7375
COGNITIVE_SERVICES_ENDPOINT = "<COGNITIVE_SERVICES_ENDPOINT>"
76+
77+
#(OPTIONAL) Your target Microsoft Teams user Id ex. "ab01bc12-d457-4995-a27b-c405ecfe4870"
78+
TARGET_TEAMS_USER_ID = "<TARGET_TEAMS_USER_ID>"
7479
```
7580

7681
## Make an outbound call
@@ -90,6 +95,16 @@ call_connection_properties.call_connection_id)
9095
return redirect("/")
9196
```
9297

98+
## (Optional) Add a Microsoft Teams user to the call
99+
100+
You can add a Microsoft Teams user to the call using the `add_participant` method with a `MicrosoftTeamsUserIdentifier` and the Teams user's Id. You first need to complete the prerequisite step [Authorization for your Azure Communication Services Resource to enable calling to Microsoft Teams users](../../../how-tos/call-automation/teams-interop-call-automation.md#step-1-authorization-for-your-azure-communication-services-resource-to-enable-calling-to-microsoft-teams-users). Optionally, you can also pass in a `source_display_name` to control the text displayed in the toast notification for the Teams user.
101+
102+
```python
103+
call_connection_client.add_participant(target_participant = CallInvite(
104+
target = MicrosoftTeamsUserIdentifier(user_id=TARGET_TEAMS_USER_ID),
105+
source_display_name = "Jack (Contoso Tech Support)"))
106+
```
107+
93108
## Start recording a call
94109

95110
The Call Automation service also enables the capability to start recording and store recordings of voice and video calls. You can learn more about the various capabilities in the Call Recording APIs [here](../../voice-video-calling/get-started-call-recording.md).

0 commit comments

Comments
 (0)