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

import { RelayClient } from '@signalwire/sdk';
const client = new RelayClient({
project: process.env.SIGNALWIRE_PROJECT_ID!,
token: process.env.SIGNALWIRE_API_TOKEN!,
contexts: ['default']
});
client.onCall(async (call) => {
await call.answer();
// Start live translation from English to Spanish
await call.liveTranslate({
action: 'start',
source_language: 'en-US',
target_language: 'es-ES',
});
// Let the call proceed...
await call.waitForEnded();
});
await client.run();