RELAYCall

receive_fax

View as MarkdownOpen in Claude

Start receiving a fax on the call. Returns a FaxAction that resolves when the fax is fully received or an error occurs.

This method emits calling.call.fax events. See Call Events for payload details.

Parameters

control_id
Optional[str]

Custom control ID. Auto-generated if not provided.

on_completed
Optional[Callable[[RelayEvent], Any]]

Callback invoked when the fax reception completes. The event contains the received document URL and page count.

Returns

FaxAction — An action handle with stop() and wait() methods.

Example

1from signalwire.relay import RelayClient
2
3client = RelayClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7 contexts=["default"],
8)
9
10@client.on_call
11async def handle_call(call):
12 await call.answer()
13
14 action = await call.receive_fax()
15 event = await action.wait()
16
17 fax_result = event.params.get("fax", {})
18 document_url = fax_result.get("document", "")
19 pages = fax_result.get("pages", 0)
20 print(f"Received fax: {pages} pages, document: {document_url}")
21 await call.hangup()
22
23client.run()