Queues & ACD

ACD (Automatic Call Distribution) is the core engine of the call center, responsible for intelligently assigning queued calls to the appropriate agents.

1. ACD Architecture

Inbound call
    │
    ▼
Queue
    │
    ├── Priority sorting
    ├── Schedule check
    ├── Overflow evaluation
    │
    ▼
Agent Selection (Strategy)
    │
    ├── Skill filtering
    ├── Strategy algorithm
    │
    ▼
Assign to agent ──► Agent ringing ──► Answer / No answer

2. ACD Strategy Configuration

2.1 Strategy Structure

# Define policies in ACD configuration
[acd]
enabled = true
default_policy = "support"

[acd.policies.support]
name = "Support Policy"

[acd.policies.support.priority]
wait_time_weight = 1.0
base_priority = 0
fifo_within_same_priority = true

[acd.policies.support.strategy]
strategy_type = "longest_idle"     # Core algorithm
max_concurrent_calls = 1

[acd.policies.support.overflow]
triggers = [
  { type = "timeout", value = 120, action = "overflow" }
]
chain = ["voicemail"]
retry_per_target = 1

2.2 Agent Assignment Algorithms

AlgorithmDescriptionUse Case
longest_idleLongest idle first (default)Even workload distribution
least_answeredFewest answered firstNew agent protection
round_robinRound robinEven distribution
skill_basedWeighted skill scoringMulti-skill agents
randomRandomSpecial scenarios

2.3 Skill Scoring Algorithm

The skill_based strategy uses weighted scoring:

Score = skill_match × 0.6 + idle_time × 0.3 + priority × 0.1

Weights are customizable in the policy configuration:

[acd.policies.support.strategy]
strategy_type = "skill_based"
max_concurrent_calls = 2
require_exact_skill = false

[acd.policies.support.strategy.skill_weights]
skill_match = 0.6
idle_time = 0.3
priority = 0.1

3. Priority Queuing

3.1 Priority Calculation

Priority score = base_priority + vip_bonus + wait_time × wait_time_weight
ParameterDescriptionDefault
base_priorityBase score0
vip_bonusVIP level bonus (mapped by tier)None
wait_time_weightPer-second wait time bonus1.0

3.2 VIP Configuration

[acd.policies.support.priority]
base_priority = 0
wait_time_weight = 1.5

[acd.policies.support.priority.vip_bonus]
gold = 100
silver = 50
bronze = 20

3.2 Queueing Rules

  • Within the same priority level, FIFO (first in, first out)
  • Higher priority calls are always assigned first
  • Longer wait time increases priority (prevents starvation)

4. Overflow Handling

4.1 Overflow Triggers

Trigger TypeDescriptionExample
timeoutWait timeout (seconds)Not assigned within 120s
queue_lengthQueue length exceededQueue ≥ 50 callers
no_agentsNo available agentsAll agents offline

4.2 Overflow Target Chain

Targets are tried in order, with a max of N retries per target:

[[acd.policies.support.overflow.chain]]
skill_group = { id = "senior" }    # First overflow to senior group

[[acd.policies.support.overflow.chain]]
"voicemail" = {}                   # Then to voicemail
Target TypeDescription
skill_groupOverflow to another skill group
voicemailRoute to voicemail
callbackCreate a callback task
back_to_ivrReturn to IVR
hangupHang up

5. Schedule Rules

5.1 Business Hours

[acd.policies.support.schedule]
[acd.policies.support.schedule.business_hours]
start = "09:00"
end = "18:00"
timezone = "Asia/Shanghai"

5.2 Holidays

[acd.policies.support.schedule.holidays]
"2026-01-01" = { name = "New Year's Day", overflow_chain = ["voicemail"] }
"2026-02-17" = { name = "Spring Festival", overflow_chain = ["back_to_ivr"] }

5.3 Night Mode

[acd.policies.support.schedule.night_mode]
enabled = true
start = "18:00"
end = "09:00"
action = "voicemail"

6. Queue Management API

OperationEndpointDescription
View queue statusGET /cc/queue-detailQueue count, wait time
Real-time statsGET /cc/realtimeReal-time data for all queues
ACD configurationGET /cc/acd/policiesPolicy list
Export configurationPOST /cc/acd/exportExport as TOML
Reload configurationPOST /cc/acd/reloadReload
ACD diagnosticsGET /cc/acd/diagnosticsCheck configuration issues

7. Call Events

ACD generates events during the assignment process (via the Queue Event system):

  • Enqueued: Call entered queue
  • AgentAssigned: Agent assigned
  • AgentRinging: Agent ringing
  • AgentAnswered: Agent answered
  • AgentNoAnswer: Agent did not answer
  • Dequeued: Dequeued (timeout / cancelled)