Skip to content

Commit 257f3fb

Browse files
authored
Create java how-to guide for mute
Create java how-to guide for mute
1 parent 084acc4 commit 257f3fb

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: include file
3+
description: Java mute participant
4+
services: azure-communication-services
5+
author: Kunaal Punjabi
6+
ms.service: azure-communication-services
7+
ms.subservice: azure-communication-services
8+
ms.date: 03/19/2023
9+
ms.topic: include
10+
ms.topic: include file
11+
ms.author: kpunjabi
12+
---
13+
14+
## Prerequisites
15+
16+
- Azure account with an active subscription, for details see [Create an account for free.](https://azure.microsoft.com/free/)
17+
- Azure Communication Services resource. See [Create an Azure Communication Services resource](../../../quickstarts/create-communication-resource.md?tabs=windows&pivots=platform-azp)
18+
- Create a new web service application using the [Call Automation SDK](../../../quickstarts/call-automation/callflows-for-customer-interactions.md).
19+
- [Java Development Kit](/java/azure/jdk/?preserve-view=true&view=azure-java-stable) version 8 or above.
20+
- [Apache Maven](https://maven.apache.org/download.cgi).
21+
22+
## Create a new Java application
23+
24+
In your terminal or command window, navigate to the directory where you would like to create your Java application. Run the command below to generate the Java project from the maven-archetype-quickstart template.
25+
26+
```console
27+
mvn archetype:generate -DgroupId=com.communication.quickstart -DartifactId=communication-quickstart -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
28+
```
29+
30+
The command above creates a directory with the same name as `artifactId` argument. Under this directory, `src/main/java` directory contains the project source code, `src/test/java` directory contains the test source.
31+
32+
You'll notice that the 'generate' step created a directory with the same name as the artifactId. Under this directory, `src/main/java` directory contains source code, `src/test/java` directory contains tests, and `pom.xml` file is the project's Project Object Model, or POM.
33+
34+
Update your applications POM file to use Java 8 or higher.
35+
36+
```xml
37+
<properties>
38+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39+
<maven.compiler.source>1.8</maven.compiler.source>
40+
<maven.compiler.target>1.8</maven.compiler.target>
41+
</properties>
42+
```
43+
44+
## Configure Azure SDK Dev Feed
45+
46+
Since the Call Automation SDK version used in this quickstart isn't yet available in Maven Central Repository, we need to add an Azure Artifacts development feed, which contains the latest version of Call Automation SDK.
47+
48+
Add the [azure-sdk-for-java feed](https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-java) to your `pom.xml`. Follow the instructions after clicking the "Connect to Feed" button.
49+
50+
## Add package references
51+
52+
In your POM file, add the following reference for the project.
53+
54+
**azure-communication-callingserver**
55+
56+
Azure Communication Services Call Automation SDK package is retrieved from the Azure SDK Dev Feed configured above.
57+
58+
``` xml
59+
<dependency>
60+
<groupId>com.azure</groupId>
61+
<artifactId>azure-communication-callingserver</artifactId>
62+
<version>1.0.0-alpha.20220829.1</version>
63+
</dependency>
64+
```
65+
## Update App.java with code
66+
67+
In your editor of choice, open App.java file and update it with the code provided in [Update app.java with code](../../../quickstarts/call-automation/callflows-for-customer-interactions.md) section.
68+
69+
## Establish a call
70+
71+
By this point you should be familiar with starting calls, if you need to learn more about making a call, follow our [quickstart](../../../quickstarts/call-automation/callflows-for-customer-interactions.md). In this quickstart, we'll answer an incoming call.
72+
73+
74+
## Mute participant during a call
75+
76+
``` java
77+
var target = new CommunicationUserIdentifier(ACS_USER_ID);
78+
var callConnectionAsync = callAutomationClientAsync.getCallConnectionAsync(CALL_CONNECTION_ID);
79+
callConnectionAsync.muteParticipantsAsync(target).block();
80+
```
81+
82+
## Subscribing to events
83+

0 commit comments

Comments
 (0)