fix: handle error
This commit is contained in:
parent
4bb4088e4a
commit
f0180cc2d9
@ -109,6 +109,7 @@ def make_a_call(to_number, from_number=None, caller_id=None):
|
|||||||
to_number=call_payload.get("To"),
|
to_number=call_payload.get("To"),
|
||||||
medium=call_payload.get("PhoneNumberSid"),
|
medium=call_payload.get("PhoneNumberSid"),
|
||||||
call_type="Outgoing",
|
call_type="Outgoing",
|
||||||
|
agent=frappe.session.user,
|
||||||
)
|
)
|
||||||
|
|
||||||
return response.json()
|
return response.json()
|
||||||
@ -154,7 +155,7 @@ def create_call_log(
|
|||||||
from_number,
|
from_number,
|
||||||
to_number,
|
to_number,
|
||||||
medium,
|
medium,
|
||||||
agent=frappe.session.user,
|
agent,
|
||||||
status="Ringing",
|
status="Ringing",
|
||||||
call_type="Incoming",
|
call_type="Incoming",
|
||||||
):
|
):
|
||||||
|
|||||||
@ -231,9 +231,10 @@ import NoteIcon from '@/components/Icons/NoteIcon.vue'
|
|||||||
import TaskIcon from '@/components/Icons/TaskIcon.vue'
|
import TaskIcon from '@/components/Icons/TaskIcon.vue'
|
||||||
import TaskPanel from '@/components/Telephony/TaskPanel.vue'
|
import TaskPanel from '@/components/Telephony/TaskPanel.vue'
|
||||||
import CountUpTimer from '@/components/CountUpTimer.vue'
|
import CountUpTimer from '@/components/CountUpTimer.vue'
|
||||||
import { TextEditor, Avatar, Button, call, createResource } from 'frappe-ui'
|
import { createToast } from '@/utils'
|
||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
import { useDraggable, useWindowSize } from '@vueuse/core'
|
import { useDraggable, useWindowSize } from '@vueuse/core'
|
||||||
|
import { TextEditor, Avatar, Button, call, createResource } from 'frappe-ui'
|
||||||
import { ref, onBeforeUnmount, watch } from 'vue'
|
import { ref, onBeforeUnmount, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
@ -362,12 +363,24 @@ function updateWindowHeight(condition) {
|
|||||||
|
|
||||||
function makeOutgoingCall(number) {
|
function makeOutgoingCall(number) {
|
||||||
phoneNumber.value = number
|
phoneNumber.value = number
|
||||||
callStatus.value = 'Calling...'
|
|
||||||
showCallPopup.value = true
|
|
||||||
showSmallCallPopup.value = false
|
|
||||||
|
|
||||||
call('crm.integrations.exotel.handler.make_a_call', {
|
createResource({
|
||||||
to_number: phoneNumber.value,
|
url: 'crm.integrations.exotel.handler.make_a_call',
|
||||||
|
params: { to_number: phoneNumber.value },
|
||||||
|
auto: true,
|
||||||
|
onSuccess() {
|
||||||
|
callStatus.value = 'Calling...'
|
||||||
|
showCallPopup.value = true
|
||||||
|
showSmallCallPopup.value = false
|
||||||
|
},
|
||||||
|
onError(err) {
|
||||||
|
createToast({
|
||||||
|
title: 'Error',
|
||||||
|
text: err.messages[0],
|
||||||
|
icon: 'x',
|
||||||
|
iconClasses: 'text-red-600',
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,8 +459,11 @@ function updateStatus(data) {
|
|||||||
} else if (
|
} else if (
|
||||||
data.EventType == 'terminal' &&
|
data.EventType == 'terminal' &&
|
||||||
data.Direction == 'outbound-api' &&
|
data.Direction == 'outbound-api' &&
|
||||||
data.Status == 'no-answer' &&
|
(data.Status == 'no-answer' || data.Status == 'busy') &&
|
||||||
data['Legs[1][Status]'] == 'no-answer'
|
(data['Legs[1][Status]'] == 'no-answer' ||
|
||||||
|
data['Legs[0][Status]'] == 'no-answer' ||
|
||||||
|
data['Legs[1][Status]'] == 'busy' ||
|
||||||
|
data['Legs[0][Status]'] == 'busy')
|
||||||
) {
|
) {
|
||||||
counterUp.value.stop()
|
counterUp.value.stop()
|
||||||
return 'No answer'
|
return 'No answer'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user