DavidLiu 3 ay önce
ebeveyn
işleme
b7fc9dff34
1 değiştirilmiş dosya ile 4 ekleme ve 5 silme
  1. 4 5
      src/core/voip/bot.py

+ 4 - 5
src/core/voip/bot.py

@@ -535,7 +535,6 @@ class BotAgent:
         self.dataHandleServer = DataHandleServer(app)
         self.pjsua_thread = None
         self.start()
-        # threading.Thread(name="PJSUA-THREAD", target=self.create_pjsua2, daemon=True).start()
 
     def create_pjsua2(self, timeout_sec=86400):
         start_time = time.time()
@@ -605,7 +604,6 @@ class BotAgent:
             self.ep.libHandleEvents(100)
 
     def thread_health_check(self):
-        self.counter += 1
         _lock = self.cache.get_pjsua_thread_lock()
         if _lock:
             self.logger.error("daviddebugger::thread is lock, will restart")
@@ -620,12 +618,12 @@ class BotAgent:
         if self.acd_service:
             self.acd_service.transfer_to_agent(call_id, device_id, service_id, hold=True)
         # sip_headers = {'P-LIBRA-HangUpReason': 'transferToAgent', 'P-LIBRA-ServiceId': service_id}
-        try_count = 100
+        try_count = 1000
         while try_count >0:
             if self.cache.get_after_play_hold_music(call_id):
                 self.hangup(user_part)
                 break
-            time.sleep(0.1)
+            # time.sleep(0.1)
 
     def hangup(self, user_part, reason="NORMAL_CLEARING", **sip_headers):
         call_op_param = pj.CallOpParam(True)
@@ -697,7 +695,8 @@ class BotAgent:
 
     def start(self):
         self.is_stopping = False
-        self.pjsua_thread = threading.Thread(name="PJSUA-THREAD", target=self.create_pjsua2, daemon=True)
+        self.counter += 1
+        self.pjsua_thread = threading.Thread(name=f"PJSUA-THREAD-{self.counter}", target=self.create_pjsua2, daemon=True)
         self.pjsua_thread.start()
         self.logger.info("bot agent starting ...")