|
@@ -216,6 +216,7 @@ class MyCall(pj.Call):
|
|
|
self.inputLongStart = time.time() #长按键开始时间
|
|
|
|
|
|
self.inter_action_total = 0
|
|
|
+ self.statistics_lock = False
|
|
|
|
|
|
|
|
|
def wait_time_check(self, current_time, wait_time):
|
|
@@ -285,6 +286,8 @@ class MyCall(pj.Call):
|
|
|
self.player = None # 或调用播放器停止方法
|
|
|
# 远程挂机之后要将分机号回收
|
|
|
self.agent.release(self.user_part)
|
|
|
+ self.end_statistics()
|
|
|
+
|
|
|
|
|
|
def onCallMediaState(self, prm):
|
|
|
call_info = self.getInfo()
|
|
@@ -361,9 +364,12 @@ class MyCall(pj.Call):
|
|
|
#更新通话记录
|
|
|
self.agent.dataHandleServer.update_record(self.session_id, service_category=2)
|
|
|
def end_statistics(self):
|
|
|
- latency = (time.time() - self.start_time)
|
|
|
- registry.BOT_CALL_DURATION.labels(self.taskId).observe(latency)
|
|
|
- registry.BOT_INTERACTION_ROUNDS.labels(self.taskId).inc(self.inter_action_total)
|
|
|
+ if not self.statistics_lock:
|
|
|
+ self.statistics_lock = True
|
|
|
+ self.logger.info(f"self.inter_action_total:{self.inter_action_total}")
|
|
|
+ latency = (time.time() - self.start_time)
|
|
|
+ registry.BOT_CALL_DURATION.labels(self.taskId).observe(latency)
|
|
|
+ registry.BOT_INTERACTION_ROUNDS.labels(self.taskId).observe(self.inter_action_total)
|
|
|
|
|
|
class ToTextBotAgent:
|
|
|
def __init__(self, user_asr_text, call_agent):
|