detect
Start audio detection on the call. Detects answering machines, fax tones, or
DTMF digits. Returns a DetectAction
that resolves on the first detection result or when the operation finishes.
The DetectAction resolves on the first detection result, not when the
detect operation finishes. This means await action.wait() returns as soon as
a result is available.
This method emits calling.call.detect events. See Call Events for payload details.
Parameters
detect
Detection configuration object.
detect.type
Detection type. Valid values:
"machine"— answering machine detection (AMD)"fax"— fax tone detection (CNG/CED)"digit"— DTMF digit detection
detect.params
Type-specific detection parameters.
timeout
Maximum seconds to run the detector before stopping.
control_id
Custom control ID. Auto-generated if not provided.
on_completed
Callback invoked when detection completes.
Returns
DetectAction — An action handle with
stop() and wait() methods.