fix: trigger call accept logic

This commit is contained in:
Shariq Ansari 2024-01-18 16:54:25 +05:30
parent e6614a5ad7
commit e95d684bfa

View File

@ -111,15 +111,7 @@ def update_call_status_info(**kwargs):
args = frappe._dict(kwargs) args = frappe._dict(kwargs)
parent_call_sid = args.ParentCallSid parent_call_sid = args.ParentCallSid
update_call_log(parent_call_sid, status=args.CallStatus) update_call_log(parent_call_sid, status=args.CallStatus)
except:
frappe.log_error(title=_("Failed to update Twilio call status"))
@frappe.whitelist(allow_guest=True)
def get_call_info(**kwargs):
"""This is a webhook called when the outgoing call status changes.
E.g. 'initiated' 'ringing', 'in-progress', 'completed' etc.
"""
args = frappe._dict(kwargs)
call_info = { call_info = {
'ParentCallSid': args.ParentCallSid, 'ParentCallSid': args.ParentCallSid,
'CallSid': args.CallSid, 'CallSid': args.CallSid,
@ -133,6 +125,8 @@ def get_call_info(**kwargs):
client.calls(args.ParentCallSid).user_defined_messages.create( client.calls(args.ParentCallSid).user_defined_messages.create(
content=json.dumps(call_info) content=json.dumps(call_info)
) )
except:
frappe.log_error(title=_("Failed to update Twilio call status"))
def get_datetime_from_timestamp(timestamp): def get_datetime_from_timestamp(timestamp):
from datetime import datetime from datetime import datetime