Skip to content

Commit 2065b9c

Browse files
committed
EDGE-1027 Java sdk did not have example of adding a participant & updating subscriptions, now it does
1 parent 38dfc0a commit 2065b9c

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,35 @@
1414

1515
Add the following dependency to your `pom.xml` file
1616

17-
```
17+
```xml
18+
1819
<!-- https://mvnrepository.com/artifact/com.bandwidth.sdk/bandwidth-sdk -->
1920
<dependency>
2021
<groupId>com.bandwidth.sdk</groupId>
2122
<artifactId>bandwidth-sdk</artifactId>
2223
<version>{version}</version>
2324
</dependency>
25+
2426
```
2527

2628
### Initialize
2729

28-
```
30+
```java
31+
2932
BandwidthClient client = new BandwidthClient.Builder()
3033
.messagingBasicAuthCredentials("username", "password")
3134
.voiceBasicAuthCredentials("username", "password")
3235
.twoFactorAuthBasicAuthCredentials("username", "password")
3336
.webRtcBasicAuthCredentials("username", "password")
3437
.build();
3538
String accountId = "12345";
39+
3640
```
3741

3842
### Create A Phone Call
3943

40-
```
44+
```java
45+
4146
com.bandwidth.voice.controllers.APIController voiceController = client.getVoiceClient().getAPIController();
4247

4348
String to = "+15554443333";
@@ -53,11 +58,13 @@ body.setAnswerUrl(answerUrl);
5358

5459
ApiResponse<ApiCallResponse> createCallResponse = voiceController.createCall(accountId, body);
5560
System.out.println(createCallResponse.getResult().getCallId());
61+
5662
```
5763

5864
### Send A Text Message
5965

60-
```
66+
```java
67+
6168
String to = "+15554443333";
6269
ArrayList<String> toNumbers = new ArrayList<String>();
6370
toNumbers.add(to);
@@ -73,11 +80,13 @@ body.setApplicationId(applicationId);
7380

7481
ApiResponse<BandwidthMessage> createMessageResponse = messagingController.createMessage(accountId, body);
7582
System.out.println(createMessageResponse.getResult().getMessageId());
83+
7684
```
7785

7886
### Create BXML
7987

80-
```
88+
```java
89+
8190
SpeakSentence speakSentence = SpeakSentence.builder()
8291
.text("Hello world")
8392
.voice("susan")
@@ -89,11 +98,13 @@ String response = new Response()
8998
.add(speakSentence)
9099
.toBXML();
91100
System.out.println(response);
101+
92102
```
93103

94104
### Create A MFA Request
95105

96-
```
106+
```java
107+
97108
String to = "+15554443333";
98109
String from = "+15553334444";
99110
String applicationId = "3-a-c-b");
@@ -123,11 +134,13 @@ body.setExpirationTimeInMinutes(expirationTimeInMinutes);
123134

124135
ApiResponse<TwoFactorVerifyCodeResponse> response = mfaController.createVerifyTwoFactor(accountId, body);
125136
System.out.println(response.getResult().getValid());
137+
126138
```
127139

128140
### WebRtc Participant & Session Management
129141

130-
```
142+
```java
143+
131144
Session createSessionBody = new Session();
132145
createSessionBody.setTag("new-session");
133146

@@ -143,7 +156,11 @@ publishPermissions.add(PublishPermissionEnum.VIDEO);
143156
ApiResponse<AccountsParticipantsResponse> createParticipantResponse = webrtcController.createParticipant(accountId, createParticipantBody);
144157
String participantId = createParticipantResponse.getResult().getParticipant().getId();
145158

146-
webrtcController.addParticipantToSession(accountId, sessionId, participantId, null);
159+
List<ParticipantSubscriptions> participantSubscriptions = new ArrayList<>();
160+
participantSubscriptions.add(new ParticipantSubscription(participantId));
161+
162+
webrtcController.addParticipantToSession(accountId, sessionId, participantId, new Subscriptions(sessionId, participantSubscriptions));
163+
147164
```
148165

149166
## Supported Java Versions

0 commit comments

Comments
 (0)