fix: Decouple call popup from exotel

This commit is contained in:
Suraj Shetty
2019-06-17 08:46:38 +05:30
parent 3fdeffff7a
commit 5ea6a5e33a
3 changed files with 19 additions and 13 deletions

View File

@@ -3,8 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
import frappe
from frappe.model.document import Document
from erpnext.crm.doctype.utils import get_employee_emails_for_popup
class CallLog(Document):
pass
def after_insert(self):
employee_emails = get_employee_emails_for_popup(self.medium)
for email in employee_emails:
frappe.publish_realtime('show_call_popup', self, user=email)
def on_update(self):
doc_before_save = self.get_doc_before_save()
if doc_before_save.status in ['Ringing'] and self.status in ['Missed', 'Completed']:
frappe.publish_realtime('call_{id}_disconnected'.format(id=self.id), self)