diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py index c45945fc4d..39d43b368f 100644 --- a/erpnext/erpnext_integrations/exotel_integration.py +++ b/erpnext/erpnext_integrations/exotel_integration.py @@ -12,9 +12,10 @@ def handle_incoming_call(*args, **kwargs): employee_email = kwargs.get('AgentEmail') status = kwargs.get('Status') - if status == 'free' and get_call_status(kwargs.get('CallSid')) == ['ringing', 'in-progress']: - # redirected to other agent number - frappe.publish_realtime('terminate_call_popup', user=employee_email) + if status == 'free': + # call disconnected for agent + # "and get_call_status(kwargs.get('CallSid')) in ['in-progress']" - additional check to ensure if the call was redirected + frappe.publish_realtime('call_disconnected', user=employee_email) return call_log = get_call_log(kwargs) @@ -29,9 +30,6 @@ def handle_incoming_call(*args, **kwargs): if call_log.call_status in ['ringing', 'in-progress']: frappe.publish_realtime('show_call_popup', data, user=data.agent_email) -def get_last_communication(phone_number, contact): - # frappe.get_all('Communication', filter={}) - return {} def get_call_log(call_payload): communication = frappe.get_all('Communication', { diff --git a/erpnext/public/js/call_popup/call_popup.js b/erpnext/public/js/call_popup/call_popup.js index 38464785db..f203c8e855 100644 --- a/erpnext/public/js/call_popup/call_popup.js +++ b/erpnext/public/js/call_popup/call_popup.js @@ -1,6 +1,6 @@ class CallPopup { constructor({ call_from, call_log, call_status_method }) { - this.number = call_from; + this.caller_number = call_from; this.call_log = call_log; this.call_status_method = call_status_method; this.make(); @@ -11,17 +11,16 @@ class CallPopup { 'static': true, 'minimizable': true, 'fields': [{ - 'fieldname': 'customer_info', + 'fieldname': 'caller_info', 'fieldtype': 'HTML' }, { - 'label': 'Last Interaction', 'fielname': 'last_interaction', 'fieldtype': 'Section Break', - // 'hidden': true }, { 'fieldtype': 'Small Text', 'label': "Last Communication", 'fieldname': 'last_communication', + 'read_only': true }, { 'fieldname': 'last_communication_link', 'fieldtype': 'HTML', @@ -29,12 +28,12 @@ class CallPopup { 'fieldtype': 'Small Text', 'label': "Last Issue", 'fieldname': 'last_issue', + 'read_only': true }, { 'fieldname': 'last_issue_link', 'fieldtype': 'HTML', }, { - 'label': 'Enter Call Summary', - 'fieldtype': 'Section Break', + 'fieldtype': 'Column Break', }, { 'fieldtype': 'Small Text', 'label': 'Call Summary', @@ -65,10 +64,13 @@ class CallPopup { this.dialog.set_value('call_summary', ''); }); } - }] + }], + on_minimize_toggle: () => { + this.set_call_status(); + } }); this.set_call_status(this.call_log.call_status); - this.make_customer_contact(); + this.make_caller_info_section(); this.dialog.get_close_btn().show(); this.setup_call_status_updater(); this.dialog.set_secondary_action(() => { @@ -78,19 +80,19 @@ class CallPopup { this.dialog.show(); } - make_customer_contact() { - const wrapper = this.dialog.fields_dict["customer_info"].$wrapper; + make_caller_info_section() { + const wrapper = this.dialog.fields_dict['caller_info'].$wrapper; wrapper.append('