zhoufan 1 年之前
父節點
當前提交
8d71ac665d
共有 1 個文件被更改,包括 32 次插入0 次删除
  1. 32 0
      midware-service/src/main/java/midware/service/init/EslClientService.java

+ 32 - 0
midware-service/src/main/java/midware/service/init/EslClientService.java

@@ -72,6 +72,8 @@ public class EslClientService {
72 72
         }, 1, 5000, TimeUnit.MILLISECONDS);
73 73
 
74 74
         if (client.canSend()) {
75
+            //删除所有坐席
76
+            delAgentAll();
75 77
             //扫描已注册的分机
76 78
             scanExten();
77 79
 
@@ -90,6 +92,36 @@ public class EslClientService {
90 92
         }
91 93
     }
92 94
 
95
+    //删除所有坐席
96
+    public void delAgentAll() {
97
+        try {
98
+            String command = EslCommandEnum.callcenter_config.name();
99
+            //获取坐席组中所有坐席
100
+            EslMessage message = client.sendSyncApiCommand(command, "tier list");
101
+            if (message != null && message.getBodyLines().size() > 0) {
102
+                for (String line : message.getBodyLines()) {
103
+                    if (!line.startsWith("queue") && !line.startsWith("+OK")) {
104
+                        String[] lines = line.split("\\|");
105
+                        client.sendAsyncApiCommand(command, "agent del " + lines[1]);
106
+                        client.sendAsyncApiCommand(command, "tier del " + lines[0] + " " + lines[1]);
107
+                    }
108
+                }
109
+            }
110
+            //获取所有坐席
111
+            EslMessage message1 = client.sendSyncApiCommand(command, "agent list");
112
+            if (message1 != null && message1.getBodyLines().size() > 0) {
113
+                for (String line : message1.getBodyLines()) {
114
+                    if (!line.startsWith("name") && !line.startsWith("+OK")) {
115
+                        String[] lines = line.split("\\|");
116
+                        client.sendAsyncApiCommand(command, "agent del " + lines[0]);
117
+                    }
118
+                }
119
+            }
120
+        } catch (Exception e) {
121
+            log.error("删除所有坐席失败", e);
122
+        }
123
+    }
124
+
93 125
     //扫描已注册的分机
94 126
     public void scanExten() {
95 127
         try {