diff --git a/src/Voice/Bxml/Record.php b/src/Voice/Bxml/Record.php index c4bb3b1..3ce965a 100644 --- a/src/Voice/Bxml/Record.php +++ b/src/Voice/Bxml/Record.php @@ -105,6 +105,15 @@ public function fileFormat($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 * @@ -220,6 +229,14 @@ public function toBxml($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 1253c89..76c176e 100644 --- a/src/Voice/Bxml/StartRecording.php +++ b/src/Voice/Bxml/StartRecording.php @@ -68,6 +68,16 @@ public function fileFormat($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 * @@ -131,6 +141,14 @@ public function toBxml($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 b2a2ac2..63bd77c 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() $json['password'] = $this->password; $json['tag'] = $this->tag; $json['callbackTimeout'] = $this->callbackTimeout; + $json['detectLanguage'] = $this->detectlanguage; return array_filter($json); } diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 87e317b..d8e476e 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -88,7 +88,7 @@ public function testCreateCallAndGetCallState() { $this->assertTrue(strlen($callId) > 0); $this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime')); - sleep(1); + sleep(25); //get phone call information $response = $this->bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId); @@ -120,7 +120,7 @@ public function testCreateCallWithAmdAndGetCallState() { $callId = $response->getResult()->callId; $this->assertTrue(strlen($callId) > 0); - sleep(1); + sleep(25); //get phone call information $response = $this->bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId); 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); }