RelayCall

transcribe

View as MarkdownOpen in Claude

Transcribe the entire call in the background. Returns a TranscribeAction that you can use to stop the transcription or wait for it to complete.

The transcribe() method transcribes the whole call and resolves when it finishes. For real-time transcription delivered as the call happens, see live_transcribe() instead.

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

Parameters

control_id
str | NoneDefaults to None

Custom control ID. Auto-generated if not provided.

status_url
str | NoneDefaults to None

URL to receive transcription status webhooks.

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

Callback invoked when transcription completes. The event carries the recording’s url, duration, and size.

Returns

TranscribeAction — 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()
# Start transcription
action = await call.transcribe(
status_url="https://example.com/transcription-status",
)
# Transcription runs in the background until the call ends
await call.wait_for_ended()
client.run()