From e228b6a65a47e264b90d6328d793d6ccbef82086 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 13 Mar 2024 16:05:20 +0530 Subject: [PATCH] fix: give invalid mobile number message before dialing a invalid number --- frontend/src/components/CallUI.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/CallUI.vue b/frontend/src/components/CallUI.vue index b0a0e067..deca150e 100644 --- a/frontend/src/components/CallUI.vue +++ b/frontend/src/components/CallUI.vue @@ -201,7 +201,7 @@ import { Avatar, call } from 'frappe-ui' import { onMounted, ref, watch } from 'vue' const { getContact, getLeadContact } = contactsStore() -const { setMakeCall, setTwilioEnabled } = globalStore() +const { setMakeCall, setTwilioEnabled, $dialog } = globalStore() let device = '' let log = ref('Connecting...') @@ -378,6 +378,15 @@ function handleDisconnectedIncomingCall() { } async function makeOutgoingCall(number) { + // check if number has a country code + if (number.length == 10) { + $dialog({ + title: 'Invalid Mobile Number', + message: `${number} is not a valid mobile number. Either add a country code or check the number again.`, + }) + return + } + contact.value = getContact(number) if (!contact.value) { contact.value = getLeadContact(number)