answer

View as MarkdownOpen in Claude

Answer an inbound call. This must be called before performing any media operations on the call. For outbound calls created via client.dial(), the call is already answered when the Call object is returned.

Calling answer() on an already-answered call is safe and returns the server response without error.

Parameters

Returns

Promise<Record<string, unknown>> — Server response confirming the answer 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 const result = await call.answer();
11 console.log(`Answered call ${call.callId}: ${JSON.stringify(result)}`);
12});
13
14await client.run();