Skip to main content
Back to how-to guides Use this pattern when a voice call can fail and the caller must still hear a clear line and reach a next step: another try, a person, or a clean hang-up. Decide the fallback for each failure before you go live. A caller cannot see an error message. Silence is the failure they notice.

Concept

Every failure on a call needs two answers: what the caller hears, and what happens next. Pipeline voice (KoreVG: STT, agent, TTS) supports all of these. Realtime (speech-to-speech) supports fewer. Each section says where a setting stops.

Minimal working example

A card-status agent covers four failures: a silent caller, a tool that fails, a model that fails, and a caller on hold too long. Each ends with a person. A second agent performs the transfer. agents/card-status-voice.agent.abl
agents/transfer-desk.agent.abl
Companion resources and variable sources:
  • get_card_status is a project tool. Define it in Tools and bind it to your card API.
  • last_four is a GATHER field. card holds the tool result.
  • The transfer target is project-owned. Set a SIP or phone number target in the project Agent Transfer settings. ABL cannot name a phone number.
  • Transfer_Desk is a stand-in in the same project. Replace it with your own routing.
What happens, in order: An ON_ERROR handler runs its retries first. Its RESPOND plays only after the retries fail. Write the line for the failed state, not for a retry.

How it works

Silence and unclear speech

No-input handling is off until you enable it. Set it at the narrowest level that fits. A narrower level overrides a wider one, key by key. A recognition that scores below sttMinConfidence is discarded. The platform treats it as silence and counts it toward max_retries. A run of unclear answers reaches the exhausted action. Set sttMinConfidence (0 to 1) on the voice channel or in the project’s Runtime Config. Zero at channel level turns the check off. on_exhausted decides what happens after the last reprompt. Project default When Retries Run Out offers End the call, Transfer to a person, and Hand off to an agent. A project handoff needs a HANDOFF route from the current agent to the target. Hook and step targets run on KoreVG pipeline voice. On realtime voice and Twilio, hook acts as custom, the hook does not run, and the trace records voice_no_input_route_unsupported. Dynamic reprompts are for pipeline voice. Realtime uses static prompts. Gemini realtime turns no-input prompts off when the mode is dynamic. A step can override the agent policy for one question. In this example the agent hangs up on a silent caller. The account-number step is more important, so it waits longer, retries once, and escalates to a person. agents/account-number-voice.agent.abl
  • exhausted_message on the step replaces the agent’s for this step only. Other keys the step leaves out come from the agent.
  • MESSAGES replaces the built-in error lines for this agent. The ESCALATE block needs a project Agent Transfer target for the voice transfer.
  • account_number is a GATHER field. The done step reads it in its reply.
For tuning timeouts and reprompts, see How to handle barge-in, pauses, and unclear audio.

Errors in the agent

ON_ERROR maps an error type to a line and a next step. Types are llm_error, tool_error, routing_error, validation_error, timeout_error, unknown_error, and default. Narrow tool_error with SUBTYPE or SUBTYPES, such as tool_timeout, rate_limit, auth_failure, and network_error. A handler named tool_timeout is not a type. Compile warns ON_ERROR_HANDLER_TYPE_DRIFT. Without your own handler, a tool failure in a FLOW CALL uses a built-in default. It retries once after 1,000 ms and then continues with the error_default line, “An error occurred. Please try again.” That wording suits text, not a phone call. Replace it for voice in MESSAGES or with an ON_ERROR default handler. Retries only run when a repeat is safe. A tool failure whose effect is unknown, or a tool that blocks repeats, is not retried. The trace records tool_call_retry_skipped. An agent-level handler accepts a VOICE block. A step handler does not. Use it to protect an apology from interruption:
fallback_model in EXECUTION compiles but no runtime code switches to it after a model error. Use the project recovery policy below for model failover.

Project recovery policy

Settings > Runtime Config > Channel recovery and graceful failure is opt-in per channel. Turn on Voice to use it, and publish the policy. A draft does not change live calls. Nothing changes for a channel you leave off. When a turn still ends in an error, the platform speaks a recovery line in place of the error text and keeps the call open for the caller’s next turn. It does not end the call or move it to a person. Use ON_ERROR with THEN: HANDOFF for that. Built-in lines are in US English. Add your languages to the catalog. A line must not contain an internal error code.

Caller hold

When the phone network signals a hold, the agent stays silent and stops listening. Set the limits in Settings > Runtime Config > Caller hold. The hook cannot RESPOND. The caller is on hold and cannot hear it. A hook with no HANDOFF ends the call. Transfer needs a SIP or phone number target in Agent Transfer. New projects start with caller hold on. Older projects start with it off. Caller hold applies to holds the gateway signals on KoreVG calls. When the gateway does not support it, the trace records voice_caller_hold_unsupported and the call behaves as before.

Transfer failure

When a transfer does not connect, the platform keeps the call with the agent and returns to listening. The caller hears a line the model writes about the failure. If no line is ready within 4,000 ms, or the failure is a rejected release hang-up, the fixed line plays: “Unable to complete the transfer. Please try again.” The far end’s reason is never spoken. Traces: voice_call_transfer_failed and voice_call_transfer_outcome. Plan for the retry. Give the agent a way to offer another path, such as a callback, a different queue, or a clean goodbye. See When to escalate a conversation to a human.

Speech output failures

A silent line does not trigger the no-input timer until the retry plays.

Ending the call

On a KoreVG call every COMPLETE ends the call after its message plays, even without TERMINAL. The message plays once. Caller speech while it plays is ignored. Use COMPLETE for the last line of a fallback path. See How to end a conversation with COMPLETE. To signal your gateway or contact center on the closing hang-up, add SIP headers to a COMPLETE condition:
Header names must be valid SIP tokens of at most 64 characters. You cannot override the platform’s own headers. sip_headers anywhere else warns VOICE_SIP_HEADERS_ILLEGAL_PLACEMENT.

Settings the channel cannot honor

Verification

Test each failure on a real call in a test project. Use Open voice preview, or call the number. Then open the session in Sessions and read the trace. Check the last agent line. The Conversation records the final line before a hang-up. A row marked playback unconfirmed means the gateway did not confirm that the line finished.

Production readiness checklist

  • Every failure in the first table has a spoken line and a next step. Replace “An error occurred. Please try again.” for voice.
  • Silence handling is on. Every hangup has an exhausted_message.
  • The transfer target exists in Agent Transfer. Test a failed transfer.
  • Every handoff target has a HANDOFF route from the agent that hands off.
  • Retries are used only for read-only tools. Side-effect tools do not retry blindly.
  • Caller hold is on, with limits and a limit action you tested.
  • Realtime channels use static no-input prompts, and the realtime settings you rely on are supported by your provider.
  • The recovery policy has a candidate model on a different provider, if you rely on model failover.
  • Trace review covers voice_no_input_exhausted, voice_call_transfer_failed, voice_tts, and voice_feature_diagnostic from a test run.

Common mistakes

Troubleshooting