RelayCall

queue_leave

View as MarkdownOpen in Claude

Remove the call from a queue.

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

Parameters

queue_name
strRequired

Name of the queue to leave.

control_id
str | NoneDefaults to None

Custom control ID. Auto-generated if not provided.

queue_id
str | NoneDefaults to None

Specific queue ID to leave (if the call is in multiple queues with the same name).

status_url
str | NoneDefaults to None

URL to receive queue status webhooks.

Returns

dict — Server response confirming the call left the queue.

Example

import asyncio
from signalwire.relay import RelayClient
client = RelayClient(
project="your-project-id",
token="your-api-token",
contexts=["default"],
)
@client.on_call
async def handle_call(call):
await call.answer()
# Enter the queue
await call.queue_enter(queue_name="support")
# Remove from queue after a timeout
await asyncio.sleep(300) # 5 minute max wait
await call.queue_leave(queue_name="support")
await call.play([{"type": "tts", "params": {"text": "No agents available. Please try again later."}}])
await call.hangup()
client.run()