diff --git a/src/Voice/Bxml/Record.php b/src/Voice/Bxml/Record.php index 262e5cb..57e83a8 100644 --- a/src/Voice/Bxml/Record.php +++ b/src/Voice/Bxml/Record.php @@ -179,6 +179,15 @@ public function fileFormat(string $fileFormat) { $this->fileFormat = $fileFormat; } + /** + * Sets the detectLanguage attribute for Record + * + * @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. + */ + public function detectLanguage($detectLanguage) { + $this->detectLanguage= $detectLanguage; + } + /** * Sets the transcribe attribute for Record * @@ -294,6 +303,14 @@ public function toBxml(DOMDocument $doc) { $element->setattribute("fileFormat", $this->fileFormat); } + if(isset($this->detectLanguage)) { + if ($this->detectLanguage) { + $element->setattribute("detectLanguage", "true"); + } else { + $element->setattribute("detectLanguage", "false"); + } + } + if(isset($this->transcribe)) { if ($this->transcribe) { $element->setattribute("transcribe", "true"); diff --git a/src/Voice/Bxml/StartRecording.php b/src/Voice/Bxml/StartRecording.php index 2243801..2803cb0 100644 --- a/src/Voice/Bxml/StartRecording.php +++ b/src/Voice/Bxml/StartRecording.php @@ -110,6 +110,16 @@ public function fileFormat(string $fileFormat) { $this->fileFormat = $fileFormat; } + /** + * Sets the detectLanguage attribute for Record + * + * @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. + */ + public function detectLanguage($detectLanguage) { + $this->detectLanguage= $detectLanguage; + } + + /** * Sets the multiChannel attribute for StartRecording * @@ -173,6 +183,14 @@ public function toBxml(DOMDocument $doc) { $element->setattribute("fileFormat", $this->fileFormat); } + if(isset($this->detectLanguage)) { + if ($this->detectLanguage) { + $element->setattribute("detectLanguage", "true"); + } else { + $element->setattribute("detectLanguage", "false"); + } + } + if(isset($this->multiChannel)) { if ($this->multiChannel) { $element->setattribute("multiChannel", "true"); diff --git a/src/Voice/Models/TranscribeRecordingRequest.php b/src/Voice/Models/TranscribeRecordingRequest.php index 16c011a..a61e140 100644 --- a/src/Voice/Models/TranscribeRecordingRequest.php +++ b/src/Voice/Models/TranscribeRecordingRequest.php @@ -48,6 +48,12 @@ class TranscribeRecordingRequest implements \JsonSerializable */ public $callbackTimeout; + /** + * @todo Write general description for this property + * @var boolean|null $detectLanguage public property + */ + public $detectLanguage; + /** * Constructor to set initial or default values of member properties */ @@ -60,6 +66,7 @@ public function __construct() $this->password = func_get_arg(3); $this->tag = func_get_arg(4); $this->callbackTimeout = func_get_arg(5); + $this->detectLanguage = func_get_arg(6); } } @@ -75,6 +82,7 @@ public function jsonSerialize(): array $json['password'] = $this->password; $json['tag'] = $this->tag; $json['callbackTimeout'] = $this->callbackTimeout; + $json['detectLanguage'] = $this->detectlanguage; return array_filter($json); } diff --git a/tests/BxmlTest.php b/tests/BxmlTest.php index d7d15f1..3e030a8 100644 --- a/tests/BxmlTest.php +++ b/tests/BxmlTest.php @@ -397,11 +397,12 @@ public function testRecord() { $record->recordCompleteFallbackMethod("GET"); $record->fallbackUsername("fuser"); $record->fallbackPassword("fpass"); + $record->detectlanguage("true"); $response = new BandwidthLib\Voice\Bxml\Response(); $response->addVerb($record); - $expectedXml = ''; + $expectedXml = ''; $responseXml = $response->toBxml(); $this->assertEquals($expectedXml, $responseXml); }