echo

View as MarkdownOpen in Claude

Echo audio back to the caller. This is primarily useful for testing audio quality, latency, and connectivity. The caller hears their own voice repeated back to them.

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

Parameters

timeout
number | undefined

Maximum duration of the echo in seconds. The echo stops automatically after this timeout.

statusUrl
string | undefined

URL to receive echo status webhooks.

Returns

Promise<Record<string, unknown>> — Server response confirming the echo 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 await call.play([{ type: 'tts', text: 'Starting echo test. You should hear yourself.' }]);
12
13 const result = await call.echo({ timeout: 30 });
14 console.log(`Echo completed: ${JSON.stringify(result)}`);
15
16 await call.play([{ type: 'tts', text: 'Echo test complete.' }]);
17 await call.hangup();
18});
19
20await client.run();