hangup

View as MarkdownOpen in Claude

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.

Example

1from signalwire import AgentBase
2from signalwire import FunctionResult
3
4agent = AgentBase(name="my-agent", route="/agent")
5agent.set_prompt_text("You are a helpful assistant.")
6
7@agent.tool(name="end_call", description="End the call")
8def 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
15agent.serve()