detectFax

View as MarkdownOpen in Claude

Detect a fax tone on the call. A typed convenience over detect() with the fax detector.

Parameters

options
object

Detector options.

options.tone
FaxTone

"CED" (called station) or "CNG" (calling station).

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> — An action handle with stop() and wait() methods. It resolves on the first detection result.

Example

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.detectFax({ tone: 'CED', timeout: 20 });
const event = await action.wait();
console.log(event.params);
});
await client.run();