From 3fdeffff7adc833d8bc4d45bed32374c0251d87e Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 17 Jun 2019 08:27:00 +0530 Subject: [PATCH] feat: Add medium field in call log doctype --- erpnext/communication/doctype/call_log/call_log.json | 10 ++++++++-- erpnext/erpnext_integrations/exotel_integration.py | 6 ++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/erpnext/communication/doctype/call_log/call_log.json b/erpnext/communication/doctype/call_log/call_log.json index 23c876d9049..3bc8dbaa0ac 100644 --- a/erpnext/communication/doctype/call_log/call_log.json +++ b/erpnext/communication/doctype/call_log/call_log.json @@ -6,8 +6,9 @@ "field_order": [ "id", "from", - "column_break_3", "to", + "column_break_3", + "medium", "section_break_5", "status", "duration", @@ -70,9 +71,14 @@ "fieldtype": "Data", "label": "Recording URL", "read_only": 1 + }, + { + "fieldname": "medium", + "fieldtype": "Data", + "label": "Medium" } ], - "modified": "2019-06-17 08:01:46.881008", + "modified": "2019-06-17 08:21:20.665441", "modified_by": "Administrator", "module": "Communication", "name": "Call Log", diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py index a22eb6073bd..32602d63113 100644 --- a/erpnext/erpnext_integrations/exotel_integration.py +++ b/erpnext/erpnext_integrations/exotel_integration.py @@ -12,10 +12,7 @@ def handle_incoming_call(*args, **kwargs): if not exotel_settings.enabled: return status = kwargs.get('Status') - 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 return call_log = get_call_log(kwargs) @@ -55,7 +52,8 @@ def get_call_log(call_payload, create_new_if_not_found=True): elif create_new_if_not_found: call_log = frappe.new_doc('Call Log') call_log.id = call_payload.get('CallSid') - call_log.to = call_payload.get('To') + call_log.to = call_payload.get('CallTo') + call_log.medium = call_payload.get('To') call_log.status = 'Ringing' setattr(call_log, 'from', call_payload.get('CallFrom')) call_log.save(ignore_permissions=True)