fix(call popup): Multiple changes

- Remove summary from call log use comments instead
- Add contact and lead if matched to the call log
- Add received by field with Employee Link
- DocPerm to allow Employees to have read access on call log
- Remove unwanted code
- Add a method to get lead just by providing phone number
- Show popup only to Employee to which the system is trying to connect.
- Remove custom code from call popup dialog and replace it with
 standard fields
- Increase timeout to hide popup after the call has been disconnected.
This commit is contained in:
Suraj Shetty
2019-07-16 11:07:25 +05:30
parent 8c21703959
commit f5dd494716
6 changed files with 211 additions and 136 deletions

View File

@@ -18,6 +18,8 @@ def handle_incoming_call(**kwargs):
call_log = get_call_log(call_payload)
if not call_log:
create_call_log(call_payload)
else:
update_call_log(call_payload, call_log=call_log)
@frappe.whitelist(allow_guest=True)
def handle_end_call(**kwargs):
@@ -27,10 +29,11 @@ def handle_end_call(**kwargs):
def handle_missed_call(**kwargs):
update_call_log(kwargs, 'Missed')
def update_call_log(call_payload, status):
call_log = get_call_log(call_payload)
def update_call_log(call_payload, status='Ringing', call_log=None):
call_log = call_log or get_call_log(call_payload)
if call_log:
call_log.status = status
call_log.to = call_payload.get('DialWhomNumber')
call_log.duration = call_payload.get('DialCallDuration') or 0
call_log.recording_url = call_payload.get('RecordingUrl')
call_log.save(ignore_permissions=True)
@@ -48,7 +51,7 @@ def get_call_log(call_payload):
def create_call_log(call_payload):
call_log = frappe.new_doc('Call Log')
call_log.id = call_payload.get('CallSid')
call_log.to = call_payload.get('CallTo')
call_log.to = call_payload.get('DialWhomNumber')
call_log.medium = call_payload.get('To')
call_log.status = 'Ringing'
setattr(call_log, 'from', call_payload.get('CallFrom'))