Relay.Calling.ConnectAction
This object returned from connectAsync
method that represents a connecting attempt that is currently active on a call.
Methods
getResult
Returns the final result of the connect attempt.
Available In:
Parameters
None
Returns
Relay.Calling.ConnectResult
- Final result of the connect attempt.
Examples
<?php
$devices = [
[ "type" => "phone", "to" => "+18991114444", "timeout" => 30 ],
[ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ]
];
$call->connectAsync(...$devices)->done(function($action) {
// .. later in the code since it's an async method
if ($action->isCompleted()) {
$result = $action->getResult();
}
});
getState
Return the current state of the connect attempt.
Available In:
Parameters
None
Returns
string
- Current state of the connect attempt.
Examples
<?php
$devices = [
[ "type" => "phone", "to" => "+18991114444", "timeout" => 30 ],
[ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ]
];
$call->connectAsync(...$devices)->done(function($action) {
echo $action->getState();
});
getPayload
Return the payload sent to Relay to initiate the request. Useful to inspect what you sent to perform this action.
Available In:
Parameters
None
Returns
Object
- Payload sent to Relay.
Examples
<?php
$devices = [
[ "type" => "phone", "to" => "+18991114444", "timeout" => 30 ],
[ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ]
];
$call->connectAsync(...$devices)->done(function($action) {
print_r($action->getPayload());
});
isCompleted
Return true
if the connect attempt has finished, false
otherwise.
Available In:
Parameters
None
Returns
Boolean
- True/False accordingly to the state.
Examples
<?php
$devices = [
[ "type" => "phone", "to" => "+18991114444", "timeout" => 30 ],
[ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ]
];
$call->connectAsync(...$devices)->done(function($action) {
if ($action->isCompleted()) {
}
});