Queues
Purpose
Section titled “Purpose”Describe queues: how inbound callers wait and are matched to agents, plus comfort announcements and the callback (“keep my place”) feature.
Overview
Section titled “Overview”A queue (queues table) holds callers until a suitable agent is free. Each queue
has an extension (the number callers reach via *86<ext>), a strategy
(round_robin, least_busy, skills_based), a max_wait_secs, optional
required_skills, and an overflow_target. Members are agents
(queue_members, ordered by priority).
The waiting line lives in Redis (a sorted set scored by join time). The flow:
- FreeSWITCH parks the caller (
CHANNEL_PARKwithg2d_queue_extension); the call engine resolves the queue and enqueues the caller, publishingcaller_joined. - If an agent is already available, an opportunistic sweep assigns immediately;
otherwise the worker waits for an agent to transition to
available(via thet.<tenant>.agent.*.statesubscription). - On a free agent, the worker picks a caller FIFO (with preferred-agent affinity), stamps routing channel variables, and bridges the caller to the agent’s SIP user through the local OpenSIPS. On bridge failure the caller is re-enqueued.
Configuration
Section titled “Configuration”Queues, members and strategy are configured in the tenant app
(/api/v1/queues). Comfort announcements are tunable on the call engine:
QUEUE_ANNOUNCE_POSITION=true # announce queue positionQUEUE_ANNOUNCE_EWT=true # announce estimated waitQUEUE_ANNOUNCE_INTERVAL=30s # how oftenQUEUE_ANNOUNCE_AVG_HANDLE_SECS=180 # EWT model inputQUEUE_CALLBACK_DIGIT= # DTMF digit to request a callback (empty = off)Examples
Section titled “Examples”Callback (“keep my place”): a waiting caller presses QUEUE_CALLBACK_DIGIT;
instead of holding, they’re removed from the live line and queued for callback.
When an agent frees up and no live caller is waiting, the engine dials the
callback number back and bridges it to the agent (up to 3 attempts). Live callers
always win over callbacks.
Estimated wait is ceil(position ÷ agents) × avg_handle_secs, played via
FreeSWITCH mod_say (no pre-recorded per-number audio needed).
- Announcements and callbacks are best-effort comfort features — a failure never affects assignment.
- The bridge pins the next hop to the local OpenSIPS (
127.0.0.1:5060) because agents register there over WSS, not on FreeSWITCH directly.