zhoufan месяцев назад: 10
Родитель
Сommit
c48db9d215

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

@@ -93,6 +93,8 @@ public class EslEventListenerEvent implements IEslEventListener {
93 93
                             session.setVideo(isVideo);
94 94
                             session.setCreateTime(new Date());
95 95
                             EslCommon.sessions.add(session);
96
+                        }else {
97
+                            session.setActionId(session.getActionId() + 1);
96 98
                         }
97 99
 
98 100
                         if (chan == null) {
@@ -105,8 +107,7 @@ public class EslEventListenerEvent implements IEslEventListener {
105 107
                         chan.setSessionId(session.getSessionId());
106 108
                         chan.setCallType(session.getType());
107 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 112
                         if (agent != null) {
112 113
                             if (callType == 2) eslClientService.setWork(agent.getAgent(), false, "");
@@ -162,7 +163,6 @@ public class EslEventListenerEvent implements IEslEventListener {
162 163
                                     if (!(isAdd && opType.equals("MakeCall"))) callerAgent.setOpType("");
163 164
                                     //过滤分机呼出/坐席呼出
164 165
                                     if (!(opType.equals("") || opType.equals("MakeCall"))) {
165
-                                        session.setActionId(session.getActionId() + 1);
166 166
                                         if (!isAdd) isAdd = true;
167 167
                                     }
168 168
                                 }
@@ -178,7 +178,7 @@ public class EslEventListenerEvent implements IEslEventListener {
178 178
                                     if (calleeAgent1 != null) record.setCalleeAgent(calleeAgent1.getAgent());
179 179
                                     record.setCallType(2);
180 180
                                     record.setUuid(callId);
181
-                                    record.setActionId(session.getActionId());
181
+                                    record.setActionId(session.getActionId()>1?session.getActionId()-1:1);
182 182
                                     record.setIsAnswer(0);
183 183
                                     record.setIsVideo(session.isVideo() ? 1 : 0);
184 184
                                     record.setCreateTime(new Date());
@@ -258,10 +258,24 @@ public class EslEventListenerEvent implements IEslEventListener {
258 258
                                     if (callerAgent != null) {
259 259
                                         if (!opType.equals("MakeCall") || calleeNum.equals(chanNames[2])) {
260 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,6 +16,8 @@ public class Session {
16 16
     private boolean isAnswer = false;
17 17
     //是否会议
18 18
     private boolean isMeeting = false;
19
+    //是否会议静音
20
+    private boolean isMeetingMute = false;
19 21
     //是否视频
20 22
     private boolean isVideo = false;
21 23
     //视频路径

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

@@ -579,32 +579,31 @@ public class EslClientService {
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 583
         String result = "";
584 584
         try {
585 585
             String fix = action.substring(action.lastIndexOf("|") + 1);
586 586
             String command = EslCommandEnum.originate.name();
587 587
             String at = "threeway", argstr = "";
588
-            Session session = EslCommon.getSessionById(meetingId);
588
+            Session session = EslCommon.getSessionById(sessionId);
589 589
             if (session != null && session.isVideo()) {
590 590
                 at = "video-mcu-stereo";
591 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 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 597
                     + ",call_callee=" + calleeNum.substring(fix.length())
599 598
                     + ",transfer_ringback=local_stream://moh,ringback=local_stream://moh"
600 599
                     + argstr + "}" + getCallString(calleeNum)
601 600
                     // + " " + meetingId + " xml ExtenMeeting";
602
-                    + " &conference(" + meetingId + "@" + at + ")"
601
+                    + " &conference(" + sessionId + "@" + at + ")"
603 602
                     + "\r\nJob-UUID: " + action + "|" + System.currentTimeMillis();
604 603
             result = client.sendAsyncApiCommand(command, arg);
605 604
 
606 605
         } catch (Exception e) {
607
-            log.error(callerNum + "|" + calleeNum + "|" + meetingId + " 呼叫加入会议失败", e);
606
+            log.error(callerNum + "|" + calleeNum + "|" + sessionId + " 呼叫加入会议失败", e);
608 607
         }
609 608
         return !result.equals("");
610 609
     }
@@ -646,7 +645,7 @@ public class EslClientService {
646 645
         String result = "";
647 646
         try {
648 647
             String command = EslCommandEnum.uuid_record.name();
649
-            String arg = chanId + (isRecord ? " start" : " stop") + filePath;
648
+            String arg = chanId + (isRecord ? " start " : " stop ") + filePath;
650 649
             result = client.sendAsyncApiCommand(command, arg);
651 650
         } catch (Exception e) {
652 651
             String state = isRecord ? "开启" : "关闭";
@@ -726,6 +725,23 @@ public class EslClientService {
726 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 746
     public boolean setConferenceExitSound(String meetingId, boolean isplay) {
731 747
         String result = "";
@@ -733,7 +749,7 @@ public class EslClientService {
733 749
             String command = EslCommandEnum.conference.name();
734 750
             String arg = meetingId + " exit_sound " + (isplay ? "on" : "off");
735 751
             result = client.sendAsyncApiCommand(command, arg);
736
-            
752
+
737 753
         } catch (Exception e) {
738 754
             log.error(meetingId + "|" + isplay + " 设置会议离开失败", e);
739 755
         }
@@ -741,9 +757,10 @@ public class EslClientService {
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 761
         String result = "";
746 762
         try {
763
+            String memberId=getConferenceMemberId(meetingId,chanId);
747 764
             String command = EslCommandEnum.conference.name();
748 765
             if (isMute) {
749 766
                 String arg = meetingId + " deaf " + memberId;
@@ -762,7 +779,7 @@ public class EslClientService {
762 779
             }
763 780
             
764 781
         } catch (Exception e) {
765
-            log.error(meetingId + "|" + memberId + "|" + isMute + " 设置会议静音失败", e);
782
+            log.error(meetingId + "|" + chanId + "|" + isMute + " 设置会议静音失败", e);
766 783
         }
767 784
         return !result.equals("");
768 785
     }

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

@@ -283,12 +283,34 @@ public class WebSocketService {
283 283
                                     result.put("Result", "目标号码忙碌中");
284 284
                                 } else {
285 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 288
                                     isExec = eslClientService.callJoinMeeting(agent.getExten(), DestinationNumber, chan.getSessionId(), type + "|" + agentId + "|" + DestinationNumber+ "|" + Fix);
287 289
                                 }
288 290
                             }
289 291
                         }
290 292
                     }
291 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 314
                 case "TurnMyd"://转满意度
293 315
                     //通话中  可以转满意度
294 316
                     if (Objects.equals(state, EslAgentEnum.talking)) {