hangup
End the call immediately.
This is a terminal action. Any actions chained after hangup() may not execute.
Always place hangup() last in the chain.
Parameters
None.
Returns
FunctionResult — self, for chaining.
End the call immediately.
This is a terminal action. Any actions chained after hangup() may not execute.
Always place hangup() last in the chain.
None.
FunctionResult — self, for chaining.
1 from signalwire import AgentBase 2 from signalwire import FunctionResult 3 4 agent = AgentBase(name="my-agent", route="/agent") 5 agent.set_prompt_text("You are a helpful assistant.") 6 7 @agent.tool(name="end_call", description="End the call") 8 def end_call(args, raw_data): 9 return ( 10 FunctionResult("Thank you for calling. Goodbye!") 11 .update_global_data({"call_ended": True}) 12 .hangup() 13 ) 14 15 agent.serve()