fix: remove special characters & space before checking number's length
This commit is contained in:
parent
481d097563
commit
8a4684a3d3
@ -379,7 +379,7 @@ function handleDisconnectedIncomingCall() {
|
|||||||
|
|
||||||
async function makeOutgoingCall(number) {
|
async function makeOutgoingCall(number) {
|
||||||
// check if number has a country code
|
// check if number has a country code
|
||||||
if (number.length == 10) {
|
if (number?.replace(/[^0-9+]/g, '').length == 10) {
|
||||||
$dialog({
|
$dialog({
|
||||||
title: 'Invalid Mobile Number',
|
title: 'Invalid Mobile Number',
|
||||||
message: `${number} is not a valid mobile number. Either add a country code or check the number again.`,
|
message: `${number} is not a valid mobile number. Either add a country code or check the number again.`,
|
||||||
@ -387,17 +387,12 @@ async function makeOutgoingCall(number) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
contact.value = getContact(number)
|
|
||||||
if (!contact.value) {
|
|
||||||
contact.value = getLeadContact(number)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device) {
|
if (device) {
|
||||||
log.value = `Attempting to call ${contact.value.mobile_no} ...`
|
log.value = `Attempting to call ${number} ...`
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_call.value = await device.connect({
|
_call.value = await device.connect({
|
||||||
params: { To: contact.value.mobile_no },
|
params: { To: number },
|
||||||
})
|
})
|
||||||
|
|
||||||
showCallPopup.value = true
|
showCallPopup.value = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user