Skip to content

Commit 4297481

Browse files
Merge pull request #92 from Bandwidth/SWI-2187
SWI-2187 Add support for Transcription Language Detection
2 parents 54ad45d + aedb1ef commit 4297481

File tree

5 files changed

+618
-447
lines changed

5 files changed

+618
-447
lines changed

src/main/java/com/bandwidth/voice/bxml/verbs/Record.java

Lines changed: 73 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class Record implements Verb {
1717
public static final String TYPE_NAME = "Record";
1818

1919
/**
20-
* <i>(optional)</i> A boolean value. If true, the recording will be submitted for transcription upon completion. Defaults to false.
20+
* <i>(optional)</i> A boolean value. If true, the recording will be submitted
21+
* for transcription upon completion. Defaults to false.
2122
*/
2223
@XmlAttribute
2324
private boolean transcribe;
@@ -37,37 +38,43 @@ public class Record implements Verb {
3738
private URI transcriptionAvailableUrl;
3839

3940
/**
40-
* <i>(optional)</i> The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default Value is POST.
41+
* <i>(optional)</i> The HTTP method to use for the request to
42+
* transcriptionAvailableUrl. GET or POST. Default Value is POST.
4143
*/
4244
@XmlAttribute
4345
private Method transcriptionAvailableMethod;
4446

4547
/**
46-
* <i>(optional)</i> URL to send the Record Complete event to once it has ended. Accepts BXML.
48+
* <i>(optional)</i> URL to send the Record Complete event to once it has ended.
49+
* Accepts BXML.
4750
*/
4851
@XmlAttribute
4952
private URI recordCompleteUrl;
5053

5154
/**
52-
* <i>(optional)</i> The HTTP method to use for the request to recordCompleteUrl. GET or POST. Default Value is POST.
55+
* <i>(optional)</i> The HTTP method to use for the request to
56+
* recordCompleteUrl. GET or POST. Default Value is POST.
5357
*/
5458
@XmlAttribute
5559
private Method recordCompleteMethod;
5660

5761
/**
58-
* <i>(optional)</i> URL to send the Record Complete event to once it has ended. Accepts BXML.
62+
* <i>(optional)</i> URL to send the Record Complete event to once it has ended.
63+
* Accepts BXML.
5964
*/
6065
@XmlAttribute
6166
private URI recordingAvailableUrl;
6267

6368
/**
64-
* <i>(optional)</i> The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default Value is POST.
69+
* <i>(optional)</i> The HTTP method to use for the request to
70+
* recordingAvailableUrl. GET or POST. Default Value is POST.
6571
*/
6672
@XmlAttribute
6773
private Method recordingAvailableMethod;
6874

6975
/**
70-
* <i>(optional)</i> A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared.
76+
* <i>(optional)</i> A custom string that will be sent with this and all future
77+
* callbacks unless overwritten by a future tag attribute or cleared.
7178
* <br/>
7279
* May be cleared by setting tag=""
7380
* <br/>
@@ -77,36 +84,42 @@ public class Record implements Verb {
7784
private String tag;
7885

7986
/**
80-
* <i>(optional)</i> The username to send in the HTTP request to recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https).
87+
* <i>(optional)</i> The username to send in the HTTP request to
88+
* recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be
89+
* TLS-encrypted (i.e., https).
8190
*/
8291
@XmlAttribute
8392
protected String username;
8493

8594
/**
86-
* <i>(optional)</i> The password to send in the HTTP request to recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https).
95+
* <i>(optional)</i> The password to send in the HTTP request to
96+
* recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be
97+
* TLS-encrypted (i.e., https).
8798
*/
8899
@XmlAttribute
89100
protected String password;
90101

91102
/**
92-
* <i>(optional)</i> When pressed, this digit will terminate the recording. Default value is “#”.
103+
* <i>(optional)</i> When pressed, this digit will terminate the recording.
104+
* Default value is “#”.
93105
*/
94106
@XmlAttribute
95107
protected String terminatingDigits;
96108

97109
/**
98-
* <i>(optional)</i> Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60.
110+
* <i>(optional)</i> Maximum length of recording (in seconds). Max 10800 (3
111+
* hours). Default value is 60.
99112
*/
100113
@XmlAttribute
101114
protected Integer maxDuration;
102115

103116
/**
104-
* <i>(optional)</i> The audio format that the recording will be saved as: mp3 or wav. Default value is wav.
117+
* <i>(optional)</i> The audio format that the recording will be saved as: mp3
118+
* or wav. Default value is wav.
105119
*/
106120
@XmlAttribute
107121
protected String fileFormat;
108122

109-
110123
@XmlAttribute
111124
protected String fallbackUsername;
112125

@@ -119,114 +132,135 @@ public class Record implements Verb {
119132
@XmlAttribute
120133
protected Method recordCompleteFallbackMethod;
121134

135+
/**
136+
* <i>(optional)</i> A boolean value to indicate that the recording may not be
137+
* in English, and the transcription service will need to detect the dominant
138+
* language the recording is in and transcribe accordingly.
139+
* Current supported languages are English, French, and Spanish.
140+
*/
141+
@XmlAttribute
142+
protected Boolean detectLanguage;
122143

123144
public static class RecordBuilder {
124145

125146
/**
126147
* <b>(required)</b> URL to send the transcriptionAvailable event to.
127148
*/
128-
public RecordBuilder transcriptionAvailableUrl(URI uri ){
149+
public RecordBuilder transcriptionAvailableUrl(URI uri) {
129150
this.transcriptionAvailableUrl = uri;
130151
return this;
131152
}
132153

133154
/**
134155
* <b>(required)</b> URL to send the transcriptionAvailable event to.
135156
*/
136-
public RecordBuilder transcriptionAvailableUrl(String uri){
157+
public RecordBuilder transcriptionAvailableUrl(String uri) {
137158
return transcriptionAvailableUrl(URI.create(uri));
138159
}
139160

140-
public RecordBuilder recordCompleteFallbackUrl(URI uri ){
161+
public RecordBuilder recordCompleteFallbackUrl(URI uri) {
141162
this.recordCompleteFallbackUrl = uri;
142163
return this;
143164
}
144165

145-
public RecordBuilder recordCompleteFallbackUrl(String uri){
166+
public RecordBuilder recordCompleteFallbackUrl(String uri) {
146167
return recordCompleteFallbackUrl(URI.create(uri));
147168
}
148169

149170
/**
150-
* <i>(optional)</i> The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default Value is POST.
171+
* <i>(optional)</i> The HTTP method to use for the request to
172+
* transcriptionAvailableUrl. GET or POST. Default Value is POST.
151173
*/
152-
public RecordBuilder transcriptionAvailableMethod(Method method){
174+
public RecordBuilder transcriptionAvailableMethod(Method method) {
153175
this.transcriptionAvailableMethod = method;
154176
return this;
155177
}
156178

157179
/**
158-
* <i>(optional)</i> The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default Value is POST. Converts String to Method using Method.fromValue(method)
180+
* <i>(optional)</i> The HTTP method to use for the request to
181+
* transcriptionAvailableUrl. GET or POST. Default Value is POST. Converts
182+
* String to Method using Method.fromValue(method)
159183
*/
160-
public RecordBuilder transcriptionAvailableMethod(String method){
184+
public RecordBuilder transcriptionAvailableMethod(String method) {
161185
return transcriptionAvailableMethod(Method.fromValue(method));
162186
}
163187

164-
public RecordBuilder recordCompleteFallbackMethod(Method method){
188+
public RecordBuilder recordCompleteFallbackMethod(Method method) {
165189
this.recordCompleteFallbackMethod = method;
166190
return this;
167191
}
168192

169-
public RecordBuilder recordCompleteFallbackMethod(String method){
193+
public RecordBuilder recordCompleteFallbackMethod(String method) {
170194
return recordCompleteFallbackMethod(Method.fromValue(method));
171195
}
172196

173197
/**
174-
* <b>(required)</b> URL to send the Record Complete event to once it has ended. Accepts BXML.
198+
* <b>(required)</b> URL to send the Record Complete event to once it has ended.
199+
* Accepts BXML.
175200
*/
176-
public RecordBuilder recordCompleteUrl(URI uri ){
201+
public RecordBuilder recordCompleteUrl(URI uri) {
177202
this.recordCompleteUrl = uri;
178203
return this;
179204
}
180205

181206
/**
182-
* <b>(required)</b> URL to request new BXML from. A Record event will be sent to this endpoint. Converts to URI using URI.create(url)
207+
* <b>(required)</b> URL to request new BXML from. A Record event will be sent
208+
* to this endpoint. Converts to URI using URI.create(url)
183209
*/
184-
public RecordBuilder recordCompleteUrl(String uri){
210+
public RecordBuilder recordCompleteUrl(String uri) {
185211
return recordCompleteUrl(URI.create(uri));
186212
}
187213

188214
/**
189-
* <i>(optional)</i> The HTTP method to use for the request to recordCompleteUrl. GET or POST. Default Value is POST.
215+
* <i>(optional)</i> The HTTP method to use for the request to
216+
* recordCompleteUrl. GET or POST. Default Value is POST.
190217
*/
191-
public RecordBuilder recordCompleteMethod(Method method){
218+
public RecordBuilder recordCompleteMethod(Method method) {
192219
this.recordCompleteMethod = method;
193220
return this;
194221
}
195222

196223
/**
197-
* <i>(optional)</i> The HTTP method to use for the request to recordCompleteUrl. GET or POST. Default Value is POST. Converts String to Method using Method.fromValue(method)
224+
* <i>(optional)</i> The HTTP method to use for the request to
225+
* recordCompleteUrl. GET or POST. Default Value is POST. Converts String to
226+
* Method using Method.fromValue(method)
198227
*/
199-
public RecordBuilder recordCompleteMethod(String method){
228+
public RecordBuilder recordCompleteMethod(String method) {
200229
return recordCompleteMethod(Method.fromValue(method));
201230
}
202231

203232
/**
204-
* <b>(required)</b> URL to send the Recording Available event to once it has been processed. Does not accept BXML.
233+
* <b>(required)</b> URL to send the Recording Available event to once it has
234+
* been processed. Does not accept BXML.
205235
*/
206-
public RecordBuilder recordingAvailableUrl(URI uri ){
236+
public RecordBuilder recordingAvailableUrl(URI uri) {
207237
this.recordingAvailableUrl = uri;
208238
return this;
209239
}
210240

211241
/**
212-
* <b>(required)</b> URL to send the Recording Available event to once it has been processed. Does not accept BXML.
242+
* <b>(required)</b> URL to send the Recording Available event to once it has
243+
* been processed. Does not accept BXML.
213244
*/
214-
public RecordBuilder recordingAvailableUrl(String uri){
245+
public RecordBuilder recordingAvailableUrl(String uri) {
215246
return recordingAvailableUrl(URI.create(uri));
216247
}
217248

218249
/**
219-
* <i>(optional)</i> The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default Value is POST.
250+
* <i>(optional)</i> The HTTP method to use for the request to
251+
* recordingAvailableUrl. GET or POST. Default Value is POST.
220252
*/
221-
public RecordBuilder recordingAvailableMethod(Method method){
253+
public RecordBuilder recordingAvailableMethod(Method method) {
222254
this.recordingAvailableMethod = method;
223255
return this;
224256
}
225257

226258
/**
227-
* <i>(optional)</i> The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default Value is POST. Converts String to Method using Method.fromValue(method)
259+
* <i>(optional)</i> The HTTP method to use for the request to
260+
* recordingAvailableUrl. GET or POST. Default Value is POST. Converts String to
261+
* Method using Method.fromValue(method)
228262
*/
229-
public RecordBuilder recordingAvailableMethod(String method){
263+
public RecordBuilder recordingAvailableMethod(String method) {
230264
return recordingAvailableMethod(Method.fromValue(method));
231265
}
232266
}

0 commit comments

Comments
 (0)