zhoufan 9 月之前
父節點
當前提交
768dedf1cb

+ 9 - 0
midware-service/src/main/java/midware/service/eslclient/EslCommon.java

76
     }
76
     }
77
 
77
 
78
     //根据id获取通道
78
     //根据id获取通道
79
+    public static Channel getChanById(String chanId) {
80
+        List<Channel> cs = channels.stream().filter(p -> p.getChanId().equals(chanId)).collect(Collectors.toList());
81
+        if (cs.size() > 0) {
82
+            return cs.get(0);
83
+        }
84
+        return null;
85
+    }
86
+
87
+    //根据号码获取通道
79
     public static Channel getChanByNumber(String number) {
88
     public static Channel getChanByNumber(String number) {
80
         List<Channel> cs = channels.stream().filter(p -> p.getNumber().equals(number)).collect(Collectors.toList());
89
         List<Channel> cs = channels.stream().filter(p -> p.getNumber().equals(number)).collect(Collectors.toList());
81
         if (cs.size() > 0) {
90
         if (cs.size() > 0) {

+ 6 - 2
midware-service/src/main/java/midware/service/eslclient/EslEventListenerEvent.java

78
                 String codec = header.get("variable_ep_codec_string");
78
                 String codec = header.get("variable_ep_codec_string");
79
                 boolean isVideo = StringHelper.isNotEmpty(codec) && codec.contains("H264");
79
                 boolean isVideo = StringHelper.isNotEmpty(codec) && codec.contains("H264");
80
 
80
 
81
-                Channel chan = EslCommon.getChanByNumber(chanNames[2]);
82
-                Agent agent = EslCommon.getAgentByExten(chanNames[2]);
81
+                Agent agent = null;
82
+                Channel chan = EslCommon.getChanById(chanId);
83
+                if(EslCommon.existExten(chanNames[2])) {
84
+                    if (chan == null) chan = EslCommon.getChanByNumber(chanNames[2]);
85
+                    agent = EslCommon.getAgentByExten(chanNames[2]);
86
+                }
83
                 Session session = EslCommon.getSessionById(callId);
87
                 Session session = EslCommon.getSessionById(callId);
84
                 if (callType == 0) callType = EslCommon.existExten(callerNum) ? 2 : 1;
88
                 if (callType == 0) callType = EslCommon.existExten(callerNum) ? 2 : 1;
85
 
89