Skip to content

Commit

Permalink
Merge pull request #55 from Bandwidth/DX-2650
Browse files Browse the repository at this point in the history
DX-2650 added enqueuedTime for voice
  • Loading branch information
brianluisgomez authored Jun 27, 2022
2 parents ff82749 + f126f5f commit b9fb835
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
23 changes: 17 additions & 6 deletions src/Voice/Models/CallState.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ class CallState implements \JsonSerializable
*/
public $startTime;

/**
* @todo Write general description for this property
* @factory \BandwidthLib\Utils\DateTimeHelper::fromRfc3339DateTime
* @var \DateTime|null $enqueuedTime public property
*/
public $enqueuedTime;

/**
* @todo Write general description for this property
* @factory \BandwidthLib\Utils\DateTimeHelper::fromRfc3339DateTime
Expand Down Expand Up @@ -142,12 +149,13 @@ public function __construct()
$this->identity = func_get_arg(8);
$this->stirShaken = func_get_arg(9);
$this->startTime = func_get_arg(10);
$this->answerTime = func_get_arg(11);
$this->endTime = func_get_arg(12);
$this->disconnectCause = func_get_arg(13);
$this->errorMessage = func_get_arg(14);
$this->errorId = func_get_arg(15);
$this->lastUpdate = func_get_arg(16);
$this->enqueuedTime = func_get_arg(11);
$this->answerTime = func_get_arg(12);
$this->endTime = func_get_arg(13);
$this->disconnectCause = func_get_arg(14);
$this->errorMessage = func_get_arg(15);
$this->errorId = func_get_arg(16);
$this->lastUpdate = func_get_arg(17);
}
}

Expand All @@ -170,6 +178,9 @@ public function jsonSerialize()
$json['startTime'] =
isset($this->startTime) ?
DateTimeHelper::toRfc3339DateTime($this->startTime) : null;
$json['enqueuedTime'] =
isset($this->enqueuedTime) ?
DateTimeHelper::toRfc3339DateTime($this->enqueuedTime) : null;
$json['answerTime'] =
isset($this->answerTime) ?
DateTimeHelper::toRfc3339DateTime($this->answerTime) : null;
Expand Down
12 changes: 6 additions & 6 deletions src/Voice/Models/CreateCallResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class CreateCallResponse implements \JsonSerializable
/**
* @todo Write general description for this property
* @factory \BandwidthLib\Utils\DateTimeHelper::fromRfc3339DateTime
* @var \DateTime|null $startTime public property
* @var \DateTime|null $enqueuedTime public property
*/
public $startTime;
public $enqueuedTime;

/**
* @todo Write general description for this property
Expand Down Expand Up @@ -161,7 +161,7 @@ public function __construct()
$this->applicationId = func_get_arg(2);
$this->to = func_get_arg(3);
$this->from = func_get_arg(4);
$this->startTime = func_get_arg(5);
$this->enqueuedTime = func_get_arg(5);
$this->callUrl = func_get_arg(6);
$this->callTimeout = func_get_arg(7);
$this->callbackTimeout = func_get_arg(8);
Expand Down Expand Up @@ -191,9 +191,9 @@ public function jsonSerialize()
$json['applicationId'] = $this->applicationId;
$json['to'] = $this->to;
$json['from'] = $this->from;
$json['startTime'] =
isset($this->startTime) ?
DateTimeHelper::toRfc3339DateTime($this->startTime) : null;
$json['enqueuedTime'] =
isset($this->enqueuedTime) ?
DateTimeHelper::toRfc3339DateTime($this->enqueuedTime) : null;
$json['callUrl'] = $this->callUrl;
$json['callTimeout'] = $this->callTimeout;
$json['callbackTimeout'] = $this->callbackTimeout;
Expand Down
6 changes: 5 additions & 1 deletion tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ public function testCreateCallAndGetCallState() {
$response = $this->bandwidthClient->getVoice()->getClient()->createCall(getenv("BW_ACCOUNT_ID"), $body);
$callId = $response->getResult()->callId;
$this->assertTrue(strlen($callId) > 0);

$this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime'));

sleep(1);

//get phone call information
$response = $this->bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId);
$this->assertTrue(strlen($response->getResult()->state) > 0);
$this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime'));

}

public function testCreateCallWithAmdAndGetCallState() {
Expand Down Expand Up @@ -121,6 +124,7 @@ public function testCreateCallWithAmdAndGetCallState() {
//get phone call information
$response = $this->bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId);
$this->assertTrue(strlen($response->getResult()->state) > 0);
$this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime'));
}

public function testCreateCallWithPriority() {
Expand Down

0 comments on commit b9fb835

Please sign in to comment.