fix: show actual phone number while calling and receiving instead of hard coded number

removed unused make call dialog
This commit is contained in:
Shariq Ansari 2023-08-24 00:39:40 +05:30
parent d9bf3388fe
commit 55c15f3a21
2 changed files with 17 additions and 30 deletions

View File

@ -1,25 +1,5 @@
<template> <template>
<slot /> <slot />
<Dialog
v-model="showPhoneCall"
:options="{
title: 'Make a call...',
actions: [{ label: 'Make a call...', variant: 'solid' }],
}"
>
<template #body-content>
<div>Make a call to +917666980887</div>
</template>
<template #actions="{ close }">
<div class="flex flex-row-reverse gap-2">
<Button
variant="solid"
label="Make a call..."
@click="makeOutgoingCall(close)"
/>
</div>
</template>
</Dialog>
<div <div
v-show="showCallPopup" v-show="showCallPopup"
ref="callPopup" ref="callPopup"
@ -40,7 +20,7 @@
<div class="text-xl font-medium"> <div class="text-xl font-medium">
{{ getUser().full_name }} {{ getUser().full_name }}
</div> </div>
<div class="text-sm text-gray-600">+917666980887</div> <div class="text-sm text-gray-600">{{ phoneNumber }}</div>
</div> </div>
<CountUpTimer ref="counterUp"> <CountUpTimer ref="counterUp">
<div v-if="onCall" class="text-base my-1"> <div v-if="onCall" class="text-base my-1">
@ -205,7 +185,7 @@ const { getUser } = usersStore()
let device = '' let device = ''
let log = ref('Connecting...') let log = ref('Connecting...')
let _call = ref(null) let _call = ref(null)
let showPhoneCall = ref(false) let phoneNumber = ref('')
let showCallPopup = ref(false) let showCallPopup = ref(false)
let showSmallCallWindow = ref(false) let showSmallCallWindow = ref(false)
@ -282,6 +262,8 @@ function toggleMute() {
function handleIncomingCall(call) { function handleIncomingCall(call) {
log.value = `Incoming call from ${call.parameters.From}` log.value = `Incoming call from ${call.parameters.From}`
phoneNumber.value = call.parameters.From
showCallPopup.value = true showCallPopup.value = true
_call.value = call _call.value = call
@ -333,15 +315,15 @@ function handleDisconnectedIncomingCall() {
counterUp.value.stop() counterUp.value.stop()
} }
async function makeOutgoingCall() { async function makeOutgoingCall(number) {
// remove this hard coded number later
phoneNumber.value = '+917666980887' || number
if (device) { if (device) {
log.value = `Attempting to call +917666980887 ...` log.value = `Attempting to call ${phoneNumber.value} ...`
try { try {
_call.value = await device.connect({ _call.value = await device.connect({
params: { params: { To: phoneNumber.value },
To: '+917666980887',
},
}) })
_call.value.on('messageReceived', (message) => { _call.value.on('messageReceived', (message) => {

View File

@ -85,9 +85,14 @@
/> />
<div class="font-medium text-2xl">{{ lead.data.lead_name }}</div> <div class="font-medium text-2xl">{{ lead.data.lead_name }}</div>
<div class="flex gap-3"> <div class="flex gap-3">
<Button class="rounded-full h-8 w-8" @click="makeCall"> <Tooltip text="Make a call...">
<PhoneIcon class="h-4 w-4" /> <Button
</Button> class="rounded-full h-8 w-8"
@click="() => makeCall(lead.data.mobile_no)"
>
<PhoneIcon class="h-4 w-4" />
</Button>
</Tooltip>
<Button class="rounded-full h-8 w-8"> <Button class="rounded-full h-8 w-8">
<EmailIcon class="h-4 w-4" /> <EmailIcon class="h-4 w-4" />
</Button> </Button>