Transfer and end calls
How a call ends is the part callers remember. An agent that hangs up mid-sentence, or one that says goodbye four times, undoes a good conversation. Talkif gives you one explicit way to end (the End Call function) and three safety nets that end a call the agent didn’t — silence handling, a maximum length, and voicemail detection — each configurable per flow.
Ending on purpose: the End Call function
end_call is a built-in function you attach to an agent. The model calls it when it judges the conversation is over; Talkif then lets the agent’s last sentence finish playing and hangs up.
Two details keep this from going wrong:
- The goodbye must come before the call.
end_callitself is silent. If the model calls it without having said goodbye, Talkif speaks a short built-in farewell first, so the caller is never cut off cold — but your own closing line is better. Tell the prompt: “say a natural goodbye, then end the call.” - It always ends the call. Whatever agent is active, whatever else the model does in the same turn,
end_callis terminal. There’s no infinite-farewell loop where the model keeps saying goodbye and re-calling it.
In the builder, add an End Call node and connect it to every agent that can be the last one. Its When to end field is the description the model reads — “the caller has confirmed the booking and has no further questions” — and it matters as much as the prompt.
Attach End Call to terminal agents
Any agent where the conversation can legitimately finish. For a triage → specialists flow, that’s each specialist, not the triage agent.
Scripted lines: Say
A Say node speaks fixed text verbatim, without the model — a legal disclaimer, a hold message, a line that must be identical on every call. It attaches to an agent as a pre-action (spoken when the conversation enters that agent) or a post-action (spoken when it leaves). The text supports the same {{variables}} as prompts.
Use Say for lines that must not vary. Use the prompt for everything else — a scripted greeting sounds scripted.
Safety net 1: silence handling
When the caller goes quiet after the agent finishes speaking, the agent checks in — “Are you still there?” — and if silence continues, says a fixed goodbye and hangs up. On by default for every flow.
Each silence escalates: the first checks are short nudges the model composes to fit the conversation’s language and tone; the last one is a fixed message, then hang-up.
Leave Reset on caller speech off unless your calls have genuinely long expected pauses (a caller looking up a reference number). The monotonic counter is what guarantees an unattended call ends.
Safety net 2: maximum call length
A hard ceiling on a call’s duration, measured from answer. When reached, the agent speaks a goodbye and hangs up regardless of where the conversation is. Off by default — the right limit is yours to choose.
The cap is graceful: a goodbye queued behind a sentence in progress waits for the sentence to finish. The call still ends.
Safety net 3: voicemail (outbound only)
On outbound calls placed through Twilio — Talkif numbers and numbers from your own Twilio account — answering-machine detection can recognise voicemail and either leave a message or hang up, instead of the agent holding a conversation with a greeting recording. Per flow, under Flow Settings → Voicemail handling:
Campaigns report detection outcomes — voicemail, human, undetermined — in their analytics, so you can see how much of a list is reaching machines. Applies to outbound Twilio-routed calls only; SIP-trunk and WhatsApp calls don’t run detection.
How the layers combine
Silence handling depends on conversation state; the length cap is a plain timer; voicemail detection runs once at answer. Turn on the cap for any customer-facing line — silence handling alone doesn’t stop a caller who keeps the agent talking.
Every ending is recorded on the call as an endReason (agent_completed, caller_hangup, agent_timeout, …) — see How a call works.
Forwarding a live call to a human is on the roadmap. The builder shows a Forward Call node in preview; it is not yet active on calls. Today, the pattern for escalation is: collect a callback number, confirm it, and hand the case to your team with an HTTP Request.