Error while creating/updating call record - null and no-answer
CRM Call Log Doctype - options for Status field should allow null and no-answer. Current options have No Answer as option, which is not matching with no-answer status from Exotel.
'cmd': 'exotel_integration.handler.handle_request'} status = 'no-answer' call_log = <CallLog: 2a695c0deb2abdd9a7def37b22981959> e = ValidationError(' Status cannot be "no-answer". It should be one of "Ringing", "In Progress", "Completed", "Failed", "Busy", "No Answer", "Queued", "Canceled"')
out = {'message': ' Status cannot be "null". It should be one of "Initiated", "Ringing", "In Progress", "Completed", "Failed", "Busy", "No Answer", "Queued", "Canceled"', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '0c6c9e37b011166af82c37e2cf56aa3f0ad10afe3fdc69144a2cc204'}
File "apps/frappe/frappe/init.py", line 525, in _raise_exception raise exc exc = ValidationError(' Status cannot be "null". It should be one of "Initiated", "Ringing", "In Progress", "Completed", "Failed", "Busy", "No Answer", "Queued", "Canceled"') inspect = <module 'inspect' from '/usr/lib/python3.11/inspect.py'> msg = ' Status cannot be "null". It should be one of "Initiated", "Ringing", "In Progress", "Completed", "Failed", "Busy", "No Answer", "Queued", "Canceled"' out = {'message': ' Status cannot be "null". It should be one of "Initiated", "Ringing", "In Progress", "Completed", "Failed", "Busy", "No Answer", "Queued", "Canceled"', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '0c6c9e37b011166af82c37e2cf56aa3f0ad10afe3fdc69144a2cc204'} raise_exception = <class 'frappe.exceptions.ValidationError'> frappe.exceptions.ValidationError: Status cannot be "null". It should be one of "Initiated", "Ringing", "In Progress", "Completed", "Failed", "Busy", "No Answer", "Queued", "Canceled"
Trade ID no-answer 51d210b8-b90c-4646-bb25-6e277eb4e0d0 null 568127fa-cd5a-4984-84ff-80157220227d
Yes, I even face the same issue. I think we can raise a PR for this, there is Exotel python script, we can modify it ourselves, and send a PR here.
Otherwise, you can create an API and inside that update the DialCallStatus field with valid values, and then call the exotel API. A wrapper around exotel integrations API.
The following code is where I have created an API, and ignore calls from certain numbers, and then call the exotel integrations API. I configured this URL in exotel.
incoming_to_number = frappe.form_dict.DialWhomNumber
ignored = frappe.db.exists("IgnoredTelecallers", {"mobile_number": incoming_to_number})
if ignored:
frappe.response["http_status_code"] = 200
frappe.response["message"] = "Incoming call is ignored."
else:
url = f"{frappe.utils.get_url()}/api/method/crm.integrations.exotel.handler.handle_request?key=enrolincrm"
internal_keys = {"cmd", "_type", "data"}
params = { key: frappe.form_dict.get(key) for key in frappe.form_dict if key not in internal_keys }
try:
result = frappe.make_get_request(url=url, params=params)
frappe.response["http_status_code"] = 200
frappe.response["message"] = "Request forwarded successfully"
frappe.response["data"] = result
except Exception as e:
frappe.response["http_status_code"] = 200
frappe.response["message"] = "Webhook called, but response is not JSON"
frappe.response["params"] = params
You can create server script for CRM Call Log event, before save. This is the way you can avoid the errors.
allowed_statuses = {
"Initiated",
"Ringing",
"In Progress",
"Completed",
"Failed",
"Busy",
"No Answer",
"Queued",
"Canceled"
}
# Handle special case: "no-answer" → "No Answer"
if doc.status and doc.status.lower() == "no-answer":
doc.status = "No Answer"
if doc.status not in allowed_statuses:
doc.status = "No Answer"
@aashutoshm Can you check and confirm if it is fixed in the latest version?
I'm afraid the fix has inadvertently triggered an additional concern, leaving the server script hack inadequate. Calls where exotel Leg2Status is null (Client hung-up before connecting to any user) - neither show up in FCRM Call log now, nor in error log.