|
@@ -78,9 +78,9 @@ class MyAudioMediaPort(pj.AudioMediaPort):
|
|
|
if self.call.inputType == '1.0':
|
|
|
time_difference = int(current_time - self.call.inputLongStart)
|
|
|
# print('current_time - self.call.inputLongStart:',time_difference > 35, self.call.txtLock , play_complete)
|
|
|
- if int(current_time - self.call.inputLongStart) > 35 and play_complete and asr_text:
|
|
|
+ if time_difference > 35 and play_complete:
|
|
|
self.user_asr_texts.append(f"DTMF({self.call.digit})DTMF")
|
|
|
- user_asr_text = asr_text if len(self.user_asr_texts) == 1 else '###'.join(self.user_asr_texts)
|
|
|
+ user_asr_text = self.user_asr_texts[0] if len(self.user_asr_texts) == 1 else '###'.join(self.user_asr_texts)
|
|
|
self.user_asr_texts.clear()
|
|
|
self.call.chat(user_asr_text)
|
|
|
# print("测试超长", user_asr_text)
|
|
@@ -91,12 +91,10 @@ class MyAudioMediaPort(pj.AudioMediaPort):
|
|
|
else:
|
|
|
if asr_text and not play_complete:
|
|
|
self.user_asr_texts.append(asr_text)
|
|
|
- print('user_asr_texts', self.user_asr_texts)
|
|
|
if (asr_text and play_complete) or (play_complete and self.user_asr_texts):
|
|
|
- if asr_text: # 等价于 if asr_text is not None and asr_text != ""
|
|
|
+ if asr_text:
|
|
|
self.user_asr_texts.append(asr_text)
|
|
|
- # self.user_asr_texts.append(asr_text)
|
|
|
- user_asr_text = asr_text if len(self.user_asr_texts) == 1 else '###'.join(self.user_asr_texts)
|
|
|
+ user_asr_text = self.user_asr_texts[0] if len(self.user_asr_texts) == 1 else '###'.join(self.user_asr_texts)
|
|
|
self.user_asr_texts.clear()
|
|
|
self.call.chat(user_asr_text)
|
|
|
|
|
@@ -109,7 +107,6 @@ class MyAudioMediaPort(pj.AudioMediaPort):
|
|
|
self.call.cur_player_file, self.call.wait_time, self.call.inputType,self.call.action, self.call.node_id = self.get_player_file()
|
|
|
# 重置播放完成标志和超时计时器,确保新的播放从头开始计时
|
|
|
self.call.reset_wait_time()
|
|
|
- # self.call.txtLock = False
|
|
|
self.call.send_bot_speaker(self.call.cur_player_file)
|
|
|
except:
|
|
|
pass
|