Davidliu преди 3 месеца
родител
ревизия
df947425a9
променени са 3 файла, в които са добавени 17 реда и са изтрити 12 реда
  1. BIN
      src.tar.gz
  2. 1 1
      src/core/callcenter/esl/handler/channel_hangup_handler.py
  3. 16 11
      src/core/voip/asr.py

BIN
src.tar.gz


+ 1 - 1
src/core/callcenter/esl/handler/channel_hangup_handler.py

@@ -96,7 +96,7 @@ class ChannelHangupHandler(EslEventHandler):
             bucket_type = call_info.bucket_type if call_info.bucket_type else "EMPTY"
             bucket_type = call_info.bucket_type if call_info.bucket_type else "EMPTY"
             registry.CALL_HANGUP_REQUESTS.labels(f"{bucket_type}", f"{device_info.sip_status}").inc()
             registry.CALL_HANGUP_REQUESTS.labels(f"{bucket_type}", f"{device_info.sip_status}").inc()
 
 
-            self.logger.info('ChannelHangupHandler, device_id=%s, hangup_reason=%s, device_type=%s, cdr_type=%s, end_time=%s, skip_hangup_all=%s, answer_count=%s, hangup_count=%s' % (device_id, hangup_reason, device_info.device_type, device_info.cdr_type, call_info.end_time, skip_hangup_all, call_info.answer_count, call_info.hangup_count))
+            self.logger.info('ChannelHangupHandler, call_id=%s, device_id=%s, hangup_reason=%s, device_type=%s, cdr_type=%s, end_time=%s, skip_hangup_all=%s, answer_count=%s, hangup_count=%s' % (call_id, device_id, hangup_reason, device_info.device_type, device_info.cdr_type, call_info.end_time, skip_hangup_all, call_info.answer_count, call_info.hangup_count))
             # 如果是转人工
             # 如果是转人工
             # if 'transferToAgent' == hangup_reason and DeviceType.ROBOT.code == device_info.device_type:
             # if 'transferToAgent' == hangup_reason and DeviceType.ROBOT.code == device_info.device_type:
             #     call_info.answer_flag = AnswerFlag.TRANSFER_TO_AGENT.code
             #     call_info.answer_flag = AnswerFlag.TRANSFER_TO_AGENT.code

+ 16 - 11
src/core/voip/asr.py

@@ -114,17 +114,22 @@ class TestSt:
                 on_close=self.test_on_close,
                 on_close=self.test_on_close,
                 callback_args=[self.__id]
                 callback_args=[self.__id]
             )
             )
-            self.sr.start(
-                aformat="pcm",
-                sample_rate=8000,
-                enable_intermediate_result=True,
-                enable_punctuation_prediction=True,
-                enable_inverse_text_normalization=True
-            )
-            self.sr.ctrl(ex={'max_sentence_silence': '1200ms', 'disfluency': True,'enable_words': True })
-            self.logger.debug(f"[{self.__id}]ASR session started. {count}")
-            self.__event.wait(timeout=.5)
-            self.logger.debug(f"[{self.__id}]ASR session started. {count}")
+            try:
+                self.sr.start(
+                    aformat="pcm",
+                    sample_rate=8000,
+                    enable_intermediate_result=True,
+                    enable_punctuation_prediction=True,
+                    enable_inverse_text_normalization=True
+                )
+                self.sr.ctrl(ex={'max_sentence_silence': '1200ms', 'disfluency': True,'enable_words': True })
+                self.logger.debug(f"[{self.__id}]ASR session started. {count}")
+                self.__event.wait(timeout=.5)
+                self.logger.debug(f"[{self.__id}]ASR session started. {count}")
+            except Exception as e:
+                traceback.print_exc()
+                self.logger.debug(f"[{self.__id}]ASR session start exception. {e}")
+
             count = count + 1
             count = count + 1
 
 
     def test_on_sentence_begin(self, message, *args):
     def test_on_sentence_begin(self, message, *args):