Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Voice/Models/CreateCallRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,18 @@ class CreateCallRequest implements \JsonSerializable
*/
public $machineDetection;

/**
* The priority of this call over other calls from
* @var int $priority public property
*/
public $priority;

/**
* Constructor to set initial or default values of member properties
*/
public function __construct()
{
if (18 == func_num_args()) {
if (19 == func_num_args()) {
$this->from = func_get_arg(0);
$this->to = func_get_arg(1);
$this->uui = func_get_arg(2);
Expand All @@ -151,6 +157,7 @@ public function __construct()
$this->tag = func_get_arg(15);
$this->applicationId = func_get_arg(16);
$this->machineDetection = func_get_arg(17);
$this->priority = func_get_arg(18);
}
}

Expand Down Expand Up @@ -178,6 +185,7 @@ public function jsonSerialize()
$json['tag'] = $this->tag;
$json['applicationId'] = $this->applicationId;
$json['machineDetection'] = $this->machineDetection;
$json['priority'] = $this->priority;

return array_filter($json);
}
Expand Down
10 changes: 9 additions & 1 deletion src/Voice/Models/CreateCallResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,18 @@ class CreateCallResponse implements \JsonSerializable
*/
public $tag;

/**
* The priority of this call over other calls from
* @var int $priority public property
*/
public $priority;

/**
* Constructor to set initial or default values of member properties
*/
public function __construct()
{
if (20 == func_num_args()) {
if (21 == func_num_args()) {
$this->accountId = func_get_arg(0);
$this->callId = func_get_arg(1);
$this->applicationId = func_get_arg(2);
Expand All @@ -170,6 +176,7 @@ public function __construct()
$this->fallbackUsername = func_get_arg(17);
$this->fallbackPassword = func_get_arg(18);
$this->tag = func_get_arg(19);
$this->priority = func_get_arg(20);
}
}

Expand Down Expand Up @@ -201,6 +208,7 @@ public function jsonSerialize()
$json['fallbackUsername'] = $this->fallbackUsername;
$json['fallbackPassword'] = $this->fallbackPassword;
$json['tag'] = $this->tag;
$json['priority'] = $this->priority;

return array_filter($json);
}
Expand Down
17 changes: 17 additions & 0 deletions tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function testCreateCallAndGetCallState() {
$response = $this->bandwidthClient->getVoice()->getClient()->createCall(getenv("BW_ACCOUNT_ID"), $body);
$callId = $response->getResult()->callId;
$this->assertTrue(strlen($callId) > 0);

sleep(1);

//get phone call information
$response = $this->bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId);
Expand Down Expand Up @@ -113,11 +115,26 @@ public function testCreateCallWithAmdAndGetCallState() {
$callId = $response->getResult()->callId;
$this->assertTrue(strlen($callId) > 0);

sleep(1);

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

public function testCreateCallWithPriority() {
$body = new BandwidthLib\Voice\Models\CreateCallRequest();
$body->from = getenv("BW_NUMBER");
$body->to = getenv("USER_NUMBER");
$body->applicationId = getenv("BW_VOICE_APPLICATION_ID");
$body->answerUrl = getenv("BASE_CALLBACK_URL");
$body->priority = 1;
$response = $this->bandwidthClient->getVoice()->getClient()->createCall(getenv("BW_ACCOUNT_ID"), $body);
$callId = $response->getResult()->callId;
$this->assertTrue(strlen($callId) > 0);
$this->assertTrue($response->getResult()->priority == $body->priority);
}

public function testCreateCallInvalidPhoneNumber() {
$body = new BandwidthLib\Voice\Models\CreateCallRequest();
$body->from = getenv("BW_NUMBER");
Expand Down