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

from signalwire import AgentBase
from signalwire import FunctionResult
agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")
@agent.tool(name="transfer_to_extension", description="Transfer to a PBX extension")
def transfer_to_extension(args, raw_data):
extension = args.get("extension")
return (
FunctionResult(f"Transferring to extension {extension}.")
.sip_refer(f"sip:{extension}@pbx.example.com")
)
agent.serve()