From 840bb6b76d2a0a1f846b1a9d4778d2f514f022ed Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 19 Jan 2025 22:50:21 +0530 Subject: [PATCH] fix: get call details while making call --- crm/integrations/exotel/handler.py | 6 ++++-- frontend/src/components/Telephony/ExotelCallUI.vue | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crm/integrations/exotel/handler.py b/crm/integrations/exotel/handler.py index 4ffc00b4..555b903b 100644 --- a/crm/integrations/exotel/handler.py +++ b/crm/integrations/exotel/handler.py @@ -125,7 +125,9 @@ def make_a_call(to_number, from_number=None, caller_id=None): agent=frappe.session.user, ) - return response.json() + call_details = response.json().get("Call", {}) + call_details["CallSid"] = call_details.get("Sid", "") + return call_details def get_exotel_endpoint(action=None): @@ -161,7 +163,7 @@ def validate_request(): # workaround security since exotel does not support request signature # /api/method/?key= webhook_verify_token = frappe.db.get_single_value("CRM Exotel Settings", "webhook_verify_token") - key = frappe.request.args.get('key') + key = frappe.request.args.get("key") is_valid = key and key == webhook_verify_token if not is_valid: diff --git a/frontend/src/components/Telephony/ExotelCallUI.vue b/frontend/src/components/Telephony/ExotelCallUI.vue index 1a5888fb..c1e28fa9 100644 --- a/frontend/src/components/Telephony/ExotelCallUI.vue +++ b/frontend/src/components/Telephony/ExotelCallUI.vue @@ -399,7 +399,10 @@ function makeOutgoingCall(number) { url: 'crm.integrations.exotel.handler.make_a_call', params: { to_number: phoneNumber.value }, auto: true, - onSuccess() { + onSuccess(callDetails) { + callData.value = callDetails + console.log(callDetails) + callStatus.value = 'Calling...' showCallPopup.value = true showSmallCallPopup.value = false