From d0886617194a3c5572afb6da61b51d613ac292ab Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 6 Oct 2026 14:48:32 +0900 Subject: [PATCH] =?UTF-8?q?261006=5F03=5FENH:=20CTI=20=EC=9D=91=EB=8B=B5?= =?UTF-8?q?=20ErrMsg=20=ED=8F=AC=ED=95=A8=20=EC=8B=9C=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=20=EC=95=8C=EB=A6=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/cti/ctiClient.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/cti/ctiClient.ts b/src/lib/cti/ctiClient.ts index 43e752c..372e42a 100644 --- a/src/lib/cti/ctiClient.ts +++ b/src/lib/cti/ctiClient.ts @@ -509,13 +509,15 @@ const saveCallHistory = (parsed: Record, phase: "start" | "clos }; // 외주 문서에 오류 명세가 없어, 처리하지 않는 오류는 상태를 건드리지 않고 알리기만 한다. +// 오류는 ZCommand 자체(예: MakeCallError)로 오거나, 요청과 같은 ZCommand에 ErrMsg를 담아 오기도 한다. // 재연결 루프 등으로 같은 오류가 반복될 수 있어 ZCommand별로 일정 간격 안의 중복 alert는 생략한다. -const alertUnhandledError = (zCommand: string) => { +const alertUnhandledError = (zCommand: string, errMsg: string) => { const now = Date.now(); const lastAt = lastErrorAlertAt.get(zCommand); if (lastAt !== undefined && now - lastAt < CTI_ERROR_ALERT_THROTTLE_MS) return; lastErrorAlertAt.set(zCommand, now); - alert(`${zCommand} 오류가 발생했습니다. 관리자에게 문의하세요.`); + const detail = errMsg ? `\n(${errMsg})` : ""; + alert(`${zCommand} 오류가 발생했습니다. 관리자에게 문의하세요.${detail}`); }; // WS 서버 -> 클라이언트로 오는 메시지는 ZCommand가 기준값이다. @@ -601,8 +603,11 @@ const handleIncomingMessage = (raw: unknown) => { } default: console.warn("[CTI][TEMP_LOG] unhandled message ->", parsed.ZCommand, parsed); // TEMP_CTI_LOG - if (typeof parsed.ZCommand === "string" && parsed.ZCommand.includes("Error")) { - alertUnhandledError(parsed.ZCommand); + if (typeof parsed.ZCommand === "string") { + const errMsg = typeof parsed.ErrMsg === "string" ? parsed.ErrMsg.trim() : ""; + if (parsed.ZCommand.includes("Error") || errMsg) { + alertUnhandledError(parsed.ZCommand, errMsg); + } } break; }