Compare commits

...

2 Commits

Author SHA1 Message Date
72c8cdca37 Merge pull request '261028_01_ENH: CTI 통화 재연결 복원 대응 및 종료 우회 처리 정리' (#68) from feature-tera-ws into develop
Reviewed-on: #68
2026-11-02 18:11:05 +09:00
4fd52bf8fc 261028_01_ENH: CTI 통화 재연결 복원 대응 및 종료 우회 처리 정리
- Talking 재수신 시 기존 통화 세션 복원
- 재로그인 상태 11인 종료 누락 통화를 기존 API로 정리
- 정상 종료 선반영 및 3초 강제 재연결 제거
- 종료 요청 대기·재시도와 중복 이벤트·지연 응답 처리 보완
2026-10-28 16:50:10 +09:00
3 changed files with 491 additions and 447 deletions

View File

@@ -63,15 +63,17 @@ const disabledContrastClass = 'bg-white disabled:opacity-100 disabled:text-foreg
// disabled는 공용 Input 컴포넌트의 disabled:pointer-events-none 때문에 마우스 이벤트 자체를 못 받는다. // disabled는 공용 Input 컴포넌트의 disabled:pointer-events-none 때문에 마우스 이벤트 자체를 못 받는다.
const readOnlyContrastClass = 'bg-white read-only:text-foreground read-only:bg-muted/60' const readOnlyContrastClass = 'bg-white read-only:text-foreground read-only:bg-muted/60'
const getCallButtonLabel = (isDialing: boolean, isOnCall: boolean) => { const getCallButtonLabel = (isDialing: boolean, isOnCall: boolean, isEnding: boolean) => {
if (isEnding) return '종료 요청 중'
if (isDialing) return '거는 중' if (isDialing) return '거는 중'
if (isOnCall) return '전화 끊기' if (isOnCall) return '전화 끊기'
return '전화' return '전화'
} }
const getCallButtonTitle = (isCtiReady: boolean, isDialing: boolean) => { const getCallButtonTitle = (isCtiReady: boolean, isDialing: boolean, isEnding: boolean) => {
if (!isCtiReady) return '전화 시스템에 연결되어 있지 않습니다.' if (!isCtiReady) return '전화 시스템에 연결되어 있지 않습니다.'
if (isDialing) return '전화를 거는 중입니다.' if (isDialing) return '전화를 거는 중입니다.'
if (isEnding) return '통화 종료를 확인하고 있습니다.'
return undefined return undefined
} }
@@ -115,7 +117,8 @@ const ListContactInfoPanel = ({
const isCtiReady = ctiConnectionStatus === 'open' const isCtiReady = ctiConnectionStatus === 'open'
const ctiCallPhase = useCtiCallPhase() const ctiCallPhase = useCtiCallPhase()
const isDialing = ctiCallPhase === 'dialing' const isDialing = ctiCallPhase === 'dialing'
const isOnCall = ctiCallPhase === 'active' const isEnding = ctiCallPhase === 'ending'
const isOnCall = ctiCallPhase === 'active' || isEnding
const visibleHeaders = listHeaders const visibleHeaders = listHeaders
.filter((header) => isListFieldVisibleForContact(header)) .filter((header) => isListFieldVisibleForContact(header))
@@ -148,8 +151,7 @@ const ListContactInfoPanel = ({
} }
const handleCall = (telNum: string, listHderId: number) => { const handleCall = (telNum: string, listHderId: number) => {
if (!isCtiReady || isDialing) return if (!isCtiReady || isDialing || isEnding) return
// CTI_HANGUP_PENDING_VENDOR: 외주사 Hangup 명령 동작 확인 후 통화 중 버튼을 활성화하면 즉시 사용할 수 있다.
if (isOnCall) { if (isOnCall) {
ctiClient.hangup() ctiClient.hangup()
return return
@@ -229,12 +231,12 @@ const ListContactInfoPanel = ({
type="button" type="button"
variant="outline" variant="outline"
className={cn('shrink-0 gap-2', isOnCall && 'bg-accent text-accent-foreground')} className={cn('shrink-0 gap-2', isOnCall && 'bg-accent text-accent-foreground')}
disabled={isEditing || !isCtiReady || isDialing} disabled={isEditing || !isCtiReady || isDialing || isEnding}
title={getCallButtonTitle(isCtiReady, isDialing)} title={getCallButtonTitle(isCtiReady, isDialing, isEnding)}
onClick={() => handleCall(value, header.listHderId)} onClick={() => handleCall(value, header.listHderId)}
> >
<Phone className="h-4 w-4" /> <Phone className="h-4 w-4" />
{getCallButtonLabel(isDialing, isOnCall)} {getCallButtonLabel(isDialing, isOnCall, isEnding)}
</Button> </Button>
<Button <Button
type="button" type="button"

View File

@@ -4,11 +4,12 @@ export const CTI_AGENT_GROUP = "KRI_CONTACT";
export const CTI_CALL_PHASE: CtiCallPhase[] = [ export const CTI_CALL_PHASE: CtiCallPhase[] = [
'dialing', 'dialing',
'active' 'active',
'ending'
] as const; ] as const;
// WS 서버가 보내는 CTIAgentStatus 값 중 통화 중 또는 통화 중 재로그인 대기로 간주할 값들 // WS 서버가 보내는 발신·통화 중 상태. None(0)은 통화 중 상태가 아니다.
export const CTI_ON_CALL_STATUSES = ["0", "2", "3"] as const; export const CTI_ON_CALL_STATUSES = ["2", "3", "8"] as const;
// localStorage에 저장한 CTI 상태의 만료 시간. 마지막 저장(updatedAt) 기준이며 복원 시점에만 검사한다. // localStorage에 저장한 CTI 상태의 만료 시간. 마지막 저장(updatedAt) 기준이며 복원 시점에만 검사한다.
export const CTI_STATE_TTL_MS = 2 * 60 * 60 * 1000; export const CTI_STATE_TTL_MS = 2 * 60 * 60 * 1000;
@@ -26,3 +27,8 @@ export const CTI_AUTO_RECONNECT_BASE_MS = 1000;
export const CTI_AUTO_RECONNECT_MAX_MS = 15 * 1000; export const CTI_AUTO_RECONNECT_MAX_MS = 15 * 1000;
export const CTI_AUTO_RECONNECT_JITTER_MS = 1000; export const CTI_AUTO_RECONNECT_JITTER_MS = 1000;
// 종료 명령의 응답이 없으면 재요청할 수 있게 하되, 실제 종료로 판정하지 않는다.
export const CTI_HANGUP_TIMEOUT_MS = 10 * 1000;
export const CTI_LOGIN_TIMEOUT_MS = 15 * 1000;
export const CTI_HISTORY_RETRY_MS = 5 * 1000;

File diff suppressed because it is too large Load Diff