Agent Management

1. Agent State Machine

                    Register Online
   Offline ──────────────────► Idle
     ▲                          │
     │                          │ Incoming call ringing
     │                          ▼
     │                       Ringing
     │                          │
     │                   ┌──────┴──────┐
     │                   │ Answer       │ No answer
     │                   ▼              ▼
     │                  Busy          (back to Idle)
     │                   │
     │                   │ Hang up
     │                   ▼
     │                Wrapup (After-call work)
     │                   │
     │          Timeout / Manual end
     │                   │
     └───────────────────┘
                          │ Manual away
                          ▼
                       Away / Dnd / Custom
StateDescriptionCan receive calls
OfflineNot registered / offlineNo
IdleAvailable, waiting for assignmentYes
RingingRingingNo
BusyOn a callNo
WrapupAfter-call workNo
AwayAway (e.g. lunch)No
DndDo not disturbNo
CustomCustom statusNo

1.1 State Transition API

POST /cc/agents/{agent_id}/status
Body: { "status": "idle" }

Available transitions:

  • idle → go available
  • away → away
  • dnd → do not disturb
  • custom:lunch → custom status (lunch)
  • offline → go offline

1.2 After-Call Work (Wrapup)

After a call ends, the agent automatically enters Wrapup state:

  • Default timeout is 60 seconds (configured via wrapup_timeout_secs)
  • Agent can manually end early (POST /cc/agents/{agent_id}/wrapup/end)
  • Automatically returns to Idle after timeout

2. Creating an Agent

2.1 Console

Call Center → Agents → New:

FieldDescriptionExample
Agent IDUnique identifieragent-001
Display nameDisplay nameJohn
ExtensionSIP extension number1001
Skill groupAssigned skill groupsales
Max concurrentMax simultaneous calls1
PriorityACD assignment priority (0-100)50

2.2 Batch Operations

Agents → Batch Update: modify skill groups, max concurrent, etc. in bulk.

2.3 Export / Reload

  • Export: export agent configuration as a TOML file
  • Reload: reload agent configuration from a TOML file

3. Agent Endpoints

Each agent can bind multiple endpoints (SIP softphone, hard phone, WebRTC):

Agent agent-001
  ├── SIP extension 1001 (registered to RustPBX)
  ├── cc-phone (Web softphone)
  └── Simultaneous ring supported

3.1 Endpoint Registration

Agent endpoints register to RustPBX via standard SIP REGISTER. The system automatically associates them with the corresponding agent.

3.2 CC Phone Authentication

CC Phone uses a separate authentication mechanism (/cc/phone/config), supporting:

  • Console session-based authentication
  • Standalone agent login (phone_auth)

4. Agent Statistics

Each agent maintains the following metrics (in the cc_agent_stats table):

MetricDescription
Total callsTotal calls handled
Total talk timeCumulative talk time in seconds
Average talk timeTotal time / Total calls
Login durationTotal online time today
Idle durationTotal idle time today
Wrapup durationTotal wrapup time today
Break durationTotal away/custom time today

Queryable via API:

GET /cc/agents/{agent_id}/dashboard
GET /cc/reports/agents

5. Agent Dashboard

GET /cc/agents/{agent_id}/dashboard returns complete agent-view information:

  • Current status
  • Active call (if any)
  • Today’s statistics
  • Skill group information

6. Break Type Management

Customize break types in config.toml:

[proxy.cc.phone]

[[proxy.cc.phone.break_types]]
id = "lunch"
label_zh = "午休"
label_en = "Lunch"

[[proxy.cc.phone.break_types]]
id = "training"
label_zh = "培训"
label_en = "Training"

[[proxy.cc.phone.break_types]]
id = "meeting"
label_zh = "会议"
label_en = "Meeting"

[[proxy.cc.phone.break_types]]
id = "personal"
label_zh = "个人事务"
label_en = "Personal"