zhoufan преди 10 месеца
родител
ревизия
c48db9d215

+ 22 - 8
midware-service/src/main/java/midware/service/eslclient/EslEventListenerEvent.java

93
                             session.setVideo(isVideo);
93
                             session.setVideo(isVideo);
94
                             session.setCreateTime(new Date());
94
                             session.setCreateTime(new Date());
95
                             EslCommon.sessions.add(session);
95
                             EslCommon.sessions.add(session);
96
+                        }else {
97
+                            session.setActionId(session.getActionId() + 1);
96
                         }
98
                         }
97
 
99
 
98
                         if (chan == null) {
100
                         if (chan == null) {
105
                         chan.setSessionId(session.getSessionId());
107
                         chan.setSessionId(session.getSessionId());
106
                         chan.setCallType(session.getType());
108
                         chan.setCallType(session.getType());
107
                         chan.setCreateTime(new Date());
109
                         chan.setCreateTime(new Date());
108
-                        String finalCallId = callId;
109
-                        chan.setSessionSort(EslCommon.channels.stream().filter(p -> p.getSessionId().equals(finalCallId)).count());
110
+                        chan.setSessionSort(session.getActionId());
110
                         //更新坐席状态
111
                         //更新坐席状态
111
                         if (agent != null) {
112
                         if (agent != null) {
112
                             if (callType == 2) eslClientService.setWork(agent.getAgent(), false, "");
113
                             if (callType == 2) eslClientService.setWork(agent.getAgent(), false, "");
162
                                     if (!(isAdd && opType.equals("MakeCall"))) callerAgent.setOpType("");
163
                                     if (!(isAdd && opType.equals("MakeCall"))) callerAgent.setOpType("");
163
                                     //过滤分机呼出/坐席呼出
164
                                     //过滤分机呼出/坐席呼出
164
                                     if (!(opType.equals("") || opType.equals("MakeCall"))) {
165
                                     if (!(opType.equals("") || opType.equals("MakeCall"))) {
165
-                                        session.setActionId(session.getActionId() + 1);
166
                                         if (!isAdd) isAdd = true;
166
                                         if (!isAdd) isAdd = true;
167
                                     }
167
                                     }
168
                                 }
168
                                 }
178
                                     if (calleeAgent1 != null) record.setCalleeAgent(calleeAgent1.getAgent());
178
                                     if (calleeAgent1 != null) record.setCalleeAgent(calleeAgent1.getAgent());
179
                                     record.setCallType(2);
179
                                     record.setCallType(2);
180
                                     record.setUuid(callId);
180
                                     record.setUuid(callId);
181
-                                    record.setActionId(session.getActionId());
181
+                                    record.setActionId(session.getActionId()>1?session.getActionId()-1:1);
182
                                     record.setIsAnswer(0);
182
                                     record.setIsAnswer(0);
183
                                     record.setIsVideo(session.isVideo() ? 1 : 0);
183
                                     record.setIsVideo(session.isVideo() ? 1 : 0);
184
                                     record.setCreateTime(new Date());
184
                                     record.setCreateTime(new Date());
258
                                     if (callerAgent != null) {
258
                                     if (callerAgent != null) {
259
                                         if (!opType.equals("MakeCall") || calleeNum.equals(chanNames[2])) {
259
                                         if (!opType.equals("MakeCall") || calleeNum.equals(chanNames[2])) {
260
                                             actionNotice(opType, callerAgent.getAgent(), callId, true);
260
                                             actionNotice(opType, callerAgent.getAgent(), callId, true);
261
-                                            if (opType.equals("Meeting") && chan.getSessionSort() == 3) {
262
-                                                eslClientService.talkJoinMeeting(callId);
263
-                                                eslClientService.setConferenceExitSound(callId, true);
264
-                                                if (session != null) session.setMeeting(true);
261
+                                            if (opType.equals("Meeting")) {
262
+                                                if(chan.getSessionSort() == 3) {
263
+                                                    if(eslClientService.talkJoinMeeting(callId)) {
264
+                                                        if (session != null){
265
+                                                            session.setMeeting(true);
266
+                                                            try {
267
+                                                                Thread.sleep(500);
268
+                                                            } catch (InterruptedException e) {
269
+                                                                throw new RuntimeException(e);
270
+                                                            }
271
+                                                            eslClientService.setConferenceExitSound(callId, true);
272
+                                                        }
273
+                                                    }
274
+                                                }
275
+                                                //第一个人静音和禁听
276
+                                                if (session != null&&session.isMeetingMute()) {
277
+                                                    eslClientService.setConferenceIsMute(callId, callId, true, "");
278
+                                                }
265
                                             }
279
                                             }
266
                                         }
280
                                         }
267
                                     }
281
                                     }

+ 2 - 0
midware-service/src/main/java/midware/service/eslclient/entity/Session.java

16
     private boolean isAnswer = false;
16
     private boolean isAnswer = false;
17
     //是否会议
17
     //是否会议
18
     private boolean isMeeting = false;
18
     private boolean isMeeting = false;
19
+    //是否会议静音
20
+    private boolean isMeetingMute = false;
19
     //是否视频
21
     //是否视频
20
     private boolean isVideo = false;
22
     private boolean isVideo = false;
21
     //视频路径
23
     //视频路径

+ 29 - 12
midware-service/src/main/java/midware/service/init/EslClientService.java

579
     }
579
     }
580
 
580
 
581
     //呼叫号码加入会议
581
     //呼叫号码加入会议
582
-    public boolean callJoinMeeting(String callerNum, String calleeNum, String meetingId,String action) {
582
+    public boolean callJoinMeeting(String callerNum, String calleeNum, String sessionId,String action) {
583
         String result = "";
583
         String result = "";
584
         try {
584
         try {
585
             String fix = action.substring(action.lastIndexOf("|") + 1);
585
             String fix = action.substring(action.lastIndexOf("|") + 1);
586
             String command = EslCommandEnum.originate.name();
586
             String command = EslCommandEnum.originate.name();
587
             String at = "threeway", argstr = "";
587
             String at = "threeway", argstr = "";
588
-            Session session = EslCommon.getSessionById(meetingId);
588
+            Session session = EslCommon.getSessionById(sessionId);
589
             if (session != null && session.isVideo()) {
589
             if (session != null && session.isVideo()) {
590
                 at = "video-mcu-stereo";
590
                 at = "video-mcu-stereo";
591
                 String parentPath = "files/video/meeting/" + new SimpleDateFormat("yyyyMMdd").format(new Date());
591
                 String parentPath = "files/video/meeting/" + new SimpleDateFormat("yyyyMMdd").format(new Date());
592
-                String path = new File(parentPath).getAbsolutePath() + "/" + meetingId + ".mp4";
593
-                session.setVideoPath(parentPath + "/" + meetingId + ".mp4");
592
+                String path = new File(parentPath).getAbsolutePath() + "/" + sessionId + ".mp4";
593
+                session.setVideoPath(parentPath + "/" + sessionId + ".mp4");
594
                 argstr = ",record_concat_video=true,conference_auto_record=" + path;
594
                 argstr = ",record_concat_video=true,conference_auto_record=" + path;
595
             }
595
             }
596
-
597
-            String arg = " {cc_member_session_uuid=" + meetingId+",call_caller=" + callerNum
596
+            String arg = " {cc_member_session_uuid=" + sessionId+",call_caller=" + callerNum
598
                     + ",call_callee=" + calleeNum.substring(fix.length())
597
                     + ",call_callee=" + calleeNum.substring(fix.length())
599
                     + ",transfer_ringback=local_stream://moh,ringback=local_stream://moh"
598
                     + ",transfer_ringback=local_stream://moh,ringback=local_stream://moh"
600
                     + argstr + "}" + getCallString(calleeNum)
599
                     + argstr + "}" + getCallString(calleeNum)
601
                     // + " " + meetingId + " xml ExtenMeeting";
600
                     // + " " + meetingId + " xml ExtenMeeting";
602
-                    + " &conference(" + meetingId + "@" + at + ")"
601
+                    + " &conference(" + sessionId + "@" + at + ")"
603
                     + "\r\nJob-UUID: " + action + "|" + System.currentTimeMillis();
602
                     + "\r\nJob-UUID: " + action + "|" + System.currentTimeMillis();
604
             result = client.sendAsyncApiCommand(command, arg);
603
             result = client.sendAsyncApiCommand(command, arg);
605
 
604
 
606
         } catch (Exception e) {
605
         } catch (Exception e) {
607
-            log.error(callerNum + "|" + calleeNum + "|" + meetingId + " 呼叫加入会议失败", e);
606
+            log.error(callerNum + "|" + calleeNum + "|" + sessionId + " 呼叫加入会议失败", e);
608
         }
607
         }
609
         return !result.equals("");
608
         return !result.equals("");
610
     }
609
     }
646
         String result = "";
645
         String result = "";
647
         try {
646
         try {
648
             String command = EslCommandEnum.uuid_record.name();
647
             String command = EslCommandEnum.uuid_record.name();
649
-            String arg = chanId + (isRecord ? " start" : " stop") + filePath;
648
+            String arg = chanId + (isRecord ? " start " : " stop ") + filePath;
650
             result = client.sendAsyncApiCommand(command, arg);
649
             result = client.sendAsyncApiCommand(command, arg);
651
         } catch (Exception e) {
650
         } catch (Exception e) {
652
             String state = isRecord ? "开启" : "关闭";
651
             String state = isRecord ? "开启" : "关闭";
726
         return !result.equals("");
725
         return !result.equals("");
727
     }
726
     }
728
 
727
 
728
+    //获取会议人员id
729
+    public String getConferenceMemberId(String meetingId, String chanId) {
730
+        String memberId = "";
731
+        try {
732
+            //获取会议所有人员
733
+            EslMessage message = client.sendSyncApiCommand("conference", meetingId + " list");
734
+            if (message != null && message.getBodyLines().size() > 0) {
735
+                for (String line : message.getBodyLines()) {
736
+                    if (line.contains(chanId)) memberId = line.split(";")[0];
737
+                }
738
+            }
739
+        } catch (Exception e) {
740
+            log.error("获取会议人员id失败", e);
741
+        }
742
+        return memberId;
743
+    }
744
+
729
     //设置会议人员离开是否播放声音
745
     //设置会议人员离开是否播放声音
730
     public boolean setConferenceExitSound(String meetingId, boolean isplay) {
746
     public boolean setConferenceExitSound(String meetingId, boolean isplay) {
731
         String result = "";
747
         String result = "";
733
             String command = EslCommandEnum.conference.name();
749
             String command = EslCommandEnum.conference.name();
734
             String arg = meetingId + " exit_sound " + (isplay ? "on" : "off");
750
             String arg = meetingId + " exit_sound " + (isplay ? "on" : "off");
735
             result = client.sendAsyncApiCommand(command, arg);
751
             result = client.sendAsyncApiCommand(command, arg);
736
-            
752
+
737
         } catch (Exception e) {
753
         } catch (Exception e) {
738
             log.error(meetingId + "|" + isplay + " 设置会议离开失败", e);
754
             log.error(meetingId + "|" + isplay + " 设置会议离开失败", e);
739
         }
755
         }
741
     }
757
     }
742
 
758
 
743
     //设置会议人员是否静音
759
     //设置会议人员是否静音
744
-    public boolean setConferenceIsMute(String meetingId, String memberId, boolean isMute,String action) {
760
+    public boolean setConferenceIsMute(String meetingId, String chanId, boolean isMute,String action) {
745
         String result = "";
761
         String result = "";
746
         try {
762
         try {
763
+            String memberId=getConferenceMemberId(meetingId,chanId);
747
             String command = EslCommandEnum.conference.name();
764
             String command = EslCommandEnum.conference.name();
748
             if (isMute) {
765
             if (isMute) {
749
                 String arg = meetingId + " deaf " + memberId;
766
                 String arg = meetingId + " deaf " + memberId;
762
             }
779
             }
763
             
780
             
764
         } catch (Exception e) {
781
         } catch (Exception e) {
765
-            log.error(meetingId + "|" + memberId + "|" + isMute + " 设置会议静音失败", e);
782
+            log.error(meetingId + "|" + chanId + "|" + isMute + " 设置会议静音失败", e);
766
         }
783
         }
767
         return !result.equals("");
784
         return !result.equals("");
768
     }
785
     }

+ 22 - 0
midware-service/src/main/java/midware/service/init/WebSocketService.java

283
                                     result.put("Result", "目标号码忙碌中");
283
                                     result.put("Result", "目标号码忙碌中");
284
                                 } else {
284
                                 } else {
285
                                     agent.setOpType(type);
285
                                     agent.setOpType(type);
286
+                                    String mute = map.get("Mute") != null ? map.get("Mute").toString() : "";
287
+                                    EslCommon.getSessionById(chan.getSessionId()).setMeetingMute(mute.equals("true"));
286
                                     isExec = eslClientService.callJoinMeeting(agent.getExten(), DestinationNumber, chan.getSessionId(), type + "|" + agentId + "|" + DestinationNumber+ "|" + Fix);
288
                                     isExec = eslClientService.callJoinMeeting(agent.getExten(), DestinationNumber, chan.getSessionId(), type + "|" + agentId + "|" + DestinationNumber+ "|" + Fix);
287
                                 }
289
                                 }
288
                             }
290
                             }
289
                         }
291
                         }
290
                     }
292
                     }
291
                     break;
293
                     break;
294
+                case "MeetingMuteOn"://会议开启静音
295
+                    //通话中  可以会议开启静音
296
+                    if (Objects.equals(state, EslAgentEnum.talking)) {
297
+                        String mid = chan.getSessionId();
298
+                        String Number = map.get("Number") != null ? map.get("Number").toString() : "";
299
+                        Channel cl = EslCommon.getChanByNumber(Number);
300
+                        if (cl != null) mid = cl.getChanId();
301
+                        isExec = eslClientService.setConferenceIsMute(chan.getSessionId(), mid, true, type + "|" + agentId);
302
+                    }
303
+                    break;
304
+                case "MeetingMuteOff"://会议取消静音
305
+                    //通话中  可以会议取消静音
306
+                    if (Objects.equals(state, EslAgentEnum.talking)) {
307
+                        String mid = chan.getSessionId();
308
+                        String Number = map.get("Number") != null ? map.get("Number").toString() : "";
309
+                        Channel cl = EslCommon.getChanByNumber(Number);
310
+                        if (cl != null) mid = cl.getChanId();
311
+                        isExec = eslClientService.setConferenceIsMute(chan.getSessionId(),mid, false,type + "|" + agentId);
312
+                    }
313
+                    break;
292
                 case "TurnMyd"://转满意度
314
                 case "TurnMyd"://转满意度
293
                     //通话中  可以转满意度
315
                     //通话中  可以转满意度
294
                     if (Objects.equals(state, EslAgentEnum.talking)) {
316
                     if (Objects.equals(state, EslAgentEnum.talking)) {