RelayCall

detect_fax

View as MarkdownOpen in Claude

Detect a fax tone. A typed convenience over detect() that builds the {"type": "fax", "params": {...}} configuration for you. All parameters are keyword-only.

Parameters

tone
str | NoneDefaults to None

Which tone to detect: "CED" (called station) or "CNG" (calling station). Omit to default to "CED". Keyword-only.

timeout
float | NoneDefaults to None

Maximum seconds to run the detector before stopping. Keyword-only.

on_completed
Callable[[RelayEvent], Any] | NoneDefaults to None

Callback invoked when the operation reaches a terminal state. Can be a regular function or async coroutine. Keyword-only.

Returns

DetectAction — An action handle with stop() and wait() methods. It resolves on the first detection result.

Example

from signalwire.relay import RelayClient
client = RelayClient(
project="your-project-id",
token="your-api-token",
contexts=["default"],
)
@client.on_call
async def handle_call(call):
await call.answer()
action = await call.detect_fax(tone="CED", timeout=20)
event = await action.wait()
client.run()