DavidLiu před 3 měsíci
rodič
revize
95ef578e40

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

@@ -561,22 +561,22 @@ class OutboundClient:
                     registry.CALL_INCOMING_REQUESTS.labels(f"{_bucket_call_type}").inc()
                     self.server.dataHandleServer.create_record(call_id, caller_number, _bucket_call_type, service_category=service_category, destination=destination)
 
-                    # try:
-                    #     con.disconnect()
-                    #     self.server.logger.info("connection disconnected !!!")
-                    # except:
-                    #     traceback.print_exc()
+                    try:
+                        con.disconnect()
+                        self.server.logger.info("connection disconnected !!!")
+                    except:
+                        traceback.print_exc()
                 else:
                     self.server.logger.info("Failed to connect to FreeSWITCH")
             except:
                 traceback.print_exc()
-            # finally:
-            #     try:
-            #         if self.request.fileno() != -1:
-            #             self.request.close()
-            #     except OSError:
-            #         # Ignore the error if socket is already closed
-            #         pass
+            finally:
+                try:
+                    if self.request.fileno() != -1:
+                        self.request.close()
+                except OSError:
+                    # Ignore the error if socket is already closed
+                    pass
 
         def build_call_info(self, call_type, call_id, device_id, new_device_id, destination, bucket_type, **kwargs):
             caller = kwargs.get('Channel-Caller-ID-Number')

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

@@ -44,8 +44,12 @@ class ChannelParkHandler(EslEventHandler):
             return
 
         device_info = call_info.device_info_map.get(device_id)
+        if not device_info:
+            self.logger.info('CHANNEL_PARK deviceInfo is null, call_id=%s, call_info=%s' % (call_id, call_info))
+            return
+
         hold = self.cache.get_need_play_hold_music(call_id)
-        self.logger.info('debugger, ChannelParkHandler, hold=%s, device_info=%s' % (hold, device_info))
+        self.logger.info('ChannelParkHandler, hold=%s, device_info=%s' % (hold, device_info))
         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)