feat: real-time active call SSE — hold/unhold status for supervisor live monitor

- SupervisorService: added activeCallSubject (RxJS Subject), emits on all
  activeCalls Map mutations (Answered, Calling, Disconnect, Hold, Unhold)
- SupervisorController: new @Sse('active-calls/stream') endpoint
- OzonetelAgentController: callControl HOLD/UNHOLD updates activeCalls Map
  status via supervisor.updateCallStatus()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 05:45:14 +05:30
parent 9cf0f69dde
commit 9a016a2ed0
3 changed files with 33 additions and 4 deletions

View File

@@ -13,6 +13,16 @@ export class SupervisorController {
return this.supervisor.getActiveCalls();
}
@Sse('active-calls/stream')
streamActiveCalls(): Observable<MessageEvent> {
this.logger.log('[SSE] Active calls stream opened');
return this.supervisor.activeCallSubject.pipe(
map(event => ({
data: JSON.stringify(event),
} as MessageEvent)),
);
}
@Get('team-performance')
async getTeamPerformance(@Query('date') date?: string) {
const targetDate = date ?? new Date().toISOString().split('T')[0];