Skip to navigation

Start a detector on an active call. Detectors can identify answering machines, fax tones, or DTMF digits.

control_id is a caller-chosen identifier for this operation, unique per active operation of this kind on the call. The TypeScript SDK types it as optional, but the API requires it — a request that omits it is rejected.

Keep it — detectStop() uses it to end the detector.

Request

idstringRequiredformat: "uuid"
The unique identifying ID of an existing call.
paramsobjectRequired
An object of parameters that will be utilized by the active command.

Response

Call LegobjectRequired
Returned when the call is a standard PSTN, SIP, or WebRTC call.
OR
Fabric Subscriber Device LegobjectRequired

Returned when the call is a Fabric subscriber device leg. The status field is always null for this type.

Examples

Answering Machine Detection

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com"
});
// Answering machine detection, correlated by the control ID you choose
const controlId = "amd-1";
const result = await client.calling.detect(
"call-id-xxx",
{
type: "machine",
params: {
initial_timeout: 4.5,
end_silence_timeout: 1.0,
},
},
{ control_id: controlId, timeout: 30.0 },
);

Fax Detection

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com"
});
const result = await client.calling.detect("call-id-xxx", {
type: "fax",
params: { tone: "CED" },
}, { control_id: "fax-detect-1" });

Digit Detection

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com"
});
const result = await client.calling.detect("call-id-xxx", {
type: "digit",
params: { digits: "0123456789#*" },
}, { control_id: "digit-detect-1" });