ADD. New Status Recall

This commit is contained in:
Сергей Филимонов 2024-01-19 14:19:22 +07:00
parent c52dc734f6
commit ccd5d6874d
3 changed files with 29 additions and 12 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
**/.venv
**/.vscode

View File

@ -11,7 +11,8 @@
<header>
<a href="/web/call/status/0">Входящий вызов принят</a>
<a href="/web/call/status/1">Входящий вызов не принят</a>
<a href="/web/call/status/2">Перезвонили</a>
<a href="/web/call/status/2">Перезвонили успешно</a>
<a href="/web/call/status/4">Перезвонили безуспешно</a>
<p>
<form name="search" action="/web/call/find/" method="get" class="search">
<label class="search_label">Поиск</label>
@ -33,9 +34,13 @@
<tr>
<!-- <td>{{ entry.client }}</td> -->
{% if entry.important == True %}
<td><font color="#C30000">{{ "%s %s %s %s"|format(entry.client[0:1], entry.client[1:4], entry.client[4:7], entry.client[7:11]) }}</font></td>
<td>
<font color="#C30000">{{ "%s %s %s %s"|format(entry.client[0:1], entry.client[1:4], entry.client[4:7],
entry.client[7:11]) }}</font>
</td>
{% else %}
<td >{{ "%s %s %s %s"|format(entry.client[0:1], entry.client[1:4], entry.client[4:7], entry.client[7:11]) }}</td>
<td>{{ "%s %s %s %s"|format(entry.client[0:1], entry.client[1:4], entry.client[4:7], entry.client[7:11]) }}
</td>
{% endif %}
<!-- <td>{{ entry.Operator }}</td> -->
<td>{{ entry.time }}</td>
@ -46,6 +51,8 @@
Вызов не принят
{% elif entry.status == 2 %}
Перезвонили
{% elif entry.status == 2 %}
Абонент не взял трубку
{% elif entry.status == 9 %}
Абонент заблокирован
{% endif %}

View File

@ -21,6 +21,11 @@ coll_userkey = db_base['userkey']
# return response
# Stats:
# 0 - ответили
# 1 - не приняли
# 2 - перезвонили успешно
def main():
connection = pika.BlockingConnection(pika.ConnectionParameters(
'rabbitmq', 5672, 'mkt', pika.PlainCredentials('rabbit', 'mrl2X0jwnYuCCiKFTshG7WKyOAhfDo')))
@ -86,11 +91,15 @@ def main():
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': 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']}})
if srcJson['state'] == 'HANGUP':
try:
# Проверяем заполнено ли поле recordURL, если нет то меняем статус на 4
if len(srcJson['recordUrl']) > 4:
coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'recordUrl': srcJson['recordUrl']}})
else:
coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'status': 4}})
except Exception as e:
print(e)
print(r)