774056846 vor 4 Monaten
Ursprung
Commit
6061e9f6c2

+ 4 - 4
src/core/callcenter/api.py

@@ -16,7 +16,7 @@ from src.core.callcenter.enumeration import CallType, DeviceType, Direction, Cdr
 
 class BaseApi:
     @classmethod
-    def from_json(cls, json_string):
+    def from_json(cls, json_string=None):
         data = get_json_dict(json_string)
         return cls(**data)
 
@@ -500,15 +500,15 @@ class CallInfo(BaseApi):
         self.call_details = call_details  # 电话流程
 
     @classmethod
-    def from_json(cls, json_string):
+    def from_json(cls, json_string=None):
         data = get_json_dict(json_string)
         device_info_map: Dict[str, Any] = {key: DeviceInfo(**value) for key, value in data.get('device_info_map', {}).items()}
         follow_data: Dict[str, Any] = {key: value for key, value in data.get('follow_data', {}).items()}
         process_data: Dict[str, Any] = {key: value for key, value in data.get('process_data', {}).items()}
         next_commands = [NextCommand(**x) for x in data.get('next_commands', [])]
         call_details = [CallDetail(**x) for x in data.get('call_details', [])]
-
-        return CallInfo(core_uuid=data.get('core_uuid'), cti_flow_id=data.get('cti_flow_id'), call_id=data.get('call_id'),
+        print("daviddebugger::data:%s"%data, flush=True)
+        return cls(core_uuid=data.get('core_uuid'), cti_flow_id=data.get('cti_flow_id'), call_id=data.get('call_id'),
                    conference=data.get('conference'), saas_id=data.get('saas_id'), group_id=data.get('group_id'),
                    hidden_customer=data.get('hidden_customer'), caller_display=data.get('caller_display'),
                    caller=data.get('caller'), called_display=data.get('called_display'), called=data.get('called'),

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

@@ -64,7 +64,7 @@ class Cache:
     def add_call_info(self, call: CallInfo):
         for k, v in call.device_info_map.items():
             self.add_device(k, call.call_id)
-        # self.logger.info('add_call_info', call.call_id, call)
+        self.logger.info('daviddebugger::add_call_info call_id:%s, call=%s'% (call.call_id, call))
         self.redis_handler.set(CALL_INFO + call.call_id, call.to_json_string(), self.cacheDay * 24 * 60 * 60)
 
 
@@ -79,8 +79,7 @@ class Cache:
         text = None
         if call_id:
             text = self.redis_handler.get(CALL_INFO + call_id)
-            # self.logger.info('get_call_info', call_id, text)
-            # sys.stdout.flush()  # 强制刷新输出缓冲区
+            self.logger.info('daviddebugger::get_call_info call_id:%s, text:%s'% (call_id, text))
         if text:
             return CallInfo.from_json(text)
 

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

@@ -82,7 +82,7 @@ CTI_ENGINE_DELAY_ACTION = "DELAY:ACTION:%s"
 CTI_ENGINE_DELAY_ACTION_LOCK = "DELAY:ACTION:LOCK:%s"
 NEED_PLAY_HOLD_MUSIC = "CTI:ENGINE:NEED:HOLD:%s"
 
-def get_json_dict(json_string):
+def get_json_dict(json_string=None):
     data = json_string
     if isinstance(json_string, str):
         data = json.loads(json_string)

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

@@ -46,7 +46,7 @@ class ChannelParkHandler(EslEventHandler):
         device_info = call_info.device_info_map.get(device_id)
         hold = self.cache.get_need_play_hold_music(call_id)
         self.logger.info('debugger, ChannelParkHandler, hold=%s, device_info=%s' % (hold, device_info))
-        if hold and "false" != hold and device_info.device_type == DeviceType.CUSTOMER.code:
+        if hold and device_info.device_type == DeviceType.CUSTOMER.code:
             self.inbound_client.hold_play(device_id, HOLD_MUSIC_PATH)
             # self.cache.del_need_play_hold_music(call_id)
             # self.inbound_client.set_var(device_id, SIP_HEADER + sipHeaderHoldMusic, "false")