queueLeave

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

queueName
stringRequired

Name of the queue to leave.

controlId
string | undefined

Custom control ID. Auto-generated if not provided.

queueId
string | undefined

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

statusUrl
string | undefined

URL to receive queue status webhooks.

Returns

Promise<Record<string, unknown>> — Server response confirming the call left the queue.

Example

1import { RelayClient } from '@signalwire/sdk';
2
3const client = new RelayClient({
4 project: process.env.SIGNALWIRE_PROJECT_ID!,
5 token: process.env.SIGNALWIRE_TOKEN!,
6 contexts: ['default']
7});
8
9client.onCall(async (call) => {
10 await call.answer();
11
12 // Enter the queue
13 await call.queueEnter('support');
14
15 // Remove from queue after a timeout
16 await new Promise((resolve) => setTimeout(resolve, 300_000)); // 5 minute max wait
17 await call.queueLeave('support');
18 await call.play([{ type: 'tts', text: 'No agents available. Please try again later.' }]);
19 await call.hangup();
20});
21
22await client.run();