RELAYCall

refer

View as MarkdownOpen in Claude

Transfer a SIP call to an external SIP endpoint using the SIP REFER method. Unlike transfer() which transfers control within RELAY, refer() performs a SIP-level transfer to an external endpoint.

This method emits calling.call.refer events. See Call Events for payload details.

Parameters

device
dictRequired

The target SIP device for the REFER.

device.type
strRequired

Device type. Typically "sip".

device.params
dictRequired

SIP parameters including uri (the SIP URI to refer to).

status_url
Optional[str]

URL to receive REFER status webhooks.

Returns

dict — Server response confirming the refer operation.

Example

1from signalwire.relay import RelayClient
2
3client = RelayClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7 contexts=["default"],
8)
9
10@client.on_call
11async def handle_call(call):
12 await call.answer()
13 await call.play([{"type": "tts", "text": "Transferring to another line."}])
14
15 result = await call.refer(
16 device={
17 "type": "sip",
18 "params": {"uri": "sip:support@example.com"},
19 },
20 )
21 print(f"SIP REFER result: {result}")
22
23client.run()