> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# waitForAnswered

> Wait for a call to reach the answered state.

[relayevent]: /docs/server-sdks/reference/typescript/relay/events

[wait-for]: /docs/server-sdks/reference/typescript/relay/call/wait-for

Wait for the call to reach the `answered` state. Returns immediately if the call
is already answered or past that state. A typed wait over [`waitFor()`][wait-for].

`answer()` resolves when the platform accepts the command. Call
`waitForAnswered()` afterwards to block until the state event confirms the call
is up. A call returned by `client.dial()` is already answered, so this returns
at once.

## **Parameters**

**`timeout`** `number | undefined`

Maximum milliseconds to wait. Throws an `Error` if exceeded. `undefined`
waits indefinitely.

---

## **Returns**

`Promise<`[`RelayEvent`][relayevent]`>` -- The state-change event.

## **Example**

```typescript {11}
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();
  await call.waitForAnswered(5000);
  await call.playTTS('Thanks for calling Bayview Taxi.');
});

await client.run();
```