> This page is for Server SDKs.

> 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.

# escalate

> End a chat leg and wait for its record before a call is placed.

[handoffrouter]: /docs/server-sdks/reference/typescript/agents/handoff-router

[readhandle]: /docs/server-sdks/reference/typescript/agents/chat-gateway/read-handle

Ends a chat leg and waits for your `captureLeg` callback to write its record, so a voice leg started
right after finds the text leg already recorded. The browser waits for this before it places the
call. The `/escalate` route calls this method.

The wait is bounded by `captureTimeout`. If `captureLeg` throws or runs past the timeout, the
failure is logged and `escalate()` still returns `true`.

## Parameters

**`handle`** `string` — required

The chat leg's handle.

---

## Returns

`Promise<boolean>` -- `false` when the handle doesn't verify, `true` otherwise.

## Examples

```typescript
import { ChatGateway, HandoffRouter } from '@signalwire/sdk';

const gateway = new ChatGateway({ configUrl: 'https://bayview-taxi.example.com/dispatch' });
const handoff = new HandoffRouter({
  gateway,
  captureLeg: async (conversationId, medium) => {
    console.log(`saving ${medium} leg of ${conversationId}`);
    return true;
  },
});

const ok = await handoff.escalate(gateway.mintHandle('chat-8f21'));
console.log(ok); // true
console.log(await handoff.escalate('not-a-handle')); // false
```