> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# detectAnsweringMachine

> Detect whether a human or an answering machine picked up.

[detectaction]: /docs/server-sdks/reference/typescript/relay/actions

[detect]: /docs/server-sdks/reference/typescript/relay/call/detect

Detect whether a human or an answering machine picked up. A typed convenience
over [`detect()`][detect] with the `machine` detector.

## **Parameters**

**`options`** `object`

Detector options. Each maps to the matching snake\_case param of the
[`detect()`][detect] command's `machine` detector type.

---

**`options.initialTimeout`** `number`

Seconds to wait for initial voice before deciding.

---

**`options.endSilenceTimeout`** `number`

Seconds of silence that end the greeting.

---

**`options.machineVoiceThreshold`** `number`

Seconds of continuous voice that indicate a machine.

---

**`options.machineWordsThreshold`** `number`

Word count that indicates a machine.

---

**`options.detectInterruptions`** `boolean`

Report interruptions during the greeting.

---

**`options.detectMessageEnd`** `boolean`

Keep detecting until the machine's greeting ends, so you can leave a message.

---

**`options.timeout`** `number`

Maximum seconds to run the detector before stopping.

---

**`options.onCompleted`** `(event: RelayEvent) => void | Promise<void>`

Callback invoked when the operation reaches a terminal state.

---

## **Returns**

`Promise<`[`DetectAction`][detectaction]`>` -- An action handle with `stop()` and `wait()` methods. It resolves on the first detection result.

## **Example**

```typescript {11}
import { RelayClient } from '@signalwire/sdk';

const client = new RelayClient({
  project: process.env.SIGNALWIRE_PROJECT_ID!,
  token: process.env.SIGNALWIRE_API_TOKEN!,
  contexts: ['default']
});

client.onCall(async (call) => {
  await call.answer();
  const action = await call.detectAnsweringMachine({ detectMessageEnd: true, timeout: 30 });
  const event = await action.wait();
  console.log(event.params);
});

await client.run();
```