enter_queue
Place the current call in a named queue where it will wait to be connected to an available agent or resource.
While waiting, callers will hear music or custom audio.
When an agent connects to the queue (using the connect method), the caller and agent are bridged together.
After the bridge completes (when the agent or caller hangs up), execution continues with the SWML script specified in transfer_after_bridge.
Properties
enter_queue
An object that accepts the following properties.
enter_queue.queue_name
Name of the queue to enter. If a queue with this name does not exist, it will be automatically created.
enter_queue.transfer_after_bridge
SWML to execute after the bridge completes (when the agent or caller hangs up). This defines what should happen after the call is connected to an agent and the bridge ends.
Can be either:
- A URL (http or https) that returns a SWML document
- An inline SWML document (as a JSON string)
enter_queue.status_url
HTTP or HTTPS URL to deliver queue status events. Status events will be sent via HTTP POST requests. See Queue Status Callbacks for event details.
enter_queue.wait_url
URL for media to play while waiting in the queue. The file will be fetched using an HTTP GET request. Supported audio formats include:
WAV(audio/wav, audio/wave, audio/x-wav)MP3(audio/mpeg)AIFF(audio/aiff, audio/x-aifc, audio/x-aiff)GSM(audio/x-gsm, audio/gsm)μ-law(audio/ulaw)
Default hold music will be played if not set.
enter_queue.wait_time
Maximum time in seconds to wait in the queue before timeout.
Queue Status Callbacks
When you provide a status_url, SignalWire will send HTTP POST requests to that URL for the following queue events.
Event Object Structure
event_type
The type of event that is being reported. Will always be calling.call.queue for queue events.
event_channel
The SWML channel identifier for the call (format: swml:{uuid}).
timestamp
Unix timestamp with microsecond precision indicating when the event occurred.
project_id
The SignalWire project ID (UUID format).
space_id
The SignalWire Space ID (UUID format).
params
An object containing the event-specific parameters.
params.status
The event type identifier.
Possible Values:
enqueue- Caller added to queueleave- Caller left without being bridgeddequeue- Caller pulled from queue and bridged
params.id
Unique queue entry identifier (UUID format).
params.name
The name of the queue.
params.position
The caller’s position in the queue. Set to 0 when dequeued.
params.size
The total number of callers in the queue. Set to 0 when dequeued.
params.avg_time
Average wait time in the queue (in seconds).
params.enqueue_ts
Unix timestamp in microseconds when the caller entered the queue. Set to 0 in dequeue events.
params.dequeue_ts
Unix timestamp in microseconds when the caller was dequeued. Set to 0 in enqueue and leave events, populated in dequeue events.
params.leave_ts
Unix timestamp in microseconds when the caller left the queue. Set to 0 in enqueue and dequeue events, populated in leave events.
params.status_url
The callback URL that was configured for status events.
params.control_id
Control identifier (UUID format). Present in enqueue and leave events. May be null in dequeue events.
params.call_id
The call identifier (UUID format).
params.node_id
The node identifier where the call is being processed (format: {uuid}@{region}).
Event Examples
enqueue Event
Sent when a caller is added to the queue.
leave Event
Sent when a caller leaves the queue without being bridged to another call (e.g., timeout, hangup).
dequeue Event
Sent when a caller is pulled out of the queue and bridged with another caller.
Variables
Set by the method:
- queue_result: (out) The result of the queue operation. Possible Values:
entering- Call is entering the queueconnecting- Call is in the process of connecting to an agentconnected- Successfully connected to an agentleaving- Call is leaving the queuetimeout- Waited too long and timed outhangup- Caller hung up while waitingfailed- Queue operation failed due to an error
- wait_time: (out) Time in seconds the caller waited in the queue. Set to -1 if not available.
- entry_position: (out) The caller’s position in the queue when they entered. Set to -1 if not available.
- entry_size: (out) The total size of the queue when the caller entered. Set to -1 if not available.