Skip to main content

Call Routing

Call routing decides which agent receives each contact. AfriRoute combines queue routing strategies, skills matching, business hours, and priority rules into a single, configurable engine.

Overview​

Routing is evaluated in this order:

  1. Number routing — the dialed number points to an IVR or directly to a queue
  2. Time rules — business hours and holiday schedules decide if the queue is open
  3. Priority — VIP/priority callers are placed ahead in the queue
  4. Agent selection — the queue's strategy picks an eligible, available agent

Base URL: https://api.afriroute.ai — Auth: Authorization: Bearer $AFRIROUTE_API_KEY

Endpoints​

Define a Routing Rule​

POST /v1/voice/routing/rules
FieldTypeRequiredDescription
namestringYesRule name
matchobjectYesConditions (time, caller_region, vip)
strategystringYesround_robin, skills_based, longest_idle, priority, geographic
destinationstringYesQueue or agent group to route to
priorityintegerNoLower number wins on conflicts
curl -X POST https://api.afriroute.ai/api/v1/voice/routing/rules \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "VIP fast-track",
"match": { "vip": true },
"strategy": "priority",
"destination": "queue_vip",
"priority": 1
}'
{
"rule_id": "rule_vip_001",
"name": "VIP fast-track",
"status": "active",
"created_at": "2026-05-28T09:00:00Z"
}

Set Business Hours​

POST /v1/voice/routing/business-hours
await fetch('https://api.afriroute.ai/api/v1/voice/routing/business-hours', {
method: 'POST',
headers: {
'Authorization': 'Bearer $AFRIROUTE_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
queue_id: 'queue_support',
timezone: 'Africa/Addis_Ababa',
hours: [
{ day: 'mon-fri', open: '08:00', close: '18:00' },
{ day: 'sat', open: '09:00', close: '13:00' }
],
closed_action: 'voicemail',
closed_destination: 'vm_support'
})
});
import requests

requests.post(
'https://api.afriroute.ai/api/v1/voice/routing/business-hours',
headers={'Authorization': 'Bearer $AFRIROUTE_API_KEY'},
json={
'queue_id': 'queue_support',
'timezone': 'Africa/Nairobi',
'hours': [{'day': 'mon-fri', 'open': '08:00', 'close': '17:00'}],
'closed_action': 'voicemail'
}
)

Test a Route​

POST /v1/voice/routing/simulate
curl -X POST https://api.afriroute.ai/api/v1/voice/routing/simulate \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "from": "+254712345678", "to": "+254204440000", "vip": true }'
{
"matched_rule": "rule_vip_001",
"destination": "queue_vip",
"selected_agent": "agent_john_m",
"reason": "priority + skills_based match"
}

Routing Strategies​

StrategyBest For
round_robinEven workload distribution
skills_basedSpecialized teams (billing, technical)
longest_idleFairness across shifts
priorityVIP and SLA-bound callers
geographicRegion-specific language/agents

Best Practices​

  • Order rules with explicit priority values so VIP and SLA routes always win.
  • Always set a closed_action for after-hours so calls are not dropped.
  • Use the simulate endpoint in CI to catch misrouted numbers before deploying.
  • Combine skills-based routing with longest_idle as a tiebreaker for fairness.

Error Handling​

CodeDescriptionAction
NO_MATCHING_RULENo rule matched the callAdd a catch-all default rule
INVALID_TIMEZONEUnknown IANA timezoneUse a valid Africa/... zone
DESTINATION_UNAVAILABLEQueue closed and no fallbackDefine closed_action

Last Updated: May 2026