onCallEnd
Register a handler that runs when the call ends, with the transcript. Handlers run in registration order.
The SDK registers the platform’s reserved hangup_hook function for you. It
fires on hangup and is never offered to the model, so it can’t be called early
or skipped. Registering the first 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 with nothing
to say why. If you have explicitly set that parameter to false, the SDK leaves
it alone and logs a warning.
A handler’s return value is ignored, since the call is over. An exception is
logged, not raised, so a failing handler doesn’t stop the others. For the
post-prompt summary, see onSummary(); for the start of the
call, see onCallStart().
Parameters
handler
Called as handler(callLog, rawData). May be async.
callLog— the conversation as the platform recorded it.rawData— the complete SWAIG request, includingglobal_dataandcall_id.
Returns
The handler, unchanged.
Example
To handle voice and chat transcripts with one shape, pass rawData through
normalizePostPrompt().