RELAYCall

transcribe

View as MarkdownOpen in Claude

Start transcribing call audio. Returns a TranscribeAction that you can use to stop the transcription or wait for it to complete.

For real-time transcription with immediate text output, see live_transcribe(). The transcribe() method starts a background transcription that resolves when the operation finishes.

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

Parameters

control_id
Optional[str]

Custom control ID. Auto-generated if not provided.

status_url
Optional[str]

URL to receive transcription status webhooks.

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

Callback invoked when transcription completes. The event contains the transcription url, duration, and size.

Returns

TranscribeAction — 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 # Start transcription
15 action = await call.transcribe(
16 status_url="https://example.com/transcription-status",
17 )
18
19 # Let the call proceed...
20 await call.wait_for_ended()
21
22 # The transcription result is available after the call ends
23 if action.result:
24 url = action.result.params.get("url", "")
25 print(f"Transcription available at: {url}")
26
27client.run()