RELAYCall

live_translate

View as MarkdownOpen in Claude

Start or stop live translation on the call. Translates spoken audio into another language in real-time.

Parameters

action
dictRequired

Action configuration for the live translation.

action.action
strRequired

The action to perform.

  • "start" — begin live translation
  • "stop" — end live translation
action.source_language
str

Source language code (e.g., "en-US").

action.target_language
str

Target language code (e.g., "es-ES").

status_url
Optional[str]

URL to receive translation results via webhook.

Returns

dict — Server response confirming the operation.

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 live translation from English to Spanish
15 await call.live_translate({
16 "action": "start",
17 "source_language": "en-US",
18 "target_language": "es-ES",
19 })
20
21 # Let the call proceed...
22 await call.wait_for_ended()
23
24client.run()