Call ends
- Permission required
agent:runtime(agent keys only)
When to use it
Called by the agent's code when the session closes. Replaces the post-call webhook: stores the full transcript, the tools used, the events, the usage and the audio key, marks the call as ended and queues the job that generates the summary, topics, language, score, outcome and quality. The agent no longer writes summaries. Repeating it with the same call_id writes nothing (duplicate = true).
Input
| Field | Type | Description |
|---|---|---|
call_idRequired | string | The call id: the LiveKit room name. With the key, it identifies the call |
channel | "voice" | Channel (only voice for now) |
ended_atRequired | string (date-time) | ISO end time |
duration_sRequired | integer | |
termination_reasonRequired | string | Why it ended: user_hangup, agent_hangup, transfer, error… |
transcriptRequired | object[] | The full transcript (authoritative: replaces call_log's) |
transcript[].seq | integer | Turn number (0, 1, 2…): never stored twice |
transcript[].roleRequired | "user" | "assistant" | "system" | |
transcript[].textRequired | string | |
transcript[].t | number | Second of the call |
tool_calls | object[] | |
tool_calls[].id | string | |
tool_calls[].nameRequired | string | |
tool_calls[].arguments | object | |
tool_calls[].result | any | The first 4 KB are stored |
tool_calls[].ok | boolean | false = the tool failed (default true) |
tool_calls[].error | string | |
tool_calls[].t | number | Second of the call |
tool_calls[].duration_ms | integer | |
usage | object | Usage of the call (for costs) |
usage.llm | object[] | |
usage.llm[].modelRequired | string | |
usage.llm[].inRequired | integer | |
usage.llm[].outRequired | integer | |
usage.stt_s | number | |
usage.tts_chars | integer | |
recording | object | |
recording.egress_id | string | |
recording.key | string | Audio object key in the bucket: recordings/{org}/{agent}/… |
agent_outcome | string | Outcome according to the agent (an outcome_options key). set_outcome does the same during the call |
Every tool also accepts lang (es | en) for the language of the text answer.
Output
| Field | Type | Description |
|---|---|---|
conversation_idRequired | number | |
job_idRequired | number | null | Post-call job (summary, topics, outcome, quality, escalation) |
duplicateRequired | boolean | true = already received: nothing was written again |
messages_storedRequired | number | |
tool_calls_storedRequired | number | |
eventsRequired | string[] | Events detected by the organization's rules |
agent_outcome_appliedRequired | boolean |
Examples
Example 1: End of call
Call
{
"name": "call_end",
"arguments": {
"call_id": "call-_+34600111222_abc123",
"ended_at": "2026-11-25T09:34:10Z",
"duration_s": 250,
"termination_reason": "user_hangup",
"transcript": [
{
"role": "assistant",
"text": "Hola, soy Joana…",
"t": 0.4
},
{
"role": "user",
"text": "Quería saber el horario de la piscina",
"t": 4.1
}
],
"tool_calls": [
{
"name": "kb_search",
"arguments": {
"query": "horario piscina"
},
"ok": true,
"t": 6.2,
"duration_ms": 180
}
],
"usage": {
"llm": [
{
"model": "gpt-4.1-mini",
"in": 5200,
"out": 640
}
],
"stt_s": 250,
"tts_chars": 1800
},
"recording": {
"egress_id": "EG_abc",
"key": "recordings/39/joan-miro-voz/call-_+34600111222_abc123_1764063010.mp3"
}
}
}Response
{
"conversation_id": 81234,
"job_id": 977,
"duplicate": false,
"messages_stored": 2,
"tool_calls_stored": 1,
"events": [],
"agent_outcome_applied": false
}Equivalent JSON-RPC call (POST /mcp)
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "call_end",
"arguments": {
"call_id": "call-_+34600111222_abc123",
"ended_at": "2026-11-25T09:34:10Z",
"duration_s": 250,
"termination_reason": "user_hangup",
"transcript": [
{
"role": "assistant",
"text": "Hola, soy Joana…",
"t": 0.4
},
{
"role": "user",
"text": "Quería saber el horario de la piscina",
"t": 4.1
}
],
"tool_calls": [
{
"name": "kb_search",
"arguments": {
"query": "horario piscina"
},
"ok": true,
"t": 6.2,
"duration_ms": 180
}
],
"usage": {
"llm": [
{
"model": "gpt-4.1-mini",
"in": 5200,
"out": 640
}
],
"stt_s": 250,
"tts_chars": 1800
},
"recording": {
"egress_id": "EG_abc",
"key": "recordings/39/joan-miro-voz/call-_+34600111222_abc123_1764063010.mp3"
}
}
}
}