fix: call not getting logged properly

This commit is contained in:
Shariq Ansari 2024-01-18 13:29:10 +05:30
parent 4382da5889
commit e6614a5ad7
4 changed files with 11 additions and 6 deletions

View File

@ -43,7 +43,7 @@
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Status", "label": "Status",
"options": "Ringing\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled", "options": "Initiated\nRinging\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled",
"read_only": 1 "read_only": 1
}, },
{ {
@ -127,7 +127,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2023-11-23 13:11:38.804903", "modified": "2024-01-18 13:27:19.776926",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "FCRM", "module": "FCRM",
"name": "CRM Call Log", "name": "CRM Call Log",

View File

@ -90,18 +90,18 @@ class CRMCallLog(Document):
@frappe.whitelist() @frappe.whitelist()
def get_call_log(name): def get_call_log(name):
doc = frappe.get_doc("CRM Call Log", name) doc = frappe.get_doc("CRM Call Log", name)
_doc = doc.as_dict() doc = doc.as_dict()
if doc.lead: if doc.lead:
_doc.lead_name = frappe.db.get_value("CRM Lead", doc.lead, "lead_name") doc.lead_name = frappe.db.get_value("CRM Lead", doc.lead, "lead_name")
if doc.note: if doc.note:
note = frappe.db.get_values("CRM Note", doc.note, ["title", "content"])[0] note = frappe.db.get_values("CRM Note", doc.note, ["title", "content"])[0]
_doc.note_doc = { doc.note_doc = {
"name": doc.note, "name": doc.note,
"title": note[0], "title": note[0],
"content": note[1] "content": note[1]
} }
return _doc return doc
@frappe.whitelist() @frappe.whitelist()
def create_lead_from_call_log(call_log): def create_lead_from_call_log(call_log):

View File

@ -138,6 +138,8 @@ def get_datetime_from_timestamp(timestamp):
from datetime import datetime from datetime import datetime
from pytz import timezone from pytz import timezone
if not timestamp: return None
datetime_utc_tz_str = timestamp.strftime('%Y-%m-%d %H:%M:%S%z') datetime_utc_tz_str = timestamp.strftime('%Y-%m-%d %H:%M:%S%z')
datetime_utc_tz = datetime.strptime(datetime_utc_tz_str, '%Y-%m-%d %H:%M:%S%z') datetime_utc_tz = datetime.strptime(datetime_utc_tz_str, '%Y-%m-%d %H:%M:%S%z')
system_timezone = frappe.utils.get_system_timezone() system_timezone = frappe.utils.get_system_timezone()

View File

@ -95,6 +95,9 @@ class Twilio:
resp.append(dial) resp.append(dial)
return resp return resp
def get_call_info(self, call_sid):
return self.twilio_client.calls(call_sid).fetch()
def generate_twilio_client_response(self, client, ring_tone='at'): def generate_twilio_client_response(self, client, ring_tone='at'):
"""Generates voice call instructions to forward the call to agents computer. """Generates voice call instructions to forward the call to agents computer.
""" """