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
str | NoneDefaults to None

Custom control ID. Auto-generated if not provided.

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

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

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.receive_fax()
event = await action.wait()
fax_result = event.params.get("fax", {})
document_url = fax_result.get("document", "")
pages = fax_result.get("pages", 0)
print(f"Received fax: {pages} pages, document: {document_url}")
await call.hangup()
client.run()