> 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 phone call is placed.

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

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

End a chat leg and wait for `capture_leg` to confirm its record. The browser calls `POST /escalate`
and waits on it before dialing, so the voice leg that follows is guaranteed to find the text leg
already recorded. The handle is verified with the gateway's [`read_handle()`][read-handle].

## Parameters

**`handle`** `str` — required

The chat handle the browser holds.

---

## Returns

`bool` -- `True` when the handle was valid and the capture attempt has finished,
`False` for an invalid or expired handle. `True` doesn't confirm a record was
written: if `capture_leg` is unset, times out after `capture_timeout`, or raises,
the failure is logged and this still returns `True`.

## Example

```python
if not await handoff.escalate(handle):
    return {"error": "not found"}, 404
return {"ok": True}
```

See [`HandoffRouter`][ref-handoffrouter] for the route this backs.