fix: give invalid mobile number message before dialing a invalid number
This commit is contained in:
parent
154906e85c
commit
e228b6a65a
@ -201,7 +201,7 @@ import { Avatar, call } from 'frappe-ui'
|
|||||||
import { onMounted, ref, watch } from 'vue'
|
import { onMounted, ref, watch } from 'vue'
|
||||||
|
|
||||||
const { getContact, getLeadContact } = contactsStore()
|
const { getContact, getLeadContact } = contactsStore()
|
||||||
const { setMakeCall, setTwilioEnabled } = globalStore()
|
const { setMakeCall, setTwilioEnabled, $dialog } = globalStore()
|
||||||
|
|
||||||
let device = ''
|
let device = ''
|
||||||
let log = ref('Connecting...')
|
let log = ref('Connecting...')
|
||||||
@ -378,6 +378,15 @@ function handleDisconnectedIncomingCall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function makeOutgoingCall(number) {
|
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)
|
contact.value = getContact(number)
|
||||||
if (!contact.value) {
|
if (!contact.value) {
|
||||||
contact.value = getLeadContact(number)
|
contact.value = getLeadContact(number)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user