Inbound queue SLA forecast + virtual callback gate
Orbit’s ACD queue entry check forecasts whether the head-of-line (or a new caller’s projected wait) will breach the queue’s SLA threshold — the per-queue target the supervisor surface already shows. When a queue opts the newslaCallbackPolicy field into suggest or block, the engine guards entries accordingly:
- suggest — entry still allowed; the supervisor surface marks “press 1 for a callback” as advised for this tick.
- block — the entry check refuses the ZADD and routes the caller to the press-1 virtual-callback consent (position saved; the callback-in-queue dispatcher dials them on the Devotel softswitch, not an outbound Telnyx/DIDWW agent — respect the invariant).
Fields
Supervisor verdict
computeSlaCallbackGate returns { verdict, projectedWaitSeconds, breachOverSeconds, alreadyBreached }:
verdict:ok,suggest, orblock.projectedWaitSeconds: position-based estimate.breachOverSeconds: the deeper of head-of-line overhang vs position math; used to surface “how much capacity callback would absorb”.alreadyBreached: head-of-line already past threshold (a 0-waiting queue can still be flagged).
Entry decision flow
- The queue controller fetches
getQueueStats+getQueueConfig. - If
slaCallbackPolicyis absent → the block check is skipped. - When
'block'and the forecast is a breach → the controller responds503withslaCallbackBlocked: true, projectedWaitSecs, slaThresholdSecsand fireshandleOverflow(call, 'callback', ...). The caller hears the press-1 prompt and consents a callback whose position is preserved. - Queues without the field engage only the existing press-1 escape — nothing else changes.
Dispatch safety
The blocked-entry path is the samecallback overflow handleOverflow the existing press-1 escape uses, so it lands in the normal callback_requests / callback_in_queue dispatch path. The callback dispatcher enforces:
- Emergency-dial guard (invariant #49).
- TCPA federal-window check (invariant #68) for +1 NANP.
- Devotel softswitch trunk for dialbacks (invariant #45).