|
@@ -78,7 +78,7 @@ 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 not self.call.txtLock:
|
|
|
+ if int(current_time - self.call.inputLongStart) > 35 and play_complete and asr_text:
|
|
|
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)
|
|
|
self.user_asr_texts.clear()
|
|
@@ -106,7 +106,7 @@ 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.txtLock = False
|
|
|
self.call.send_bot_speaker(self.call.cur_player_file)
|
|
|
#播放完毕执行的动作
|
|
|
self.call.say_end_action(self.call.action)
|
|
@@ -248,19 +248,19 @@ class MyCall(pj.Call):
|
|
|
player_id = murmur3_32(self.cur_player_file)
|
|
|
return self.player_complete_dict.get(player_id)
|
|
|
def onDtmfDigit(self, prm):
|
|
|
- if not self.txtLock: # 判断是否播放完成 否则不记录用户说的内容
|
|
|
- digit = prm.digit
|
|
|
- self.reset_wait_time()
|
|
|
- # 假设为超长类型按键 把用户输入的按键进行拼接 如果为# 则把用户输入所有按键放入队列并发送文本机器人
|
|
|
- # 如果为非正常按键服务 输入以后直接发送文本机器人
|
|
|
- if self.inputType == '1.0':
|
|
|
- if digit != '#':
|
|
|
- self.digit += digit
|
|
|
- elif digit == '#':
|
|
|
- # self.user_asr_text_queue.put(f"DTMF({self.digit})DTMF")
|
|
|
- self.chat(f"DTMF({self.digit})DTMF")
|
|
|
- else:
|
|
|
- self.user_asr_text_queue.put(f"DTMF({digit})DTMF")
|
|
|
+ # if not self.txtLock: # 判断是否播放完成 否则不记录用户说的内容
|
|
|
+ digit = prm.digit
|
|
|
+ self.reset_wait_time()
|
|
|
+ # 假设为超长类型按键 把用户输入的按键进行拼接 如果为# 则把用户输入所有按键放入队列并发送文本机器人
|
|
|
+ # 如果为非正常按键服务 输入以后直接发送文本机器人
|
|
|
+ if self.inputType == '1.0':
|
|
|
+ if digit != '#':
|
|
|
+ self.digit += digit
|
|
|
+ elif digit == '#':
|
|
|
+ # self.user_asr_text_queue.put(f"DTMF({self.digit})DTMF")
|
|
|
+ self.chat(f"DTMF({self.digit})DTMF")
|
|
|
+ else:
|
|
|
+ self.user_asr_text_queue.put(f"DTMF({digit})DTMF")
|
|
|
|
|
|
def onCallState(self, prm):
|
|
|
call_info = self.getInfo()
|