ADD. New Status Recall
This commit is contained in:
		
							parent
							
								
									c52dc734f6
								
							
						
					
					
						commit
						ccd5d6874d
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +1,2 @@
 | 
				
			|||||||
**/.venv
 | 
					**/.venv
 | 
				
			||||||
 | 
					**/.vscode
 | 
				
			||||||
@ -11,7 +11,8 @@
 | 
				
			|||||||
<header>
 | 
					<header>
 | 
				
			||||||
    <a href="/web/call/status/0">Входящий вызов принят</a>
 | 
					    <a href="/web/call/status/0">Входящий вызов принят</a>
 | 
				
			||||||
    <a href="/web/call/status/1">Входящий вызов не принят</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>
 | 
					    <p>
 | 
				
			||||||
    <form name="search" action="/web/call/find/" method="get" class="search">
 | 
					    <form name="search" action="/web/call/find/" method="get" class="search">
 | 
				
			||||||
        <label class="search_label">Поиск</label>
 | 
					        <label class="search_label">Поиск</label>
 | 
				
			||||||
@ -33,9 +34,13 @@
 | 
				
			|||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
            <!-- <td>{{ entry.client }}</td> -->
 | 
					            <!-- <td>{{ entry.client }}</td> -->
 | 
				
			||||||
            {% if entry.important == True %}
 | 
					            {% 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 %}
 | 
					            {% 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 %}
 | 
					            {% endif %}
 | 
				
			||||||
            <!-- <td>{{ entry.Operator }}</td> -->
 | 
					            <!-- <td>{{ entry.Operator }}</td> -->
 | 
				
			||||||
            <td>{{ entry.time }}</td>
 | 
					            <td>{{ entry.time }}</td>
 | 
				
			||||||
@ -46,6 +51,8 @@
 | 
				
			|||||||
                Вызов не принят
 | 
					                Вызов не принят
 | 
				
			||||||
                {% elif entry.status == 2 %}
 | 
					                {% elif entry.status == 2 %}
 | 
				
			||||||
                Перезвонили
 | 
					                Перезвонили
 | 
				
			||||||
 | 
					                {% elif entry.status == 2 %}
 | 
				
			||||||
 | 
					                Абонент не взял трубку
 | 
				
			||||||
                {% elif entry.status == 9 %}
 | 
					                {% elif entry.status == 9 %}
 | 
				
			||||||
                Абонент заблокирован
 | 
					                Абонент заблокирован
 | 
				
			||||||
                {% endif %}
 | 
					                {% endif %}
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,11 @@ coll_userkey = db_base['userkey']
 | 
				
			|||||||
#    return response
 | 
					#    return response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Stats:
 | 
				
			||||||
 | 
					# 0 - ответили
 | 
				
			||||||
 | 
					# 1 - не приняли
 | 
				
			||||||
 | 
					# 2 - перезвонили успешно
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
    connection = pika.BlockingConnection(pika.ConnectionParameters(
 | 
					    connection = pika.BlockingConnection(pika.ConnectionParameters(
 | 
				
			||||||
        'rabbitmq', 5672, 'mkt', pika.PlainCredentials('rabbit', 'mrl2X0jwnYuCCiKFTshG7WKyOAhfDo')))
 | 
					        'rabbitmq', 5672, 'mkt', pika.PlainCredentials('rabbit', 'mrl2X0jwnYuCCiKFTshG7WKyOAhfDo')))
 | 
				
			||||||
@ -86,11 +91,15 @@ def main():
 | 
				
			|||||||
            if srcJson['direction'] == 'external':
 | 
					            if srcJson['direction'] == 'external':
 | 
				
			||||||
                # coll_phone.update_one({'$and': [{'client': srcJson['to']}, {'status': 1}]}, {
 | 
					                # coll_phone.update_one({'$and': [{'client': srcJson['to']}, {'status': 1}]}, {
 | 
				
			||||||
                #                       '$set': {'status': 2}})
 | 
					                #                       '$set': {'status': 2}})
 | 
				
			||||||
                r = coll_phone.update_one({'$and': [{'client': {'$regex': srcJson['to']}}, {'status': 1}]}, {
 | 
					                #r = coll_phone.update_one({'$and': [{'client': {'$regex': srcJson['to']}}, {'status': 1}]}, {'$set': {'status': 2, 'callid': srcJson['uuid']}})
 | 
				
			||||||
                                      '$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':
 | 
					                if srcJson['state'] == 'HANGUP':
 | 
				
			||||||
                    try: 
 | 
					                    try: 
 | 
				
			||||||
 | 
					                        # Проверяем заполнено ли поле recordURL, если нет то меняем статус на 4
 | 
				
			||||||
 | 
					                        if len(srcJson['recordUrl']) > 4:
 | 
				
			||||||
                            coll_phone.update_one({'callid':srcJson['uuid']}, {'$set': {'recordUrl': srcJson['recordUrl']}})
 | 
					                            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:
 | 
					                    except Exception as e:
 | 
				
			||||||
                        print(e)
 | 
					                        print(e)
 | 
				
			||||||
                print(r)
 | 
					                print(r)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user