ADD. New Status Recall
This commit is contained in:
		
							parent
							
								
									c52dc734f6
								
							
						
					
					
						commit
						ccd5d6874d
					
				
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +1,2 @@
 | 
			
		||||
**/.venv
 | 
			
		||||
**/.venv
 | 
			
		||||
**/.vscode
 | 
			
		||||
@ -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,21 +34,27 @@
 | 
			
		||||
        <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>
 | 
			
		||||
            <td>
 | 
			
		||||
                {% if entry.status == 0 %}
 | 
			
		||||
                    Вызов принят
 | 
			
		||||
                Вызов принят
 | 
			
		||||
                {% elif entry.status == 1 %}
 | 
			
		||||
                    Вызов не принят
 | 
			
		||||
                Вызов не принят
 | 
			
		||||
                {% elif entry.status == 2 %}
 | 
			
		||||
                    Перезвонили
 | 
			
		||||
                Перезвонили
 | 
			
		||||
                {% elif entry.status == 2 %}
 | 
			
		||||
                Абонент не взял трубку
 | 
			
		||||
                {% elif entry.status == 9 %}
 | 
			
		||||
                    Абонент заблокирован
 | 
			
		||||
                Абонент заблокирован
 | 
			
		||||
                {% endif %}
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
 | 
			
		||||
@ -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:
 | 
			
		||||
                        coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'recordUrl': srcJson['recordUrl']}})
 | 
			
		||||
                    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)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user