|
|
@@ -172,14 +172,13 @@ public class WebSocketService {
|
|
172
|
172
|
String DestinationNumber = map.get("DestinationNumber").toString();
|
|
173
|
173
|
String Fix = map.get("Fix") != null ? map.get("Fix").toString() : "";
|
|
174
|
174
|
param = DestinationNumber + (Fix.equals("") ? "" : "|" + Fix);
|
|
175
|
|
- if (StringHelper.isNotEmpty(DestinationNumber)) {
|
|
176
|
|
- Agent tAgent = EslCommon.getAgentByExten(DestinationNumber);
|
|
177
|
|
- if (tAgent != null && tAgent.getAgentState() != EslAgentEnum.free.ordinal()) {
|
|
178
|
|
- result.put("Result", "目标坐席忙碌中");
|
|
179
|
|
- } else {
|
|
180
|
|
- agent.setOpType(type);
|
|
181
|
|
- isExec = eslClientService.extenCall(agent.getExten(), DestinationNumber, type + "|" + agentId + "|" + DestinationNumber + "|" + Fix);
|
|
182
|
|
- }
|
|
|
175
|
+
|
|
|
176
|
+ String check = checkTargetNumber(agent.getExten() ,DestinationNumber);
|
|
|
177
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
178
|
+ agent.setOpType(type);
|
|
|
179
|
+ isExec = eslClientService.extenCall(agent.getExten(), DestinationNumber, type + "|" + agentId + "|" + DestinationNumber + "|" + Fix);
|
|
|
180
|
+ } else {
|
|
|
181
|
+ result.put("Result", check);
|
|
183
|
182
|
}
|
|
184
|
183
|
}
|
|
185
|
184
|
break;
|
|
|
@@ -213,22 +212,17 @@ public class WebSocketService {
|
|
213
|
212
|
String DestinationNumber = map.get("DestinationNumber").toString();
|
|
214
|
213
|
String Fix = map.get("Fix") != null ? map.get("Fix").toString() : "";
|
|
215
|
214
|
param = DestinationNumber + (Fix.equals("") ? "" : "|" + Fix);
|
|
216
|
|
- if (StringHelper.isNotEmpty(DestinationNumber)) {
|
|
217
|
|
- if (DestinationNumber.equals(agent.getExten())) {
|
|
218
|
|
- result.put("Result", "目标不能是自己");
|
|
|
215
|
+
|
|
|
216
|
+ String check = checkTargetNumber(agent.getExten(),DestinationNumber);
|
|
|
217
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
218
|
+ if (chan.getSessionSort() == 1) {//呼出方不可以转移
|
|
|
219
|
+ result.put("Result", "主叫不能此操作");
|
|
219
|
220
|
} else {
|
|
220
|
|
- Agent tAgent = EslCommon.getAgentByExten(DestinationNumber);
|
|
221
|
|
- if (tAgent != null && tAgent.getAgentState() != EslAgentEnum.free.ordinal()) {
|
|
222
|
|
- result.put("Result", "目标坐席忙碌中");
|
|
223
|
|
- } else if (EslCommon.isInSession(DestinationNumber)) {
|
|
224
|
|
- result.put("Result", "目标号码忙碌中");
|
|
225
|
|
- } else if (chan.getSessionSort() == 1) {//呼出方不可以转移
|
|
226
|
|
- result.put("Result", "主叫不能此操作");
|
|
227
|
|
- } else {
|
|
228
|
|
- agent.setOpType(type);
|
|
229
|
|
- isExec = eslClientService.transfer(chan.getSessionId(), agent.getExten(), DestinationNumber, type + "|" + agentId + "|" + DestinationNumber+ "|" + Fix);
|
|
230
|
|
- }
|
|
|
221
|
+ agent.setOpType(type);
|
|
|
222
|
+ isExec = eslClientService.transfer(chan.getSessionId(), agent.getExten(), DestinationNumber, type + "|" + agentId + "|" + DestinationNumber + "|" + Fix);
|
|
231
|
223
|
}
|
|
|
224
|
+ } else {
|
|
|
225
|
+ result.put("Result", check);
|
|
232
|
226
|
}
|
|
233
|
227
|
}
|
|
234
|
228
|
break;
|
|
|
@@ -238,22 +232,17 @@ public class WebSocketService {
|
|
238
|
232
|
String DestinationNumber = map.get("DestinationNumber").toString();
|
|
239
|
233
|
String Fix = map.get("Fix") != null ? map.get("Fix").toString() : "";
|
|
240
|
234
|
param = DestinationNumber + (Fix.equals("") ? "" : "|" + Fix);
|
|
241
|
|
- if (StringHelper.isNotEmpty(DestinationNumber)) {
|
|
242
|
|
- if (DestinationNumber.equals(agent.getExten())) {
|
|
243
|
|
- result.put("Result", "目标不能是自己");
|
|
|
235
|
+
|
|
|
236
|
+ String check = checkTargetNumber(agent.getExten(), DestinationNumber);
|
|
|
237
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
238
|
+ if (chan.getSessionSort() == 1) {//呼出方不可以转移
|
|
|
239
|
+ result.put("Result", "主叫不能此操作");
|
|
244
|
240
|
} else {
|
|
245
|
|
- Agent tAgent = EslCommon.getAgentByExten(DestinationNumber);
|
|
246
|
|
- if (tAgent != null && tAgent.getAgentState() != EslAgentEnum.free.ordinal()) {
|
|
247
|
|
- result.put("Result", "目标坐席忙碌中");
|
|
248
|
|
- } else if (EslCommon.isInSession(DestinationNumber)) {
|
|
249
|
|
- result.put("Result", "目标号码忙碌中");
|
|
250
|
|
- } else if (chan.getSessionSort() == 1) {//呼出方不可以协商
|
|
251
|
|
- result.put("Result", "主叫不能此操作");
|
|
252
|
|
- } else {
|
|
253
|
|
- agent.setOpType(type);
|
|
254
|
|
- isExec = eslClientService.consult(chan.getSessionId(), agent.getExten(), DestinationNumber, type + "|" + agentId + "|" + DestinationNumber+ "|" + Fix);
|
|
255
|
|
- }
|
|
|
241
|
+ agent.setOpType(type);
|
|
|
242
|
+ isExec = eslClientService.consult(chan.getSessionId(), agent.getExten(), DestinationNumber, type + "|" + agentId + "|" + DestinationNumber + "|" + Fix);
|
|
256
|
243
|
}
|
|
|
244
|
+ } else {
|
|
|
245
|
+ result.put("Result", check);
|
|
257
|
246
|
}
|
|
258
|
247
|
}
|
|
259
|
248
|
break;
|
|
|
@@ -272,22 +261,15 @@ public class WebSocketService {
|
|
272
|
261
|
String DestinationNumber = map.get("DestinationNumber").toString();
|
|
273
|
262
|
String Fix = map.get("Fix") != null ? map.get("Fix").toString() : "";
|
|
274
|
263
|
param = DestinationNumber + (Fix.equals("") ? "" : "|" + Fix);
|
|
275
|
|
- if (StringHelper.isNotEmpty(DestinationNumber)) {
|
|
276
|
|
- if (DestinationNumber.equals(agent.getExten())) {
|
|
277
|
|
- result.put("Result", "目标不能是自己");
|
|
278
|
|
- } else {
|
|
279
|
|
- Agent tAgent = EslCommon.getAgentByExten(DestinationNumber);
|
|
280
|
|
- if (tAgent != null && tAgent.getAgentState() != EslAgentEnum.free.ordinal()) {
|
|
281
|
|
- result.put("Result", "目标坐席忙碌中");
|
|
282
|
|
- } else if (EslCommon.isInSession(DestinationNumber)) {
|
|
283
|
|
- result.put("Result", "目标号码忙碌中");
|
|
284
|
|
- } else {
|
|
285
|
|
- agent.setOpType(type);
|
|
286
|
|
- String mute = map.get("Mute") != null ? map.get("Mute").toString() : "";
|
|
287
|
|
- EslCommon.getSessionById(chan.getSessionId()).setMeetingMute(mute.equals("true"));
|
|
288
|
|
- isExec = eslClientService.callJoinMeeting(agent.getExten(), DestinationNumber, chan.getSessionId(), type + "|" + agentId + "|" + DestinationNumber+ "|" + Fix);
|
|
289
|
|
- }
|
|
290
|
|
- }
|
|
|
264
|
+
|
|
|
265
|
+ String check = checkTargetNumber(agent.getExten(), DestinationNumber);
|
|
|
266
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
267
|
+ agent.setOpType(type);
|
|
|
268
|
+ String mute = map.get("Mute") != null ? map.get("Mute").toString() : "";
|
|
|
269
|
+ EslCommon.getSessionById(chan.getSessionId()).setMeetingMute(mute.equals("true"));
|
|
|
270
|
+ isExec = eslClientService.callJoinMeeting(agent.getExten(), DestinationNumber, chan.getSessionId(), type + "|" + agentId + "|" + DestinationNumber+ "|" + Fix);
|
|
|
271
|
+ } else {
|
|
|
272
|
+ result.put("Result", check);
|
|
291
|
273
|
}
|
|
292
|
274
|
}
|
|
293
|
275
|
break;
|
|
|
@@ -348,20 +330,16 @@ public class WebSocketService {
|
|
348
|
330
|
String TargetAgentID = map.get("TargetAgentID").toString();
|
|
349
|
331
|
param = TargetAgentID;
|
|
350
|
332
|
if (StringHelper.isNotEmpty(TargetAgentID)) {
|
|
351
|
|
- if (TargetAgentID.equals(agentId)) {
|
|
352
|
|
- result.put("Result", "目标不能是自己");
|
|
353
|
|
- } else {
|
|
354
|
|
- Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
355
|
|
- String check = checkTargetAgentTalk(tAgent);
|
|
356
|
|
- if (StringHelper.isEmpty(check)) {
|
|
357
|
|
- Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
358
|
|
- if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
359
|
|
- agent.setOpType(type);
|
|
360
|
|
- isExec = eslClientService.listen(agent.getExten(),tchan.getNumber(), tchan.getSessionId(), type + "|" + agentId + "|" + agent.getExten());
|
|
361
|
|
- }
|
|
362
|
|
- } else {
|
|
363
|
|
- result.put("Result", check);
|
|
|
333
|
+ Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
|
334
|
+ String check = checkTargetAgentTalk(tAgent);
|
|
|
335
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
336
|
+ Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
|
337
|
+ if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
|
338
|
+ agent.setOpType(type);
|
|
|
339
|
+ isExec = eslClientService.listen(agent.getExten(),tchan.getNumber(), tchan.getSessionId(), type + "|" + agentId + "|" + agent.getExten());
|
|
364
|
340
|
}
|
|
|
341
|
+ } else {
|
|
|
342
|
+ result.put("Result", check);
|
|
365
|
343
|
}
|
|
366
|
344
|
}
|
|
367
|
345
|
}
|
|
|
@@ -372,21 +350,17 @@ public class WebSocketService {
|
|
372
|
350
|
String TargetAgentID = map.get("TargetAgentID").toString();
|
|
373
|
351
|
param = TargetAgentID;
|
|
374
|
352
|
if (StringHelper.isNotEmpty(TargetAgentID)) {
|
|
375
|
|
- if (TargetAgentID.equals(agentId)) {
|
|
376
|
|
- result.put("Result", "目标不能是自己");
|
|
377
|
|
- } else {
|
|
378
|
|
- Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
379
|
|
- String check = checkTargetAgentTalk(tAgent);
|
|
380
|
|
- if (StringHelper.isEmpty(check)) {
|
|
381
|
|
- Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
382
|
|
- if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
383
|
|
- agent.setOpType(type);
|
|
384
|
|
- String sid = tchan.getSessionId();
|
|
385
|
|
- isExec = eslClientService.insert(agent.getExten(), tchan.getNumber(), sid, type + "|" + agentId + "|" + agent.getExten());
|
|
386
|
|
- }
|
|
387
|
|
- } else {
|
|
388
|
|
- result.put("Result", check);
|
|
|
353
|
+ Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
|
354
|
+ String check = checkTargetAgentTalk(tAgent);
|
|
|
355
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
356
|
+ Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
|
357
|
+ if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
|
358
|
+ agent.setOpType(type);
|
|
|
359
|
+ String sid = tchan.getSessionId();
|
|
|
360
|
+ isExec = eslClientService.insert(agent.getExten(), tchan.getNumber(), sid, type + "|" + agentId + "|" + agent.getExten());
|
|
389
|
361
|
}
|
|
|
362
|
+ } else {
|
|
|
363
|
+ result.put("Result", check);
|
|
390
|
364
|
}
|
|
391
|
365
|
}
|
|
392
|
366
|
}
|
|
|
@@ -397,22 +371,18 @@ public class WebSocketService {
|
|
397
|
371
|
String TargetAgentID = map.get("TargetAgentID").toString();
|
|
398
|
372
|
param = TargetAgentID;
|
|
399
|
373
|
if (StringHelper.isNotEmpty(TargetAgentID)) {
|
|
400
|
|
- if (TargetAgentID.equals(agentId)) {
|
|
401
|
|
- result.put("Result", "目标不能是自己");
|
|
402
|
|
- } else {
|
|
403
|
|
- Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
404
|
|
- String check = checkTargetAgentTalk(tAgent);
|
|
405
|
|
- if (StringHelper.isEmpty(check)) {
|
|
406
|
|
- Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
407
|
|
- if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
408
|
|
- agent.setOpType(type);
|
|
409
|
|
- String sid = tchan.getSessionId();
|
|
410
|
|
- Channel channel = EslCommon.getFirstChanBySessionId(sid);
|
|
411
|
|
- isExec = eslClientService.intercept(agent.getExten(), tAgent.getExten(), channel.getChanId(), sid, type + "|" + agentId + "|" + agent.getExten());
|
|
412
|
|
- }
|
|
413
|
|
- } else {
|
|
414
|
|
- result.put("Result", check);
|
|
|
374
|
+ Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
|
375
|
+ String check = checkTargetAgentTalk(tAgent);
|
|
|
376
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
377
|
+ Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
|
378
|
+ if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
|
379
|
+ agent.setOpType(type);
|
|
|
380
|
+ String sid = tchan.getSessionId();
|
|
|
381
|
+ Channel channel = EslCommon.getFirstChanBySessionId(sid);
|
|
|
382
|
+ isExec = eslClientService.intercept(agent.getExten(), tAgent.getExten(), channel.getChanId(), sid, type + "|" + agentId + "|" + agent.getExten());
|
|
415
|
383
|
}
|
|
|
384
|
+ } else {
|
|
|
385
|
+ result.put("Result", check);
|
|
416
|
386
|
}
|
|
417
|
387
|
}
|
|
418
|
388
|
}
|
|
|
@@ -422,19 +392,15 @@ public class WebSocketService {
|
|
422
|
392
|
String TargetAgentID = map.get("TargetAgentID").toString();
|
|
423
|
393
|
param = TargetAgentID;
|
|
424
|
394
|
if (StringHelper.isNotEmpty(TargetAgentID)) {
|
|
425
|
|
- if (TargetAgentID.equals(agentId)) {
|
|
426
|
|
- result.put("Result", "目标不能是自己");
|
|
427
|
|
- } else {
|
|
428
|
|
- Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
429
|
|
- String check = checkTargetAgentTalk(tAgent);
|
|
430
|
|
- if (StringHelper.isEmpty(check)) {
|
|
431
|
|
- Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
432
|
|
- if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
433
|
|
- isExec = eslClientService.kill(tchan.getSessionId(),type + "|" + agentId);
|
|
434
|
|
- }
|
|
435
|
|
- } else {
|
|
436
|
|
- result.put("Result", check);
|
|
|
395
|
+ Agent tAgent = EslCommon.getAgent(TargetAgentID);
|
|
|
396
|
+ String check = checkTargetAgentTalk(tAgent);
|
|
|
397
|
+ if (StringHelper.isEmpty(check)) {
|
|
|
398
|
+ Channel tchan = EslCommon.getChanByExten(tAgent.getExten());
|
|
|
399
|
+ if (tchan != null && StringHelper.isNotEmpty(tchan.getSessionId())) {
|
|
|
400
|
+ isExec = eslClientService.kill(tchan.getSessionId(),type + "|" + agentId);
|
|
437
|
401
|
}
|
|
|
402
|
+ } else {
|
|
|
403
|
+ result.put("Result", check);
|
|
438
|
404
|
}
|
|
439
|
405
|
}
|
|
440
|
406
|
}
|
|
|
@@ -542,8 +508,37 @@ public class WebSocketService {
|
|
542
|
508
|
String result = "";
|
|
543
|
509
|
if (agent == null) {
|
|
544
|
510
|
result = "目标坐席未签入";
|
|
545
|
|
- } else if (agent.getAgentState() != EslAgentEnum.talking.ordinal()) {
|
|
546
|
|
- result = "目标坐席未通话";
|
|
|
511
|
+ } else {
|
|
|
512
|
+ if (agent.getAgent().equals(agentId)) {
|
|
|
513
|
+ result = "目标不能是自己";
|
|
|
514
|
+ }else if (agent.getAgentState() != EslAgentEnum.talking.ordinal()) {
|
|
|
515
|
+ result = "目标坐席未通话";
|
|
|
516
|
+ }
|
|
|
517
|
+ }
|
|
|
518
|
+ return result;
|
|
|
519
|
+ }
|
|
|
520
|
+
|
|
|
521
|
+ //判断目标号码是否可以呼出
|
|
|
522
|
+ private String checkTargetNumber(String exten,String num) {
|
|
|
523
|
+ String result = "";
|
|
|
524
|
+ if (StringHelper.isEmpty(num)) {
|
|
|
525
|
+ result = "目标号码不能为空";
|
|
|
526
|
+ } else {
|
|
|
527
|
+ if (exten.equals(num)) {
|
|
|
528
|
+ result = "目标不能是自己";
|
|
|
529
|
+ } else {
|
|
|
530
|
+ Channel chan = EslCommon.getChanByNumber(num);
|
|
|
531
|
+ if (chan != null) {
|
|
|
532
|
+ if (!chan.getSessionId().equals("")) {
|
|
|
533
|
+ result = "目标号码忙碌中";
|
|
|
534
|
+ } else if (chan.getType() == 1) {//坐席
|
|
|
535
|
+ Agent tAgent = EslCommon.getAgentByExten(num);
|
|
|
536
|
+ if (tAgent != null && tAgent.getAgentState() != EslAgentEnum.free.ordinal()) {
|
|
|
537
|
+ result = "目标坐席忙碌中";
|
|
|
538
|
+ }
|
|
|
539
|
+ }
|
|
|
540
|
+ }
|
|
|
541
|
+ }
|
|
547
|
542
|
}
|
|
548
|
543
|
return result;
|
|
549
|
544
|
}
|