From 85dda3de3c310b4658e44fdc94c63f1c763c16cf Mon Sep 17 00:00:00 2001 From: root Date: Mon, 22 Jan 2024 13:51:25 +0700 Subject: [PATCH] Write --- web_admin/templates/WebCall.html | 2 +- worker/app.py | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/web_admin/templates/WebCall.html b/web_admin/templates/WebCall.html index c9c7cca..b9681bb 100644 --- a/web_admin/templates/WebCall.html +++ b/web_admin/templates/WebCall.html @@ -58,7 +58,7 @@ {{ entry.uuid }} - + {{ entry.uuid }} {% endfor %} diff --git a/worker/app.py b/worker/app.py index b6ddf62..40cfe6c 100644 --- a/worker/app.py +++ b/worker/app.py @@ -65,16 +65,12 @@ def main(): except Exception as e: print(e) insDict = { - "client": srcJson['from'], "time": srcJson['time'], "status": 1, "important": tmpIncoming[srcJson['uuid']][2]} - #sendMessage(srcJson['time'], srcJson['from']) + "client": srcJson['from'], "time": srcJson['time'], "status": 1, "important": tmpIncoming[srcJson['uuid']][2], "uuid": srcJson['uuid']} finally: - print(insDict) coll_phone.insert_one(insDict) tmpIncoming.pop(srcJson['uuid']) try: insUserKey = {'userkey': srcJson['userkey']} - print(insUserKey) - print(srcJson['to']) coll_userkey.update_one( filter={ 'operator': srcJson['to'], @@ -88,25 +84,26 @@ def main(): print(e) if srcJson['direction'] == 'external': - # coll_phone.update_one({'$and': [{'client': srcJson['to']}, {'status': 1}]}, { - # '$set': {'status': 2}}) - #r = coll_phone.update_one({'$and': [{'client': {'$regex': srcJson['to']}}, {'status': 1}]}, {'$set': {'status': 2, 'callid': srcJson['uuid']}}) - r = coll_phone.update_one({'$and': [{'client': {'$regex': srcJson['to']}}, {'status': {'$in': [1,4]}}]}, {'$set': {'status': 2, 'callid': srcJson['uuid']}}) + print("EXTERNAL", srcJson) if srcJson['state'] == 'HANGUP': + print("Full Log", srcJson) try: # Проверяем заполнено ли поле recordURL, если нет то меняем статус на 4 if len(srcJson['recordUrl']) > 4: - coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'recordUrl': srcJson['recordUrl']}}) + print("recordURL len > 4") + r = coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'recordUrl': srcJson['recordUrl'], 'status': 2}}) + print(r) else: - coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'status': 4}}) + coll_prone + print("recordURL len < 4") + r = coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'status': 4}}) + print(r) except Exception as e: print(e) - print(r) except Exception as e: print(e.with_traceback) print(e) - # print(None) exit() channel.basic_consume(