RELAYCall

disconnect

View as MarkdownOpen in Claude

Disconnect a previously bridged call, breaking the connection between the two call legs. Both parties return to their respective RELAY applications for further processing. Use this after connect() to separate bridged calls.

Parameters

None.

Returns

dict — Server response confirming the disconnect.

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
14 # Bridge to an agent
15 await call.connect([
16 [{"type": "phone", "params": {"to_number": "+15551234567", "from_number": "+15559876543"}}],
17 ])
18
19 # Disconnect (unbridge) the connected call
20 result = await call.disconnect()
21 print(f"Disconnected: {result}")
22
23 await call.play([{"type": "tts", "text": "The other party has disconnected."}])
24 await call.hangup()
25
26client.run()