Explorar o código

Merge branch 'dev_20241205' of ssh://gitlab.fuxicarbon.com:1111/client_service/voice-gateway-service into dev_20241205

DavidLiu hai 4 meses
pai
achega
d9f09429df

+ 17 - 17
src/core/callcenter/agent.py

@@ -143,7 +143,7 @@ class AgentEventService:
 
             self.agent_actionlog_service.insert_service_state(agent_monitor, AgentServiceState.REPROCESSING, AgentLogState.CHANNEL_HANG_UP)
 
-            self.data_handle_server.update_record(call_id, time_end=datetime.utcnow())
+            self.data_handle_server.update_record(call_id, time_end=datetime.now())
             # 同步处理后处理置闲
             # reprocessingIdle(statusDto);
             # agentProducer.pushDelayedStatus(statusDto, reprocessingTimeout);
@@ -213,7 +213,7 @@ class AgentEventService:
 
             self.agent_actionlog_service.insert_service_state(agent_monitor, AgentServiceState.REPROCESSING,
                                                   AgentLogState.CHANNEL_HANG_UP, service_id=human_service_id)
-            self.data_handle_server.update_record(call_id, time_end=datetime.utcnow())
+            self.data_handle_server.update_record(call_id, time_end=datetime.now())
 
 
     def reprocessing_idle(self, state_data: AgentDelayStateData):
@@ -591,31 +591,31 @@ class AgentMonitorService:
     @with_app_context
     def update_checkin(self, agent_monitor):
         agent_monitor.check_state = AgentCheck.IN.code
-        agent_monitor.check_in_time = datetime.utcnow()
+        agent_monitor.check_in_time = datetime.now()
         agent_monitor.heart_state = AgentHeartState.NORMAL.code
-        agent_monitor.heart_time = datetime.utcnow()
+        agent_monitor.heart_time = datetime.now()
         db.session.commit()
 
     @with_app_context
     def update_checkout(self, agent_monitor):
         agent_monitor.check_state = AgentCheck.OUT.code
-        agent_monitor.check_out_time = datetime.utcnow()
+        agent_monitor.check_out_time = datetime.now()
         agent_monitor.service_state = AgentServiceState.LOGOUT.code
         agent_monitor.heart_state = AgentHeartState.DEFAULT.code
-        agent_monitor.heart_time = datetime.utcnow()
+        agent_monitor.heart_time = datetime.now()
         self.logger.info("update_checkout %s", agent_monitor.check_out_time)
         db.session.commit()
 
     @with_app_context
     def update_idle(self, agent_monitor):
         agent_monitor.service_state = AgentServiceState.IDLE.code
-        agent_monitor.idle_time = datetime.utcnow()
+        agent_monitor.idle_time = datetime.now()
         db.session.commit()
 
     @with_app_context
     def update_busy(self, agent_monitor):
         agent_monitor.service_state = AgentServiceState.BUSY.code
-        agent_monitor.busy_time = datetime.utcnow()
+        agent_monitor.busy_time = datetime.now()
         db.session.commit()
 
     @with_app_context
@@ -626,13 +626,13 @@ class AgentMonitorService:
     @with_app_context
     def update_calling(self, agent_monitor):
         agent_monitor.service_state = AgentServiceState.CALLING.code
-        agent_monitor.call_time = datetime.utcnow()
+        agent_monitor.call_time = datetime.now()
         db.session.commit()
 
     @with_app_context
     def update_processing(self, agent_monitor):
         agent_monitor.service_state = AgentServiceState.REPROCESSING.code
-        agent_monitor.hang_time = datetime.utcnow()
+        agent_monitor.hang_time = datetime.now()
         db.session.commit()
 
     @with_app_context
@@ -643,7 +643,7 @@ class AgentMonitorService:
     @with_app_context
     def update_heart_error(self, agent_monitor):
         agent_monitor.heart_state = AgentHeartState.ABNORMAL.code
-        agent_monitor.heart_time = datetime.utcnow()
+        agent_monitor.heart_time = datetime.now()
         db.session.commit()
 
     def _get_day_start(self):
@@ -670,7 +670,7 @@ class AgentActionLogService:
         if agent_log_enum:
             action_log.event_type = agent_log_enum.code
             action_log.event_desc = agent_log_enum.description
-        now = datetime.utcnow()
+        now = datetime.now()
         pre_date = None
         if agent_monitor.check_state == AgentCheck.IN.code:
             pre_date = agent_monitor.check_in_time
@@ -702,7 +702,7 @@ class AgentActionLogService:
         if agent_log_enum:
             action_log.event_type = agent_log_enum.code
             action_log.event_desc = agent_log_enum.description
-        now = datetime.utcnow()
+        now = datetime.now()
         pre_date = None
         if agent_monitor.service_state == AgentServiceState.IDLE.code:
             pre_date = agent_monitor.idle_time
@@ -779,7 +779,7 @@ class AgentStateService:
         key = self._check_in_key(saas_id)
         state_data = AgentStateData()
         state_data.status = HumanState.DEFAULT.code
-        state_data.time = datetime.utcnow().timestamp()
+        state_data.time = datetime.now().timestamp()
         self.redis_handler.redis.hset(key, phone_num, state_data.to_json_string())
         self.redis_handler.redis.expire(key, self._get_expire_time())
 
@@ -802,7 +802,7 @@ class AgentStateService:
         cache_agent_map = self.get_cache_agent_map(saas_id, service_id)
         if cache_agent_map and choose_phone_num in cache_agent_map:
             state_data = cache_agent_map[choose_phone_num]
-            state_data.assign_time = datetime.utcnow().timestamp() * 1000
+            state_data.assign_time = datetime.now().timestamp() * 1000
             self.redis_handler.redis.hset(key, choose_phone_num, state_data.to_json_string())
             self.redis_handler.redis.expire(key, self._get_expire_time())
             # self.update_report_state(saas_id, service_id)
@@ -825,7 +825,7 @@ class AgentStateService:
             state_data = cache_agent_map[phone_num]
 
         state_data.status = HumanState.IDLE.code
-        state_data.time = datetime.utcnow().timestamp() * 1000
+        state_data.time = datetime.now().timestamp() * 1000
         self.redis_handler.redis.hset(key, phone_num, state_data.to_json_string())
         self.redis_handler.redis.expire(key, self._get_expire_time())
         # self.update_report_state(saas_id, service_id)
@@ -866,7 +866,7 @@ class AgentStateService:
         return free_agents
 
     def get_idle_agents(self,cache_agent_list):
-        current_time =int(datetime.utcnow().timestamp() * 1000)  # 获取当前时间的毫秒级时间戳
+        current_time =int(datetime.now().timestamp() * 1000)  # 获取当前时间的毫秒级时间戳
         idle_agents = [
             agent for agent in cache_agent_list
             if agent.status == 1 and (

+ 2 - 2
src/core/callcenter/cache.py

@@ -123,12 +123,12 @@ class Cache:
         delay_action.uuid = str(uuid.uuid4())
         key = CTI_ENGINE_DELAY_ACTION % action
         msg = delay_action.to_json_string()
-        action_time = datetime.utcnow().timestamp()*1000 + timeouts * 1000
+        action_time = datetime.now().timestamp()*1000 + timeouts * 1000
         self.redis_handler.redis.zadd(key, {msg : action_time})
 
     def get_delay_message(self, action):
         key = CTI_ENGINE_DELAY_ACTION % action
-        current_time = int(datetime.utcnow().timestamp() * 1000)  # 毫秒级时间戳
+        current_time = int(datetime.now().timestamp() * 1000)  # 毫秒级时间戳
         members = self.redis_handler.redis.zrangebyscore(key, 0, current_time, start=0, num=DELAY_ACTION_BATCH_SIZE, withscores=True)
         if not members:
             return []

+ 3 - 3
src/core/callcenter/call.py

@@ -33,7 +33,7 @@ class CallService:
         call_id = 'C' + str(self.snowflake.next_id())
         device_id = 'D' + str(self.snowflake.next_id())
         # now = lambda: int(round(time.time() * 1000))
-        now = datetime.utcnow().timestamp()
+        now = datetime.now().timestamp()
         self.logger.info("CallService 人工外呼 agent:%s makecall, ctiFlowId:%s, callId:%s, callerDisplay:%s, called:%s"%
               (request.caller, request.cti_flow_id, call_id, request.caller_display, request.called))
 
@@ -65,7 +65,7 @@ class CallService:
         # # 创建一条通话记录
         # self.dataHandleServer.create_record({
         #     "session_id": call_id,
-        #     "time_begin": datetime.utcnow(),
+        #     "time_begin": datetime.now(),
         #     "category": 1,
         #     "agent_num":request.agent_id,
         #     "phone": request.called
@@ -103,7 +103,7 @@ class CallService:
         agent = self.cache.get_agent_info(call_info.saas_id, agent_number)
         device_id = 'T' + str(self.snowflake.next_id())
         # now = lambda: int(round(time.time() * 1000))
-        now = datetime.utcnow().timestamp()
+        now = datetime.now().timestamp()
 
         device_info = DeviceInfo(device_id=device_id, caller=caller, display=caller, called=agent_number, call_id=call_id,
                             call_time=now, cdr_type=CdrType.TRANSFER.code, device_type=DeviceType.AGENT.code,

+ 1 - 7
src/core/callcenter/config.py

@@ -17,14 +17,8 @@ class BaseConfig(object):
     DBNAME = 'libra_bot'
 
     SQLALCHEMY_DATABASE_URI = f"{DIALCT}+{DRITVER}://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DBNAME}?charset=utf8"
-    SQLALCHEMY_TRACK_MODIFICATIONS = True   # Disable track modifications
+    SQLALCHEMY_TRACK_MODIFICATIONS = False   # Disable track modifications
     SQLALCHEMY_ECHO = False  # Optional: Log SQL queries
-    SQLALCHEMY_ENGINE_OPTIONS= {
-        'connect_args': {
-            'init_command': "SET time_zone = 'Asia/Shanghai'"
-        }
-    }
-
 dictConfig({
         "version": 1,
         "disable_existing_loggers": False,  # 不覆盖默认配置

+ 27 - 27
src/core/callcenter/dao.py

@@ -19,8 +19,8 @@ class Bucket(db.Model):
     lower = db.Column(db.String(32), nullable=False, default='', comment='下限')
     upper = db.Column(db.String(64), nullable=False, default='', comment='上限')
     config = db.Column(db.String(100), nullable=False, default='', comment='拓展配置')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间' )
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间' )
 
     __table_args__ = (
         db.Index('idx_eid', 'eid', mysql_using='BTREE'),
@@ -61,8 +61,8 @@ class Agent(db.Model):
     agent_state = db.Column(db.SmallInteger, nullable=False, default=0, comment='账号状态 0:可用; 1:禁用')
     identity_type = db.Column(db.SmallInteger, nullable=False, default=0, comment='身份标识')
     is_delete = db.Column(db.SmallInteger, nullable=False, default=0, comment='删除标识')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间')
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间')
     user_id= db.Column(db.BigInteger, nullable=False, default='', comment='用户id')
 
     __table_args__ = (
@@ -122,8 +122,8 @@ class AgentActionLog(db.Model):
     event_type = db.Column(db.Integer, nullable=False, default=0, comment='日志事件类型')
     event_desc = db.Column(db.String(100), nullable=False, default='', comment='日志事件描述')
     is_delete = db.Column(db.SmallInteger, nullable=False, default=0, comment='删除标识')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间')
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间')
 
     __table_args__ = (
         db.Index('idx_create_time', 'create_time'),
@@ -180,8 +180,8 @@ class AgentLog(db.Model):
     event = db.Column(db.String(32), nullable=False, default='0', comment='事件')
     content = db.Column(db.String(64), nullable=False, default='', comment='描述')
     is_delete = db.Column(db.SmallInteger, nullable=False, default=0, comment='删除标识')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间')
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间')
 
     __table_args__ = (
         db.Index('idx_saas_id_agent_num', 'saas_id', 'agent_num'),
@@ -222,19 +222,19 @@ class AgentMonitor(db.Model):
     identity_type = db.Column(db.SmallInteger, nullable=False, default=0, comment='身份标识')
     check_state = db.Column(db.SmallInteger, nullable=False, default=1, comment='是否签入 0:是 1:否 默认未签入')
     check_scene = db.Column(db.String(16), nullable=False, default='', comment='迁入场景')
-    check_in_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='签入时间')
-    check_out_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='签出时间')
+    check_in_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='签入时间')
+    check_out_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='签出时间')
     service_state = db.Column(db.SmallInteger, nullable=False, default=0, comment='坐席服务状态 0: 未登录(签出) 1: 置忙 2: 置闲 3: 通话中 4: 后处理 5: 拨号中')
-    busy_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='置忙时间')
-    idle_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='置闲时间')
-    call_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='接通时间')
-    hang_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='挂断时间')
+    busy_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='置忙时间')
+    idle_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='置闲时间')
+    call_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='接通时间')
+    hang_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='挂断时间')
     heart_state = db.Column(db.SmallInteger, nullable=False, default=0, comment='心跳状态 0: 默认 1:正常  2: 异常')
-    heart_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='正常心跳时间')
+    heart_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='正常心跳时间')
     session_id = db.Column(db.String(64), nullable=False, default='', comment='sessionId')
     is_delete = db.Column(db.SmallInteger, nullable=False, default=0, comment='删除标识')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间')
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间')
 
     __table_args__ = (
         db.UniqueConstraint('saas_id', 'agent_num', name='uniq_saas_id_agent_num'),
@@ -285,8 +285,8 @@ class Phone(db.Model):
     wss_server = db.Column(db.String(64), nullable=False, default='', comment='WSS服务器')
     ice_server = db.Column(db.String(64), nullable=False, default='', comment='ICE服务器')
     is_delete = db.Column(db.SmallInteger, nullable=False, default=0, comment='删除标识')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间')
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间')
 
     __table_args__ = (
         db.Index('idx_vcc_id_phone_num', 'saas_id', 'phone_num'),
@@ -333,8 +333,8 @@ class HumanService(db.Model):
     queue_music = db.Column(db.String(32), nullable=False, default='', comment='排队音 全局配置')
     direct_queue_type = db.Column(db.String(32), nullable=False, default='', comment='直接连接 媒体类型 默认1 接入码直接转人工服务能听到排队音 0:直接排队不连接媒体; 1:直接排队连接媒体 全局配置')
     is_delete = db.Column(db.Boolean, nullable=False, default=False, comment='删除标识')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间')
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间')
 
     # Indexes
     __table_args__ = (
@@ -380,8 +380,8 @@ class HumanServiceMap(db.Model):
     agent_id = db.Column(db.String(32), nullable=False, default='', comment='坐席工号')
     state = db.Column(db.Boolean, nullable=False, default=0, comment='状态 1激活(签入)')
     is_delete = db.Column(db.Boolean, nullable=False, default=0, comment='删除标识')
-    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, comment='更新时间')
-    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcnow, comment='创建时间')
+    update_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
+    create_time = db.Column(db.TIMESTAMP, nullable=False, default=datetime.now, comment='创建时间')
 
     # Indexes
     __table_args__ = (
@@ -415,9 +415,9 @@ class Whitelist(db.Model):
     del_flag = db.Column(db.SmallInteger, nullable=False, default=False, comment='删除标志(0代表存在 2代表删除)')
     revision = db.Column(db.Integer, nullable=True, comment='乐观锁')
     create_by = db.Column(db.String(32), nullable=True, comment='创建人')
-    create_time = db.Column(db.DateTime, nullable=True, default=datetime.utcnow, comment='创建时间')
+    create_time = db.Column(db.DateTime, nullable=True, default=datetime.now, comment='创建时间')
     update_by = db.Column(db.String(32), nullable=True, comment='更新人')
-    update_time = db.Column(db.DateTime, nullable=True, onupdate=datetime.utcnow, comment='更新时间')
+    update_time = db.Column(db.DateTime, nullable=True, onupdate=datetime.now, comment='更新时间')
     remark = db.Column(db.String(500), nullable=True, comment='备注')
 
     def to_dict(self):
@@ -459,9 +459,9 @@ class CallRecord(db.Model):
     del_flag = db.Column(db.SmallInteger, nullable=False, default=0, comment='删除标志(0代表存在 2代表删除)')
     revision = db.Column(db.Integer, nullable=True, comment='乐观锁')
     create_by = db.Column(db.String(32), nullable=True, default="admin", comment='创建人')
-    create_time = db.Column(db.DateTime, nullable=True, default=datetime.utcnow, comment='创建时间')
+    create_time = db.Column(db.DateTime, nullable=True, default=datetime.now, comment='创建时间')
     update_by = db.Column(db.String(32), nullable=True, default="admin", comment='更新人')
-    update_time = db.Column(db.DateTime, nullable=True, onupdate=datetime.utcnow, comment='更新时间')
+    update_time = db.Column(db.DateTime, nullable=True, onupdate=datetime.now, comment='更新时间')
 
     def __repr__(self):
         return json.dumps(self.to_dict())

+ 5 - 7
src/core/callcenter/data_handler.py

@@ -12,7 +12,7 @@ class DataHandleServer:
     def create_record(self, call_id, caller_number, call_type, service_category=None, destination=None, category=0):
         call_info = {
             "session_id": call_id,
-            "time_begin": datetime.utcnow(),
+            "time_begin": datetime.now(),
             "category": category,
             "phone": caller_number,
             "type": call_type,
@@ -42,6 +42,10 @@ class DataHandleServer:
     @with_app_context
     def update_record(self, session_id, **kwargs):
         call_record = CallRecord.query.filter(CallRecord.session_id == session_id).first()
+        time_end = kwargs.get('time_end')
+        if time_end:
+            bot_record = BotRecords.query.filter(BotRecords.session == session_id).first()
+            call_record.bussiness_type = bot_record.intent
         # 动态更新字段
         for key, value in kwargs.items():
             if hasattr(call_record, key):
@@ -96,9 +100,3 @@ class DataHandleServer:
         agent_monitor.service_state = service_state
         db.session.commit()
 
-    @with_app_context
-    def update_call_record_bussiness_type(self, session):
-        BotRecord = BotRecords.query.filter(BotRecords.session == session).first()
-        print("BotRecord",BotRecord.intent,session,flush=True)
-        self.update_record(session, bussiness_type=BotRecord.intent)
-        db.session.commit()

+ 1 - 1
src/core/callcenter/esl/client.py

@@ -603,7 +603,7 @@ class OutboundClient:
         def build_call_info(self, call_id, device_id, new_device_id, destination, bucket_type, **kwargs):
             caller = kwargs.get('Channel-Caller-ID-Number')
             called = destination
-            now = datetime.utcnow().timestamp()
+            now = datetime.now().timestamp()
 
             call_info = CallInfo(call_id=call_id, agent_key=destination,
                                  caller=caller, called=called, direction=Direction.INBOUND.code,

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

@@ -91,7 +91,7 @@ class ChannelAnswerHandler(EslEventHandler):
         self.logger.info("呼另外一侧电话: callId: %s, display:%s, called:%s, deviceId: %s "%(call_id, call.called_display, called, device_id))
 
         # now = lambda: int(round(time.time() * 1000))
-        now = datetime.utcnow().timestamp()
+        now = datetime.now().timestamp()
         route_gateway = self.cache.get_route_gateway(call.saas_id)
         agent = self.cache.get_agent_info(call.saas_id, call.agent_key)
         new_device = DeviceInfo(device_id=new_device_id, call_id=call_id, agent_key=call.agent_key,

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

@@ -115,7 +115,7 @@ class ChannelHangupHandler(EslEventHandler):
             #     if call_info.answer_time:
             #         call_info.end_time = timestamp
             #         call_info.talk_time = int(call_info.end_time) - int(call_info.answer_time)
-            #         self.dataHandleServer.update_record(call_id, {"time_end": datetime.utcnow(), "times": int(call_info.talk_time / 1_000_000) })
+            #         self.dataHandleServer.update_record(call_id, {"time_end": datetime.now(), "times": int(call_info.talk_time / 1_000_000) })
             #
             #     self.logger.info('全部挂断 %s', device_info.device_type)
             #     # 更新坐席状态

+ 1 - 1
src/core/callcenter/push.py

@@ -44,7 +44,7 @@ class PushHandler:
                 'scene': scene.code,
                 '_shortagentid': user_id,
                 '_astate': service_state.code,
-                '_atime': datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
+                '_atime': datetime.now().strftime("%Y-%m-%d %H:%M:%S")
             }
         }
         self.logger.info("OnAgentReport event triger:", json.dumps(data))

+ 2 - 2
src/core/voip/bot.py

@@ -366,8 +366,8 @@ class MyCall(pj.Call):
         elif action_code == 'transfer':  # 转人工
             print('todo 转人工')
             self.agent.transfer(user_part=self.user_part, call_id=self.session_id, device_id=self.device_id)
-            #更新通话记录机器人意图
-            self.agent.dataHandleServer.update_call_record_bussiness_type(self.session_id)
+            #更新通话记录
+            self.agent.dataHandleServer.update_record(self.session_id, service_category=2)
 
 class ToTextBotAgent:
     def __init__(self, user_asr_text, call_agent):