Merge pull request '261112_01_FIX: CTI 종료 이력 저장 404 시 재시도 중단 및 오류 팝업 미노출' (#75) from develop into master
Reviewed-on: #75
This commit is contained in:
@@ -369,8 +369,11 @@ const restoreCtiState = (agentLoginId: string) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
// 이력 복구·종료 재처리 요청은 실패를 CTI 쪽에서 직접 처리하므로 공통 오류 팝업을 띄우지 않는다.
|
||||
const silentErrorOptions = { skipResponseErrorHandler: true } as const;
|
||||
|
||||
const fetchCallHistBySession = (agentSessionId: string) =>
|
||||
nextApi.get<ListCallHist>(`/list-call-hist/session/${encodeURIComponent(agentSessionId)}`);
|
||||
nextApi.get<ListCallHist>(`/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<ListCallHist>(
|
||||
`/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<boolean>(`/list-call-hist/hangup/${encodeURIComponent(agentSessionId)}`);
|
||||
const updated = await nextApi.patch<boolean>(
|
||||
`/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<ListCallHist>(
|
||||
`/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)) {
|
||||
|
||||
Reference in New Issue
Block a user