Skip to content

Commit fa2400b

Browse files
authored
Merge branch 'main' into SWI-2615
2 parents 9d89bc8 + 2757021 commit fa2400b

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

src/Voice/Bxml/Record.php

+17
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ public function fileFormat(string $fileFormat) {
179179
$this->fileFormat = $fileFormat;
180180
}
181181

182+
/**
183+
* Sets the detectLanguage attribute for Record
184+
*
185+
* @param boolean $detectLanguage Indicates that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish.
186+
*/
187+
public function detectLanguage($detectLanguage) {
188+
$this->detectLanguage= $detectLanguage;
189+
}
190+
182191
/**
183192
* Sets the transcribe attribute for Record
184193
*
@@ -294,6 +303,14 @@ public function toBxml(DOMDocument $doc) {
294303
$element->setattribute("fileFormat", $this->fileFormat);
295304
}
296305

306+
if(isset($this->detectLanguage)) {
307+
if ($this->detectLanguage) {
308+
$element->setattribute("detectLanguage", "true");
309+
} else {
310+
$element->setattribute("detectLanguage", "false");
311+
}
312+
}
313+
297314
if(isset($this->transcribe)) {
298315
if ($this->transcribe) {
299316
$element->setattribute("transcribe", "true");

src/Voice/Bxml/StartRecording.php

+18
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ public function fileFormat(string $fileFormat) {
110110
$this->fileFormat = $fileFormat;
111111
}
112112

113+
/**
114+
* Sets the detectLanguage attribute for Record
115+
*
116+
* @param boolean $detectLanguage Indicates that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish.
117+
*/
118+
public function detectLanguage($detectLanguage) {
119+
$this->detectLanguage= $detectLanguage;
120+
}
121+
122+
113123
/**
114124
* Sets the multiChannel attribute for StartRecording
115125
*
@@ -173,6 +183,14 @@ public function toBxml(DOMDocument $doc) {
173183
$element->setattribute("fileFormat", $this->fileFormat);
174184
}
175185

186+
if(isset($this->detectLanguage)) {
187+
if ($this->detectLanguage) {
188+
$element->setattribute("detectLanguage", "true");
189+
} else {
190+
$element->setattribute("detectLanguage", "false");
191+
}
192+
}
193+
176194
if(isset($this->multiChannel)) {
177195
if ($this->multiChannel) {
178196
$element->setattribute("multiChannel", "true");

src/Voice/Models/TranscribeRecordingRequest.php

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ class TranscribeRecordingRequest implements \JsonSerializable
4848
*/
4949
public $callbackTimeout;
5050

51+
/**
52+
* @todo Write general description for this property
53+
* @var boolean|null $detectLanguage public property
54+
*/
55+
public $detectLanguage;
56+
5157
/**
5258
* Constructor to set initial or default values of member properties
5359
*/
@@ -60,6 +66,7 @@ public function __construct()
6066
$this->password = func_get_arg(3);
6167
$this->tag = func_get_arg(4);
6268
$this->callbackTimeout = func_get_arg(5);
69+
$this->detectLanguage = func_get_arg(6);
6370
}
6471
}
6572

@@ -75,6 +82,7 @@ public function jsonSerialize(): array
7582
$json['password'] = $this->password;
7683
$json['tag'] = $this->tag;
7784
$json['callbackTimeout'] = $this->callbackTimeout;
85+
$json['detectLanguage'] = $this->detectlanguage;
7886

7987
return array_filter($json);
8088
}

tests/BxmlTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,12 @@ public function testRecord() {
397397
$record->recordCompleteFallbackMethod("GET");
398398
$record->fallbackUsername("fuser");
399399
$record->fallbackPassword("fpass");
400+
$record->detectlanguage("true");
400401

401402
$response = new BandwidthLib\Voice\Bxml\Response();
402403
$response->addVerb($record);
403404

404-
$expectedXml = '<?xml version="1.0" encoding="UTF-8"?><Response><Record recordCompleteUrl="https://myapp.com/nextBXML" maxDuration="10" recordCompleteFallbackUrl="https://test.com" recordCompleteFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>';
405+
$expectedXml = '<?xml version="1.0" encoding="UTF-8"?><Response><Record recordCompleteUrl="https://myapp.com/nextBXML" maxDuration="10" detectLanguage="true" recordCompleteFallbackUrl="https://test.com" recordCompleteFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>';
405406
$responseXml = $response->toBxml();
406407
$this->assertEquals($expectedXml, $responseXml);
407408
}

0 commit comments

Comments
 (0)