From 4daf2daf9cce7d9876b1ff1773d0a2de5e074da2 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 12 Nov 2026 12:07:13 +0900 Subject: [PATCH] =?UTF-8?q?261112=5F01=5FFIX:=20CTI=20=EC=A2=85=EB=A3=8C?= =?UTF-8?q?=20=EC=9D=B4=EB=A0=A5=20=EC=A0=80=EC=9E=A5=20404=20=EC=8B=9C=20?= =?UTF-8?q?=EC=9E=AC=EC=8B=9C=EB=8F=84=20=EC=A4=91=EB=8B=A8=20=EB=B0=8F=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=8C=9D=EC=97=85=20=EB=AF=B8=EB=85=B8?= =?UTF-8?q?=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/cti/ctiClient.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/lib/cti/ctiClient.ts b/src/lib/cti/ctiClient.ts index 940012f..60378db 100644 --- a/src/lib/cti/ctiClient.ts +++ b/src/lib/cti/ctiClient.ts @@ -369,8 +369,11 @@ const restoreCtiState = (agentLoginId: string) => { return true; }; +// 이력 복구·종료 재처리 요청은 실패를 CTI 쪽에서 직접 처리하므로 공통 오류 팝업을 띄우지 않는다. +const silentErrorOptions = { skipResponseErrorHandler: true } as const; + const fetchCallHistBySession = (agentSessionId: string) => - nextApi.get(`/list-call-hist/session/${encodeURIComponent(agentSessionId)}`); + nextApi.get(`/list-call-hist/session/${encodeURIComponent(agentSessionId)}`, silentErrorOptions); const matchesHistory = (call: CtiCall, result: ListCallHist) => result.agentSessionId === call.agentSessionId && @@ -471,7 +474,8 @@ const savePendingClose = async (pending: PendingCallClose) => { if (pending.call.pendingStart) { const { prjctIdx, sid } = pending.call.context; const restored = await nextApi.put( - `/list-call-hist/${prjctIdx}/${encodeURIComponent(sid)}/call-start`, pending.call.pendingStart); + `/list-call-hist/${prjctIdx}/${encodeURIComponent(sid)}/call-start`, pending.call.pendingStart, + silentErrorOptions); if (!isCurrent()) return; if (!matchesHistory(pending.call, restored)) throw new Error("통화 시작 복구 응답 불일치"); delete pending.call.pendingStart; @@ -485,7 +489,8 @@ const savePendingClose = async (pending: PendingCallClose) => { // 조회 중 Talking/CallClosed가 도착했다면 이전 판단을 사용하지 않는다. if (pending.body === null && activeCall?.agentSessionId !== agentSessionId) { if (result.callStatus !== 4 && result.callStatus !== 9) { - const updated = await nextApi.patch(`/list-call-hist/hangup/${encodeURIComponent(agentSessionId)}`); + const updated = await nextApi.patch( + `/list-call-hist/hangup/${encodeURIComponent(agentSessionId)}`, undefined, silentErrorOptions); if (!isCurrent()) return; if (!updated && pending.body === null) { const checked = await fetchCallHistBySession(agentSessionId); @@ -524,12 +529,18 @@ const savePendingClose = async (pending: PendingCallClose) => { persistCtiState(); const { prjctIdx, sid } = pending.call.context; const result = await nextApi.put( - `/list-call-hist/${prjctIdx}/${encodeURIComponent(sid)}/call-close`, body); + `/list-call-hist/${prjctIdx}/${encodeURIComponent(sid)}/call-close`, body, silentErrorOptions); if (!isCurrent()) return; if (!matchesHistory(pending.call, result)) throw new Error("종료 저장 응답 불일치"); updateCallHistoryId(pending.call, result); finishPendingClose(pending); - } catch { + } catch (error) { + // 404는 이력 없음·권한 없음처럼 재시도해도 바뀌지 않으므로 무한 재시도하지 않고 정리한다. + if (isCurrent() && error instanceof HttpError && error.status === 404) { + console.warn("[CTI] 종료 이력 저장 불가(404): 재시도 정보를 정리합니다."); + finishPendingClose(pending); + return; + } if (isCurrent()) { console.warn("[CTI] 종료 이력 저장 실패: 재시도할 정보를 보존합니다."); if (!notifiedCloseFailures.has(pending)) {