on_call_end
on_call_end
Register a handler that runs when the call ends, with the transcript. Usable as a decorator or called directly. Handlers run in registration order.
Under the hood this registers the platform’s reserved hangup_hook function,
which fires on hangup and is never offered to the model, so it can’t be called
early or skipped. Registering a handler also turns on the
swaig_post_conversation parameter. Without it the hook still fires but
carries no transcript, and the handler would receive an empty list forever
with nothing to indicate why. If you have explicitly set that parameter to
False, the SDK leaves it alone and logs a warning.
The handler’s return value is ignored, since the call is over. Exceptions are
caught and logged rather than raised, so a failing handler doesn’t turn into a
failed hangup. For the post-prompt summary, see on_summary().
Parameters
handler
Called as handler(call_log, raw_data).
call_log— the conversation as the platform recorded it, already resolved from whichever field carried it.raw_data— the complete SWAIG request, includingglobal_dataandcall_id.
Returns
The handler, unchanged, so the method works as a decorator.
Example
To handle voice and chat transcripts with one shape, pass raw_data through
normalize_post_prompt().