fix: SIP disconnect on callState change + dispose sends agentId

- Fixed useEffect dependency bug: callState in deps caused cleanup
  (disconnectSip) to fire on every state transition, killing SIP
  mid-dial. Now uses useRef for callState in beforeunload handler
  with empty deps array — cleanup only fires on unmount.
- sendBeacon auto-dispose now includes agentId from agent config
- Disposition modal submit now includes agentId from agent config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 15:49:34 +05:30
parent fb92da113e
commit 6a2fc47226
2 changed files with 15 additions and 4 deletions

View File

@@ -90,9 +90,11 @@ export const ActiveCallCard = ({ lead, callerPhone, missedCallId, onCallComplete
// Submit disposition to sidecar
if (callUcid) {
const agentCfg = JSON.parse(localStorage.getItem('helix_agent_config') ?? '{}');
const disposePayload = {
ucid: callUcid,
disposition,
agentId: agentCfg.ozonetelAgentId,
callerPhone,
direction: callDirectionRef.current,
durationSec: callDuration,