sip_refer

View as MarkdownOpen in Claude

Send a SIP REFER message to transfer the call in a SIP environment. This is used for attended or blind transfers within SIP-based phone systems and PBX deployments.

For standard phone-number or SIP-address transfers, use connect() instead. Use sip_refer() when the transfer must be performed via the SIP REFER mechanism (e.g., transferring to a PBX extension).

Parameters

to_uri
strRequired

SIP URI to send the REFER to (e.g., "sip:1001@pbx.example.com").

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="transfer_to_extension", description="Transfer to a PBX extension")
8def transfer_to_extension(args, raw_data):
9 extension = args.get("extension")
10 return (
11 FunctionResult(f"Transferring to extension {extension}.")
12 .sip_refer(f"sip:{extension}@pbx.example.com")
13 )
14
15agent.serve()