*** id: 2f7d5b06-4d6a-4679-8849-999651932d75 title: Relay.Calling.DetectResult slug: /php/reference/calling/results/detect description: The DetectResult object is returned after a detect operation is completed. max-toc-depth: 3 ---------------- [relay-event]: /docs/server-sdk/v2/php/reference/event 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. **Parameters** *None* **Returns** [`Relay.Event`][relay-event] - Last Relay Event. **Examples** Detect digits and grab the result when it's completed. ```php 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. **Parameters** *None* **Returns** `string` - Detector result. **Examples** Detect DTMF and print out the result. ```php detectDigit()->done(function($result) { if ($result->isSuccessful()) { echo "DTMF detected: " . $result->getResult(); } }); ``` ### getType Returns the `type` of detector. **Parameters** *None* **Returns** `string` - Detector type: `digit`, `machine` or `fax`. **Examples** Check the type of a detector. ```php detectFax()->done(function($result) { if ($result->isSuccessful()) { echo "Detector type: " . $result->getType(); } }); ``` ### isSuccessful Return `true` if detector succeeded, `false` otherwise. **Parameters** *None* **Returns** `Boolean` - True/False accordingly to the state. **Examples** Start detecting a fax, then check if a `fax` has been detected. ```php detectFax()->done(function($result) { if ($result->isSuccessful()) { // Fax has been detected! } }); ```