*** id: 7302dd64-84b2-44a0-be8e-e6115288d410 title: Relay.Calling.DetectAction slug: /php/reference/calling/actions/detect description: The DetectAction object is returned when detecting a call. max-toc-depth: 3 ---------------- [relay-calling-detectresult]: /docs/server-sdk/v2/php/reference/calling/results/detect [relay-calling-stopresult]: /docs/server-sdk/v2/php/reference/calling/results/stop 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. **Parameters** *None* **Returns** `string` - UUID to identify the action. **Examples** Start a detector and print the controlId. ```php 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. **Parameters** *None* **Returns** `Object` - Payload sent to Relay. **Examples** Start a detector and print out the payload. ```php detectDigitAsync()->done(function($detectResult) { print_r($action->getPayload()); }); ``` ### getResult Returns the final detector result. **Parameters** *None* **Returns** [`Relay.Calling.DetectResult`][relay-calling-detectresult] - Final detector result. **Examples** Trying detecting DTMF and grab the result when it's completed. ```php 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. **Parameters** *None* **Returns** `Boolean` - True/False accordingly to the state. **Examples** Trying detecting DTMF and check if it has finished. ```php detectDigitAsync()->done(function($action) { // .. later in the code since it's an async method if ($action->isCompleted()) { } }); ``` ### stop Stop the action immediately. **Parameters** *None* **Returns** `React\Promise\Promise` - Promise object that will be fulfilled with a [`Relay.Calling.StopResult`][relay-calling-stopresult] object. **Examples** Trying detecting a machine and then stop the action. ```php detectMachineAsync()->done(function ($action) { // For demonstration purposes only.. $action->stop()->done(function($stopResult) { }); }); ```