diff --git a/src/supervisor/supervisor.service.ts b/src/supervisor/supervisor.service.ts index a3b72c4..85e2355 100644 --- a/src/supervisor/supervisor.service.ts +++ b/src/supervisor/supervisor.service.ts @@ -68,6 +68,12 @@ export class SupervisorService implements OnModuleInit { if (!ucid) return; if (action === 'Answered' || action === 'Calling') { + // Don't show calls for offline agents (ghost calls) + const agentState = this.agentStates.get(agentId); + if (agentState?.state === 'offline') { + this.logger.warn(`Ignoring call event for offline agent ${agentId} (${ucid})`); + return; + } this.activeCalls.set(ucid, { ucid, agentId, callerNumber, callType, startTime: eventTime, status: 'active',