From 81464a90876795cf66e79698aac0d5a608792065 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Sun, 3 May 2026 13:49:33 +0700 Subject: [PATCH] debug(voice): add temporary console logs around accept-call path Trace every checkpoint between the green Accept button click and the backend POST so we can see exactly where the silent failure happens (0 /accept requests landing on backend, no console errors, no network requests reported by the user). Logs prefixed [CW Voice] for grep. Will revert once the root cause is identified. --- .../components/widgets/FloatingCallWidget.vue | 17 ++++++++++++- .../dashboard/composables/useCallSession.js | 25 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue b/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue index a8f4326b1..4afa648da 100644 --- a/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue +++ b/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue @@ -74,7 +74,22 @@ const handleEndCall = async () => { }; const handleJoinCall = async call => { - if (!call || isJoining.value) return; + // eslint-disable-next-line no-console + console.log('[CW Voice] handleJoinCall', { + call, + isJoining: isJoining.value, + hasActiveCall: hasActiveCall.value, + }); + if (!call) { + // eslint-disable-next-line no-console + console.warn('[CW Voice] handleJoinCall: no call object'); + return; + } + if (isJoining.value) { + // eslint-disable-next-line no-console + console.warn('[CW Voice] handleJoinCall: already joining (stuck flag?)'); + return; + } const { conversation } = getCallInfo(call); // End current active call before joining new one diff --git a/app/javascript/dashboard/composables/useCallSession.js b/app/javascript/dashboard/composables/useCallSession.js index 39312eb4d..8bfffbe35 100644 --- a/app/javascript/dashboard/composables/useCallSession.js +++ b/app/javascript/dashboard/composables/useCallSession.js @@ -122,22 +122,45 @@ export function useCallSession() { }; const joinCall = async ({ conversationId, inboxId, callSid }) => { - if (isJoining.value) return null; + // eslint-disable-next-line no-console + console.log('[CW Voice] joinCall', { conversationId, inboxId, callSid }); + if (isJoining.value) { + // eslint-disable-next-line no-console + console.warn('[CW Voice] joinCall: isJoining flag stuck'); + return null; + } isJoining.value = true; try { const call = findCall(callSid); + // eslint-disable-next-line no-console + console.log('[CW Voice] joinCall: found call?', call); if (isWhatsappCall(call)) { + // eslint-disable-next-line no-console + console.log('[CW Voice] joinCall: WhatsApp branch', { + callId: call.callId, + hasSdpOffer: Boolean(call.sdpOffer), + hasIceServers: Boolean(call.iceServers), + }); await whatsappSession.acceptIncomingCall({ callId: call.callId, sdpOffer: call.sdpOffer, iceServers: call.iceServers, }); + // eslint-disable-next-line no-console + console.log('[CW Voice] joinCall: WhatsApp accept POST returned OK'); callsStore.setCallActive(callSid); durationTimer.start(); return { callId: call.callId }; } + // eslint-disable-next-line no-console + console.log( + '[CW Voice] joinCall: Twilio branch (provider not whatsapp)', + { + provider: call?.provider, + } + ); const device = await TwilioVoiceClient.initializeDevice(inboxId); if (!device) return null;