From 0b98d490f08ee986e8b500f51aa9c03bac6442a4 Mon Sep 17 00:00:00 2001 From: saridsa2 Date: Mon, 23 Mar 2026 12:50:57 +0530 Subject: [PATCH] fix: use HH:MM:SS format for Ozonetel abandonCalls time params Ozonetel API expects time-of-day format (HH:MM:SS), not full datetime. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/worklist/missed-queue.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/worklist/missed-queue.service.ts b/src/worklist/missed-queue.service.ts index ee98d83..7083f9c 100644 --- a/src/worklist/missed-queue.service.ts +++ b/src/worklist/missed-queue.service.ts @@ -37,13 +37,14 @@ export class MissedQueueService implements OnModuleInit { let created = 0; let updated = 0; + // Ozonetel fromTime/toTime use HH:MM:SS format (time of day, filters within current day) const now = new Date(); const fiveMinAgo = new Date(now.getTime() - 5 * 60 * 1000); - const format = (d: Date) => d.toISOString().replace('T', ' ').slice(0, 19); + const toHHMMSS = (d: Date) => d.toTimeString().slice(0, 8); let abandonCalls: any[]; try { - abandonCalls = await this.ozonetel.getAbandonCalls({ fromTime: format(fiveMinAgo), toTime: format(now) }); + abandonCalls = await this.ozonetel.getAbandonCalls({ fromTime: toHHMMSS(fiveMinAgo), toTime: toHHMMSS(now) }); } catch (err) { this.logger.warn(`Failed to fetch abandon calls: ${err}`); return { created: 0, updated: 0 };