liveTranslate

View as MarkdownOpen in Claude

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

Parameters

action
Record<string, unknown>Required

Action configuration for the live translation.

action.action
stringRequired

The action to perform.

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

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

action.target_language
string

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

statusUrl
string | undefined

URL to receive translation results via webhook.

Returns

Promise<Record<string, unknown>> — Server response confirming the operation.

Example

1import { RelayClient } from '@signalwire/sdk';
2
3const client = new RelayClient({
4 project: process.env.SIGNALWIRE_PROJECT_ID!,
5 token: process.env.SIGNALWIRE_TOKEN!,
6 contexts: ['default']
7});
8
9client.onCall(async (call) => {
10 await call.answer();
11
12 // Start live translation from English to Spanish
13 await call.liveTranslate({
14 action: 'start',
15 source_language: 'en-US',
16 target_language: 'es-ES',
17 });
18
19 // Let the call proceed...
20 await call.waitForEnded();
21});
22
23await client.run();