Relay.Calling.DetectAction
This object returned from one of asynchronous detect methods that represents a running detector on the call.
Methods
getControlId
Return the UUID to identify the action.
Available In:
Parameters
None
Returns
string
- UUID to identify the action.
Examples
<?php
$call->detectMachineAsync()->done(function ($action) {
echo $action->getControlId();
});
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
$call->detectDigitAsync()->done(function($detectResult) {
print_r($action->getPayload());
});
getResult
Returns the final detector result.
Available In:
Parameters
None
Returns
Relay.Calling.DetectResult
- Final detector result.
Examples
<?php
$call->detectDigitAsync()->done(function($action) {
// .. later in the code since it's an async method
if ($action->isCompleted()) {
$detectResult = $action->getResult();
}
});
isCompleted
Return true
if detector has finished, false
otherwise.
Available In:
Parameters
None
Returns
Boolean
- True/False accordingly to the state.
Examples
<?php
$call->detectDigitAsync()->done(function($action) {
// .. later in the code since it's an async method
if ($action->isCompleted()) {
}
});
stop
Stop the action immediately.
Available In:
Parameters
None
Returns
React\Promise\Promise
- Promise object that will be fulfilled with a Relay.Calling.StopResult
object.
Examples
<?php
$call->detectMachineAsync()->done(function ($action) {
// For demonstration purposes only..
$action->stop()->done(function($stopResult) {
});
});