fix: give invalid mobile number message before dialing a invalid number

This commit is contained in:
Shariq Ansari 2024-03-13 16:05:20 +05:30
parent 154906e85c
commit e228b6a65a

View File

@ -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)