Skip to main content

Live Call Control

Live call control acts on a call while it is happening. You can make the agent say a line, give it a note, mute either side of a web call, hang up, or transfer a phone call to a person. You can also get a listen-only token to hear the call live.

Every request names the call by its call_id. There is no API key.

When to Use This​

  • Hang up a dispatched or campaign call from your own system.
  • Hand a phone call to a person when your CRM or a supervisor decides to.
  • Tell the agent something it can't know, such as a payment that just cleared.
  • Let a supervisor listen in from your own dashboard.

Authentication: the call_id is the key​

Keep the call_id secret

These endpoints take no API key. The 32-character call_id is the credential. Anyone who has it can control that call: speak through the agent, end it, transfer it, and listen in. It works on that one call only.

  • Call this API from your server. Never send a call_id to a browser or a mobile app.
  • Keep it out of logs, analytics, error trackers and any URL you share.
  • The observer token and its room contain the call_id too. Treat them the same way.

Where to get a call_id​

SourceWhere it is
Outbound Call Dispatch statuscalls[].call_id. It is null until the call first dials. Each retry is a new call with a new call_id
Campaign API: List attemptscall_id on each attempt with triggered: true
Pre-Webhookcall_id in the request: a query parameter when the webhook is a GET, the JSON body otherwise. Keep it out of your web server's access log
An agent tool{{current_user.call_id}}, or the full URLs {{current_user.control_url}} and {{current_user.observer_url}}, in the tool's URL, headers or body
Don't send commands from inside your Pre-Webhook handler

The agent waits for your Pre-Webhook to answer before it joins the call. Reply first, then send commands.

Endpoints​

Base path

These endpoints are served at the root of your DronaHQ host, for example https://<your-dronahq-host>/voice/control/{call_id}. There is no /api/v1 prefix.

MethodPathWhat it does
GET/voice/control/{call_id}Get call status
POST/voice/control/{call_id}Send a command. The body's type picks it
POST/voice/observer/{call_id}Listen in: a listen-only token

call_id is 32 hexadecimal characters. Anything else is a 422.


Get call status​

GET /voice/control/{call_id}

The state the call is in, and which commands it accepts right now. It also answers for ended calls, for 30 days.

curl -X GET https://<your-dronahq-host>/voice/control/7c2e9b4d1f6a4e3b9d0c5a8f2b1e6d47

Response — 200 OK​

{
"call_id": "7c2e9b4d1f6a4e3b9d0c5a8f2b1e6d47",
"agent_id": "a1d3c9e2-5b7f-4e10-9c3a-2f6b8d0e4a17",
"channel_id": 1042,
"direction": "outbound",
"status": "in_progress",
"controllable": true,
"capabilities": ["say", "add_context", "end_call", "transfer"],
"created_by": { "kind": "api_key", "id": "5b1e0c3a-8d2f-4a6e-9b7c-1d0e2f3a4b5c" },
"metadata": { "crm_id": "C-1009" },
"started_at": "2026-11-11T10:14:05.120000Z",
"ended_at": null,
"ended_reason": null
}
FieldTypeDescription
call_idstringThe call
agent_idstringThe voice agent on the call
channel_idintegerYour workspace
directionstringoutbound, inbound or web
statusstringinitiating, ringing, in_progress or ended. See Status
controllablebooleantrue only while status is in_progress
capabilitiesarray of stringsThe command types a POST accepts right now. ping is never listed, but works until the call ends
created_byobjectWhat placed the call, as kind and id. See Who placed the call
metadataobjectYour own data for the call: the metadata you sent with a dispatch, or a campaign contact's row. {} otherwise
started_atstring or nullUTC, ISO-8601
ended_at / ended_reasonstring or nullSet once the call has ended. ended_reason is one of the end reasons

Every field is always present, as null when it has no value.

Read created_by and metadata while the call is live

Once the call has ended, created_by reads {"kind": "unknown", "id": null} and metadata is {}.

Status​

statusMeaning
initiatingThe call is being set up. The agent hasn't joined yet or, on an outbound call, the callee's leg hasn't connected
ringingOutbound only, on carriers that report ringing: the callee's phone is ringing. Other outbound calls go straight from initiating to in_progress
in_progressThe agent and the other party are both on the call
endedThe call is over. ended_at and ended_reason can still be null for a moment after it ends

Outbound calls go initiating → ringing → in_progress → ended. Inbound and web calls skip ringing.

Which commands each call accepts, by status:

Commandoutboundinboundweb
say, add_contextin_progressin_progressin_progress
end_callinitiating, ringing, in_progressinitiating, in_progressinitiating, in_progress
transferin_progressin_progressnever
assistant_controlneverneverin_progress
pingany status except endedany status except endedany status except ended

Who placed the call​

kindidPlaced by
api_keyThe API key's IDOutbound Call Dispatch
campaignThe campaign_uuidA campaign
inboundnullSomeone calling one of your numbers
sessionThe user's IDThe app: a Test call from the agent builder, or a web call from the playground or a published widget
unknownnullAnything else, and every call once it has ended

Send a command​

POST /voice/control/{call_id}

One command per request. type picks the command, and the other fields depend on it.

typeWhat it doesRequired fields
saySpeaks a line in the agent's voicecontent, command_id
add_contextGives the agent a note without saying anythingmessage.content
assistant_controlMutes or unmutes the agent or the caller (web calls)action
end_callHangs upcommand_id
transferHands a phone call to a number or SIP addresstarget, command_id
pingChecks the call answers. Changes nothingnone

Which command works when is in the table under Status.

Unknown fields are refused. A field the command doesn't take is a 400, the same as a missing or invalid one. The response's errors names the field.

Command IDs and retries​

command_id is your ID for one command: 8–64 characters, using letters, digits, - and _. It is required for say, end_call and transfer, and optional for the rest.

It makes retries safe. Send the same request again with the same command_id and you get the first answer back, instead of the command running twice.

  • Make a new one for every command, for example a UUID, and keep it until you have an answer.
  • Always send one, even where it is optional. Without it, every retry runs the command again: add_context adds the note twice.
  • While the first request is still running, a retry gets 409 command_in_progress with Retry-After: 2. Wait and retry to get the result.
  • Once it has finished, a retry gets the same status code and body as the first time: 200, 202 or 500, with the header Idempotent-Replayed: true.
  • A command_id is scoped to the call. Reusing one on the same call with a different body returns the first command's result, and the new body does not run.
  • After a 503 or 504, the command may or may not have run. A retry with the same command_id sends it again.
  • Once the call has ended, a retry gets 409 call_ended, not the stored result.

say​

Speaks a line now, in the agent's voice.

FieldTypeRequiredDescription
contentstringYesWhat to say, 1–2000 characters
command_idstringYesSee Command IDs and retries
interruptbooleanNoDefault true: cut off whatever the agent is saying first. false plays the line after it
allow_barge_inbooleanNoDefault true: the caller can talk over the line. If the caller is mid-sentence, the line waits until they stop, for up to 20 seconds, and is then dropped. false speaks at once and can't be interrupted
curl -X POST https://<your-dronahq-host>/voice/control/7c2e9b4d1f6a4e3b9d0c5a8f2b1e6d47 \
-H "Content-Type: application/json" \
-d '{
"type": "say",
"command_id": "say-7f3e2a9c41b84d0e",
"content": "One moment please, I am checking that for you."
}'

Response — 200 OK​

{
"ok": true,
"type": "say",
"command_id": "say-7f3e2a9c41b84d0e",
"applied": "scheduled",
"result": { "interrupted": true, "speech_id": "speech_4b1c9e2d7a0f" },
"latency_ms": 184
}

The 200 means the line is scheduled, not that it has played. applied is scheduled, or deferred while the line waits for the caller to stop talking. The transcript and the agent's memory of the conversation get only the part the caller heard.

add_context​

Gives the agent information without saying anything aloud.

FieldTypeRequiredDescription
message.contentstringYesThe text, 1–2000 characters
message.rolestringNosystem (default): a note the agent reads at its next turn. It is never spoken and never attributed to the caller. user: added as if the caller had said it
trigger_responsebooleanNoFor role: user only. Default true: the agent answers it now. false adds it silently. Ignored for system
command_idstringNoSend one anyway. See Command IDs and retries
{
"type": "add_context",
"command_id": "ctx-91c2e7d04a3f",
"message": { "role": "system", "content": "Payment of 1500 received just now. Thank the caller." }
}

applied is immediate, or deferred when the agent was mid-reply and answers after it.

assistant_control​

Web calls only. Mutes or unmutes one side of the call.

FieldTypeRequiredDescription
actionstringYesmute or unmute
targetstringNoagent (default) silences the agent's voice. caller stops the caller's audio reaching the agent, so nothing they say is heard or transcribed
command_idstringNoSend one anyway. See Command IDs and retries

The response's state reports both sides, for example {"agent_muted": true, "caller_muted": false}. On a phone call this command is a 409 not_supported.

end_call​

Hangs up. It works from initiating, so you can stop a call that is still ringing.

FieldTypeRequiredDescription
command_idstringYesSee Command IDs and retries
goodbye_messagestringNoUp to 500 characters, spoken before the agent hangs up. It replaces the agent's own termination message. Without it, the agent's termination message plays if it has one, and otherwise the call ends with no goodbye
curl -X POST https://<your-dronahq-host>/voice/control/7c2e9b4d1f6a4e3b9d0c5a8f2b1e6d47 \
-H "Content-Type: application/json" \
-d '{
"type": "end_call",
"command_id": "end-5e8a1f3c9b2d",
"goodbye_message": "Thanks for your time. Goodbye!"
}'

Response — 200 OK​

{
"ok": true,
"type": "end_call",
"command_id": "end-5e8a1f3c9b2d",
"applied": "scheduled",
"result": { "goodbye": true },
"latency_ms": 41
}

The 200 means the hang-up is scheduled. When it lands, the call reads ended, with ended_reason api-terminated.

transfer​

Phone calls only. Hands the call to another number or SIP address.

FieldTypeRequiredDescription
targetstringYesWhere to send the call, 3–128 characters. A phone number in E.164 (+14155550100), or a SIP URI (sip:support@pbx.example.com)
command_idstringYesSee Command IDs and retries
target_typestringNophone (default) or sip. Set sip when target is a SIP URI
transfer_modestringNoblind (default) connects straight away. warm plays a short briefing to whoever answers before connecting the caller
announcementstringNoUp to 500 characters, said to the caller just before the transfer. In warm mode it is also the briefing
summarystringNowarm only. Up to 2000 characters: the briefing, used when there is no announcement. Leave both out and the agent writes a briefing from the conversation
Send target in exactly this form

The target goes to your carrier as you wrote it. Use + and the full number, or a URI that starts with sip:. Other forms (tel:+…, a number without +, a SIP address without sip:) are corrected only on numbers connected through SIP Trunking. On other carriers the transfer fails.

curl -X POST https://<your-dronahq-host>/voice/control/7c2e9b4d1f6a4e3b9d0c5a8f2b1e6d47 \
-H "Content-Type: application/json" \
-d '{
"type": "transfer",
"command_id": "xfer-2b9d4e1a7c3f",
"target": "+14155550100",
"transfer_mode": "warm",
"summary": "Wants to cancel their plan. Already offered 20% off and declined."
}'

Response — 202 Accepted​

{
"ok": true,
"type": "transfer",
"command_id": "xfer-2b9d4e1a7c3f",
"applied": "accepted",
"result": { "mode": "warm_transfer_with_summary", "target_type": "phone" },
"latency_ms": 96
}
202 means accepted, not transferred

The target is not checked up front. The 202 means the call took the command and started the transfer.

  • If the carrier takes it, the agent leaves and the call reads ended, with ended_reason supervisor-transferred. Whether anyone answers at target happens on the carrier's side and isn't reported here.
  • If it fails, for example a malformed target or a carrier refusal, the agent tells the caller it couldn't transfer them and the call carries on. status stays in_progress, and the call's events show call.transferFailed.
  • Don't rely on ended_reason. It reads supervisor-transferred even when the transfer failed and the call ended later.
  • A 500 instead of a 202 means the call refused the transfer straight away. result.detail says why.
Send a summary with warm

Without a summary or an announcement, the agent writes the briefing first. That can take longer than the call has to answer, so you can get a 500 with handler_timeout while the transfer still goes ahead. Check the call's status before you send it again. Carriers that can't play a briefing do a blind transfer instead.

ping​

Checks the call answers, end to end. It changes nothing. It works at any status until the call ends, and returns result: {"pong": true, ...}.

Response fields​

FieldDescription
oktrue when the call carried out the command
typeThe command
command_idYours, or one the server made up if you sent none
appliedsay: scheduled or deferred. add_context: immediate or deferred. end_call: scheduled. transfer: accepted. Not sent for assistant_control and ping
stateassistant_control only: agent_muted and caller_muted
resultAnything else the command reported. On failure, error and detail
latency_msHow long the call took to answer

Fields with no value are left out. Every command answers 200 except transfer, which answers 202. A 500 with ok: false means the call refused the command. See Errors. An answer replayed for a command_id you already sent carries the header Idempotent-Replayed: true, the same one dispatch sends.


Listen in​

POST /voice/observer/{call_id}

Returns a listen-only token for the call's audio. Connect to it with a LiveKit client SDK.

Body​

Optional.

FieldTypeRequiredDescription
identitystringNoThe listener's name in the call: observer_ followed by letters, digits, - or _, up to 64 characters in all. Leave it out and one is generated. Send the same one again to refresh a token
curl -X POST https://<your-dronahq-host>/voice/observer/7c2e9b4d1f6a4e3b9d0c5a8f2b1e6d47 \
-H "Content-Type: application/json" \
-d '{"identity": "observer_supervisor_17"}'

Response — 200 OK​

{
"token": "eyJhbGciOiJIUzI1NiIs...",
"livekit_url": "wss://<livekit-host>",
"room": "<room-name>",
"identity": "observer_supervisor_17",
"expires_at": "2026-11-11T11:20:05.120000Z"
}
import { Room, RoomEvent } from "livekit-client";

const room = new Room();
room.on(RoomEvent.TrackSubscribed, (track) => {
if (track.kind === "audio") document.body.appendChild(track.attach());
});
await room.connect(livekit_url, token);
  • Listen only. The token can't send audio or data, and joins this call only.
  • From the start. It works from initiating, so a supervisor can be in before the callee answers. Once the call is over it is a 409 call_ended.
  • Expiry. The token lasts until the agent's maximum call duration has passed, plus a minute, and at most 4 hours. It is checked when you connect and when you reconnect. For a fresh one, send the request again with the same identity.
  • Silent. By default neither the caller nor the agent is told that someone is listening.
  • It contains the call_id. Give the token only to someone you would trust to control the call.

Errors​

Errors other than a refused command come back under detail:

{
"detail": {
"error": "not_ready",
"message": "'say' is not available while the call is 'ringing'",
"status": "ringing",
"capabilities": ["end_call"]
}
}
The retry rule

4xx is final, except a 409 or 429 that carries Retry-After: wait that many seconds and send the same request again. On a 503, a 504, or a 500 without ok: false, retry with the same command_id. A 500 with ok: false is the call's own answer, and the same command_id returns it again.

HTTP statuserrorCauseWhat to do
400invalid_requestAn unknown type, a missing, invalid or unknown field, or a bad command_id. errors lists up to five {field, message}Fix the body
404call_not_foundNo such call, or it is older than 30 days. Also briefly just after dispatch shows the call_id, and just after a call ends until its record is writtenCheck the call_id
409not_readyNot available at this status yet, for example say while ringing. Includes status and capabilities. Retry-After: 2Retry after 2 seconds
409not_supportedNever available on this kind of call: transfer on a web call, assistant_control on a phone callDon't retry
409call_endedThe call is overDon't retry
409command_in_progressWith Retry-After: 2: this command_id is still runningRetry after 2 seconds to get its result
409command_in_progressWith no Retry-After: this command_id was used and there is no result to returnCheck the call's status before you send the command again with a new command_id
422—The call_id isn't 32 hexadecimal characters, the body isn't a JSON object, or the observer body is invalid. detail is an arrayFix the request
429rate_limitedOver the rate limit for this command on this call. message names the limit. Retry-After: 60Retry after 60 seconds
500none; the body has ok: falseThe call refused the command. result.error is handler_error (result.detail says why), handler_timeout (didn't finish in time, and may still complete) or session_stopped (the agent has left)Fix the cause, then send it with a new command_id. After handler_timeout, check the call's status first
500none{"detail": "Internal Server Error"}: an unexpected failureRetry with the same command_id
503upstream_unavailableA service the call depends on is unavailable, or the command couldn't be delivered to the callRetry with the same command_id
504ack_timeoutThe call didn't confirm within about 5 seconds. The command may have runCheck the call's status, or retry with the same command_id, which sends it again

Rate limits​

CommandRequests per call, per minute
end_call, transfer20
say, add_context, assistant_control120
ping240

Each call and each command type has its own count, in fixed one-minute windows. Retries count. Status requests and observer tokens are not limited.

What's Next​