1414
1515Add 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+
2932BandwidthClient client = new BandwidthClient .Builder ()
3033 .messagingBasicAuthCredentials(" username" , " password" )
3134 .voiceBasicAuthCredentials(" username" , " password" )
3235 .twoFactorAuthBasicAuthCredentials(" username" , " password" )
3336 .webRtcBasicAuthCredentials(" username" , " password" )
3437 .build();
3538String accountId = " 12345" ;
39+
3640```
3741
3842### Create A Phone Call
3943
40- ```
44+ ``` java
45+
4146com.bandwidth.voice.controllers. APIController voiceController = client. getVoiceClient(). getAPIController();
4247
4348String to = " +15554443333" ;
@@ -53,11 +58,13 @@ body.setAnswerUrl(answerUrl);
5358
5459ApiResponse<ApiCallResponse > createCallResponse = voiceController. createCall(accountId, body);
5560System . out. println(createCallResponse. getResult(). getCallId());
61+
5662```
5763
5864### Send A Text Message
5965
60- ```
66+ ``` java
67+
6168String to = " +15554443333" ;
6269ArrayList<String > toNumbers = new ArrayList<String > ();
6370toNumbers. add(to);
@@ -73,11 +80,13 @@ body.setApplicationId(applicationId);
7380
7481ApiResponse<BandwidthMessage > createMessageResponse = messagingController. createMessage(accountId, body);
7582System . out. println(createMessageResponse. getResult(). getMessageId());
83+
7684```
7785
7886### Create BXML
7987
80- ```
88+ ``` java
89+
8190SpeakSentence speakSentence = SpeakSentence . builder()
8291 .text(" Hello world" )
8392 .voice(" susan" )
@@ -89,11 +98,13 @@ String response = new Response()
8998 .add(speakSentence)
9099 .toBXML();
91100System . out. println(response);
101+
92102```
93103
94104### Create A MFA Request
95105
96- ```
106+ ``` java
107+
97108String to = " +15554443333" ;
98109String from = " +15553334444" ;
99110String applicationId = " 3-a-c-b" );
@@ -123,11 +134,13 @@ body.setExpirationTimeInMinutes(expirationTimeInMinutes);
123134
124135ApiResponse<TwoFactorVerifyCodeResponse > response = mfaController. createVerifyTwoFactor(accountId, body);
125136System . out. println(response. getResult(). getValid());
137+
126138```
127139
128140### WebRtc Participant & Session Management
129141
130- ```
142+ ``` java
143+
131144Session createSessionBody = new Session ();
132145createSessionBody. setTag(" new-session" );
133146
@@ -143,7 +156,11 @@ publishPermissions.add(PublishPermissionEnum.VIDEO);
143156ApiResponse<AccountsParticipantsResponse > createParticipantResponse = webrtcController. createParticipant(accountId, createParticipantBody);
144157String 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