Relay.Calling.DetectResult
This object returned from one of synchronous detect methods that represents the final result of a detector.
Methods
getEvent
Returns the last Relay Event arrived for this operation.
Available In:
Parameters
None
Returns
Relay.Event
- Last Relay Event.
Examples
Detect digits and grab the result when it's completed.
<?php
$call->detectDigit()->done(function($result) {
$event = $result->getEvent();
// Inspect $event->payload ..
});
getResult
Returns the result of the detector. It could be the digits or the type (machine
or human
) detected.
Available In:
Parameters
None
Returns
string
- Detector result.
Examples
Detect DTMF and print out the result.
<?php
$call->detectDigit()->done(function($result) {
if ($result->isSuccessful()) {
echo "DTMF detected: " . $result->getResult();
}
});
getType
Returns the type
of detector.
Available In:
Parameters
None
Returns
string
- Detector type: digit
, machine
or fax
.
Examples
Check the type of a detector.
<?php
$call->detectFax()->done(function($result) {
if ($result->isSuccessful()) {
echo "Detector type: " . $result->getType();
}
});
isSuccessful
Return true
if detector succeeded, false
otherwise.
Available In:
Parameters
None
Returns
Boolean
- True/False accordingly to the state.
Examples
Start detecting a fax, then check if a 'fax' has been detected.
<?php
$call->detectFax()->done(function($result) {
if ($result->isSuccessful()) {
// Fax has been detected!
}
});