Davidliu 1 month ago
parent
commit
8754e59610

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

@@ -49,7 +49,7 @@ class AcdService:
             self.add_acd_queue(call_info, service_id)
         else:
             # 有空闲坐席,直接转接
-            self.logger.info("AcdService transferToAgent agentNumber not empty %s, serviceId:%s,caller:%s,called:%s,callId:%s"%(agent_number, service_id, call_info.caller,call_info.called, call_info.call_id))
+            self.logger.info("AcdService transferToAgent agentNumber is %s, serviceId:%s,caller:%s,called:%s,callId:%s"%(agent_number, service_id, call_info.caller,call_info.called, call_info.call_id))
             self.call_service.transfer(call_info, agent_number, service_id)
             # self.agent_state_service.busy(call_info.saas_id, agent_number, agent_number)
         self.cache.add_call_info(call_info)

+ 6 - 4
src/core/callcenter/agent.py

@@ -821,8 +821,8 @@ class AgentStateService:
         self.logger = app.logger
         self.redis_handler = RedisHandler()
         self.assigned_recycle_millisecond = 30 * 1000
-        self.state_service_id_data_map = defaultdict(dict)
-        self.executor = ThreadPoolExecutor(max_workers=10)
+        # self.state_service_id_data_map = defaultdict(dict)
+        # self.executor = ThreadPoolExecutor(max_workers=10)
         self.data_handle_server = DataHandleServer(app)
         self.agent_monitor_service = AgentMonitorService(app)
         self.agent_actionlog_service = AgentActionLogService(app)
@@ -903,8 +903,10 @@ class AgentStateService:
 
     def handle_lock_agent(self, choose_phone_num, saas_id, service_id='00000000000000000'):
         key = self._lock_key(saas_id, service_id, choose_phone_num)
-        self.redis_handler.redis.set(key, 1, nx=True, ex=self._get_expire_time())
-        self.logger.info('lockAgent %s %s %s'% (saas_id, service_id, choose_phone_num))
+        expire = self._get_expire_time()
+        self.redis_handler.redis.set(key, 1, nx=True, ex=expire)
+        res = self.redis_handler.redis.get(key)
+        self.logger.info('lockAgent %s %s %s %s %s'% (saas_id, service_id, choose_phone_num, expire, res))
 
     def handle_release_agent_lock(self, choose_phone_num, saas_id, service_id='00000000000000000'):
         key = self._lock_key(saas_id, service_id, choose_phone_num)

+ 2 - 0
src/core/callcenter/dao.py

@@ -454,6 +454,8 @@ class CallRecord(db.Model):
     status = db.Column(db.SmallInteger, nullable=True, comment='通话状态(0未接听 1已接通)')
     sip_status = db.Column(db.String(32), nullable=True, comment='sip码')
     sip_hangup_cause = db.Column(db.String(32), nullable=True, comment='sip挂机描述')
+    hangup_dir = db.Column(db.SmallInteger, nullable=True, comment='挂机方向:1 主叫 2 被叫 3 机器人')
+    hangup_reason = db.Column(db.String(255), nullable=True, comment='挂机原因')
     phone = db.Column(db.String(20), nullable=True, comment='电话号码')
     bussiness_type = db.Column(db.String(50), nullable=True, comment='业务类型(创个返回字符串)')
     url = db.Column(db.String(255), nullable=True, comment='录音的地址')

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

@@ -417,7 +417,7 @@ class HangupDir(Enum):
 
     HOST_HANGUP = (1, "主叫挂断")
     CUSTOMER_HANGUP = (2, "被叫挂断")
-    PLATFORM_HANGUP = (3, "平台挂机")
+    ROBOT_HANGUP = (3, "平台挂机")
 
     def __init__(self, code=None, description=None):
         self.code = code

+ 2 - 0
src/core/callcenter/esl/handler/channel_hangup_handler.py

@@ -281,6 +281,8 @@ class ChannelHangupHandler(EslEventHandler):
             call_info.hangup_dir = HangupDir.HOST_HANGUP.code
         elif DeviceType.CUSTOMER.code == device_info.device_type:
             call_info.hangup_dir = HangupDir.CUSTOMER_HANGUP.code
+        elif DeviceType.ROBOT.code == device_info.device_type:
+            call_info.hangup_dir = HangupDir.ROBOT_HANGUP.code
 
         # if not call_info.end_time:
         #     call_info.end_time = device_info.end_time