async def terminate_call(
        task: PipelineTask,  # Pipeline task reference
        params: FunctionCallParams,
    ):
        """Function the bot can call to terminate the call."""
        # Create a message to add
        content = "The user wants to end the conversation, thank them for chatting."
        message = {
            "role": "system",
            "content": content,
        }
        # Append the message to the list
        messages.append(message)
        # Queue the message to the context
        await task.queue_frames([LLMMessagesFrame(messages)])

        # Then end the call
        await params.llm.queue_frame(EndTaskFrame(), FrameDirection.UPSTREAM)
Function the bot can call to terminate the call.
examples/phone-chatbot/daily-pstn-call-transfer/bot.py