feat(voice): wire WhatsApp call UI on top of existing Twilio session flow

This commit is contained in:
Tanmay Deep Sharma
2026-04-30 19:30:43 +07:00
parent 19d91e47f1
commit c7b6a87e77
9 changed files with 460 additions and 10 deletions
+12 -2
View File
@@ -1,7 +1,16 @@
import { defineStore } from 'pinia';
import TwilioVoiceClient from 'dashboard/api/channel/voice/twilioVoiceClient';
import { cleanupWhatsappSession } from 'dashboard/composables/useWhatsappCallSession';
import { TERMINAL_STATUSES } from 'dashboard/helper/voice';
const teardownByProvider = call => {
if (call?.provider === 'whatsapp') {
cleanupWhatsappSession();
} else {
TwilioVoiceClient.endClientCall();
}
};
export const useCallsStore = defineStore('calls', {
state: () => ({
calls: [],
@@ -35,7 +44,7 @@ export const useCallsStore = defineStore('calls', {
removeCall(callSid) {
const callToRemove = this.calls.find(c => c.callSid === callSid);
if (callToRemove?.isActive) {
TwilioVoiceClient.endClientCall();
teardownByProvider(callToRemove);
}
this.calls = this.calls.filter(c => c.callSid !== callSid);
},
@@ -48,7 +57,8 @@ export const useCallsStore = defineStore('calls', {
},
clearActiveCall() {
TwilioVoiceClient.endClientCall();
const active = this.calls.find(c => c.isActive);
teardownByProvider(active);
this.calls = this.calls.filter(call => !call.isActive);
},