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.
This commit is contained in:
Tanmay Deep Sharma
2026-05-03 13:49:33 +07:00
parent 6ed9500792
commit 81464a9087
2 changed files with 40 additions and 2 deletions
@@ -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
@@ -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;