@webex/contact-center 3.8.1 → 3.9.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cc.js +105 -63
- package/dist/cc.js.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/logger-proxy.js +24 -1
- package/dist/logger-proxy.js.map +1 -1
- package/dist/metrics/MetricsManager.js +1 -1
- package/dist/metrics/MetricsManager.js.map +1 -1
- package/dist/metrics/behavioral-events.js +51 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +12 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/AddressBook.js +271 -0
- package/dist/services/AddressBook.js.map +1 -0
- package/dist/services/EntryPoint.js +227 -0
- package/dist/services/EntryPoint.js.map +1 -0
- package/dist/services/Queue.js +261 -0
- package/dist/services/Queue.js.map +1 -0
- package/dist/services/config/constants.js +24 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +1 -43
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +0 -5
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/GlobalTypes.js.map +1 -1
- package/dist/services/core/Utils.js +121 -2
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +0 -4
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +0 -4
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/task/TaskManager.js +1 -0
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/index.js +145 -71
- package/dist/services/task/index.js.map +1 -1
- package/dist/types/cc.d.ts +77 -43
- package/dist/types/index.d.ts +8 -3
- package/dist/types/metrics/constants.d.ts +7 -0
- package/dist/types/services/AddressBook.d.ts +74 -0
- package/dist/types/services/EntryPoint.d.ts +67 -0
- package/dist/types/services/Queue.d.ts +76 -0
- package/dist/types/services/config/constants.d.ts +23 -1
- package/dist/types/services/config/index.d.ts +1 -14
- package/dist/types/services/config/types.d.ts +0 -64
- package/dist/types/services/core/GlobalTypes.d.ts +25 -0
- package/dist/types/services/core/Utils.d.ts +27 -1
- package/dist/types/services/task/index.d.ts +1 -1
- package/dist/types/types.d.ts +162 -0
- package/dist/types/utils/PageCache.d.ts +173 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/PageCache.js +192 -0
- package/dist/utils/PageCache.js.map +1 -0
- package/dist/webex.js +1 -1
- package/package.json +10 -10
- package/src/cc.ts +121 -81
- package/src/index.ts +19 -3
- package/src/logger-proxy.ts +24 -1
- package/src/metrics/MetricsManager.ts +1 -1
- package/src/metrics/behavioral-events.ts +54 -0
- package/src/metrics/constants.ts +15 -0
- package/src/services/AddressBook.ts +291 -0
- package/src/services/EntryPoint.ts +241 -0
- package/src/services/Queue.ts +277 -0
- package/src/services/config/constants.ts +26 -2
- package/src/services/config/index.ts +1 -55
- package/src/services/config/types.ts +0 -65
- package/src/services/core/GlobalTypes.ts +27 -0
- package/src/services/core/Utils.ts +155 -1
- package/src/services/core/aqm-reqs.ts +0 -5
- package/src/services/core/websocket/WebSocketManager.ts +0 -4
- package/src/services/task/TaskManager.ts +1 -0
- package/src/services/task/index.ts +172 -56
- package/src/types.ts +180 -0
- package/src/utils/PageCache.ts +252 -0
- package/test/unit/spec/cc.ts +30 -82
- package/test/unit/spec/metrics/MetricsManager.ts +0 -1
- package/test/unit/spec/metrics/behavioral-events.ts +14 -0
- package/test/unit/spec/services/AddressBook.ts +332 -0
- package/test/unit/spec/services/EntryPoint.ts +259 -0
- package/test/unit/spec/services/Queue.ts +323 -0
- package/test/unit/spec/services/config/index.ts +0 -71
- package/test/unit/spec/services/core/Utils.ts +50 -0
- package/test/unit/spec/services/core/aqm-reqs.ts +1 -3
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +0 -4
- package/test/unit/spec/services/task/TaskManager.ts +8 -1
- package/test/unit/spec/services/task/index.ts +226 -122
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import EventEmitter from 'events';
|
|
2
2
|
import {CALL_EVENT_KEYS, LocalMicrophoneStream} from '@webex/calling';
|
|
3
3
|
import {CallId} from '@webex/calling/dist/types/common/types';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
generateTaskErrorObject,
|
|
6
|
+
deriveConsultTransferDestinationType,
|
|
7
|
+
getDestinationAgentId,
|
|
8
|
+
} from '../core/Utils';
|
|
9
|
+
import {Failure} from '../core/GlobalTypes';
|
|
5
10
|
import {LoginOption} from '../../types';
|
|
6
11
|
import {TASK_FILE} from '../../constants';
|
|
7
12
|
import {METHODS} from './constants';
|
|
@@ -19,14 +24,12 @@ import {
|
|
|
19
24
|
ConsultEndPayload,
|
|
20
25
|
TransferPayLoad,
|
|
21
26
|
DESTINATION_TYPE,
|
|
22
|
-
CONSULT_TRANSFER_DESTINATION_TYPE,
|
|
23
27
|
ConsultTransferPayLoad,
|
|
24
28
|
MEDIA_CHANNEL,
|
|
25
29
|
} from './types';
|
|
26
30
|
import WebCallingService from '../WebCallingService';
|
|
27
31
|
import MetricsManager from '../../metrics/MetricsManager';
|
|
28
32
|
import {METRIC_EVENT_NAMES} from '../../metrics/constants';
|
|
29
|
-
import {Failure} from '../core/GlobalTypes';
|
|
30
33
|
import AutoWrapup from './AutoWrapup';
|
|
31
34
|
import {WrapupData} from '../config/types';
|
|
32
35
|
|
|
@@ -373,17 +376,25 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
373
376
|
|
|
374
377
|
return Promise.resolve(); // TODO: reject for extension as part of refactor
|
|
375
378
|
} catch (error) {
|
|
376
|
-
const
|
|
379
|
+
const err = generateTaskErrorObject(error, METHODS.ACCEPT, TASK_FILE);
|
|
380
|
+
const taskErrorProps = {
|
|
381
|
+
trackingId: err.data?.trackingId,
|
|
382
|
+
errorMessage: err.data?.message,
|
|
383
|
+
errorType: err.data?.errorType,
|
|
384
|
+
errorData: err.data?.errorData,
|
|
385
|
+
reasonCode: err.data?.reasonCode,
|
|
386
|
+
};
|
|
377
387
|
this.metricsManager.trackEvent(
|
|
378
388
|
METRIC_EVENT_NAMES.TASK_ACCEPT_FAILED,
|
|
379
389
|
{
|
|
380
390
|
taskId: this.data.interactionId,
|
|
381
391
|
error: error.toString(),
|
|
392
|
+
...taskErrorProps,
|
|
382
393
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details as Failure),
|
|
383
394
|
},
|
|
384
395
|
['operational', 'behavioral', 'business']
|
|
385
396
|
);
|
|
386
|
-
throw
|
|
397
|
+
throw err;
|
|
387
398
|
}
|
|
388
399
|
}
|
|
389
400
|
|
|
@@ -422,8 +433,8 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
422
433
|
|
|
423
434
|
return Promise.resolve();
|
|
424
435
|
} catch (error) {
|
|
425
|
-
const
|
|
426
|
-
throw
|
|
436
|
+
const err = generateTaskErrorObject(error, METHODS.TOGGLE_MUTE, TASK_FILE);
|
|
437
|
+
throw err;
|
|
427
438
|
}
|
|
428
439
|
}
|
|
429
440
|
|
|
@@ -470,17 +481,25 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
470
481
|
|
|
471
482
|
return Promise.resolve();
|
|
472
483
|
} catch (error) {
|
|
473
|
-
const
|
|
484
|
+
const err = generateTaskErrorObject(error, METHODS.DECLINE, TASK_FILE);
|
|
485
|
+
const taskErrorProps = {
|
|
486
|
+
trackingId: err.data?.trackingId,
|
|
487
|
+
errorMessage: err.data?.message,
|
|
488
|
+
errorType: err.data?.errorType,
|
|
489
|
+
errorData: err.data?.errorData,
|
|
490
|
+
reasonCode: err.data?.reasonCode,
|
|
491
|
+
};
|
|
474
492
|
this.metricsManager.trackEvent(
|
|
475
493
|
METRIC_EVENT_NAMES.TASK_DECLINE_FAILED,
|
|
476
494
|
{
|
|
477
495
|
taskId: this.data.interactionId,
|
|
478
496
|
error: error.toString(),
|
|
497
|
+
...taskErrorProps,
|
|
479
498
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
480
499
|
},
|
|
481
500
|
['operational', 'behavioral']
|
|
482
501
|
);
|
|
483
|
-
throw
|
|
502
|
+
throw err;
|
|
484
503
|
}
|
|
485
504
|
}
|
|
486
505
|
|
|
@@ -547,18 +566,26 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
547
566
|
|
|
548
567
|
return response;
|
|
549
568
|
} catch (error) {
|
|
550
|
-
const
|
|
569
|
+
const err = generateTaskErrorObject(error, METHODS.HOLD, TASK_FILE);
|
|
570
|
+
const taskErrorProps = {
|
|
571
|
+
trackingId: err.data?.trackingId,
|
|
572
|
+
errorMessage: err.data?.message,
|
|
573
|
+
errorType: err.data?.errorType,
|
|
574
|
+
errorData: err.data?.errorData,
|
|
575
|
+
reasonCode: err.data?.reasonCode,
|
|
576
|
+
};
|
|
551
577
|
this.metricsManager.trackEvent(
|
|
552
578
|
METRIC_EVENT_NAMES.TASK_HOLD_FAILED,
|
|
553
579
|
{
|
|
554
580
|
taskId: this.data.interactionId,
|
|
555
581
|
mediaResourceId: this.data.mediaResourceId,
|
|
556
582
|
error: error.toString(),
|
|
583
|
+
...taskErrorProps,
|
|
557
584
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
558
585
|
},
|
|
559
586
|
['operational', 'behavioral']
|
|
560
587
|
);
|
|
561
|
-
throw
|
|
588
|
+
throw err;
|
|
562
589
|
}
|
|
563
590
|
}
|
|
564
591
|
|
|
@@ -628,8 +655,15 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
628
655
|
|
|
629
656
|
return response;
|
|
630
657
|
} catch (error) {
|
|
631
|
-
const
|
|
658
|
+
const err = generateTaskErrorObject(error, METHODS.RESUME, TASK_FILE);
|
|
632
659
|
const mainInteractionId = this.data.interaction?.mainInteractionId;
|
|
660
|
+
const taskErrorProps = {
|
|
661
|
+
trackingId: err.data?.trackingId,
|
|
662
|
+
errorMessage: err.data?.message,
|
|
663
|
+
errorType: err.data?.errorType,
|
|
664
|
+
errorData: err.data?.errorData,
|
|
665
|
+
reasonCode: err.data?.reasonCode,
|
|
666
|
+
};
|
|
633
667
|
this.metricsManager.trackEvent(
|
|
634
668
|
METRIC_EVENT_NAMES.TASK_RESUME_FAILED,
|
|
635
669
|
{
|
|
@@ -638,11 +672,12 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
638
672
|
mediaResourceId: mainInteractionId
|
|
639
673
|
? this.data.interaction.media[mainInteractionId].mediaResourceId
|
|
640
674
|
: '',
|
|
675
|
+
...taskErrorProps,
|
|
641
676
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
642
677
|
},
|
|
643
678
|
['operational', 'behavioral']
|
|
644
679
|
);
|
|
645
|
-
throw
|
|
680
|
+
throw err;
|
|
646
681
|
}
|
|
647
682
|
}
|
|
648
683
|
|
|
@@ -722,16 +757,24 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
722
757
|
|
|
723
758
|
return response;
|
|
724
759
|
} catch (error) {
|
|
725
|
-
const
|
|
760
|
+
const err = generateTaskErrorObject(error, METHODS.END, TASK_FILE);
|
|
761
|
+
const taskErrorProps = {
|
|
762
|
+
trackingId: err.data?.trackingId,
|
|
763
|
+
errorMessage: err.data?.message,
|
|
764
|
+
errorType: err.data?.errorType,
|
|
765
|
+
errorData: err.data?.errorData,
|
|
766
|
+
reasonCode: err.data?.reasonCode,
|
|
767
|
+
};
|
|
726
768
|
this.metricsManager.trackEvent(
|
|
727
769
|
METRIC_EVENT_NAMES.TASK_END_FAILED,
|
|
728
770
|
{
|
|
729
771
|
taskId: this.data.interactionId,
|
|
772
|
+
...taskErrorProps,
|
|
730
773
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
731
774
|
},
|
|
732
775
|
['operational', 'behavioral', 'business']
|
|
733
776
|
);
|
|
734
|
-
throw
|
|
777
|
+
throw err;
|
|
735
778
|
}
|
|
736
779
|
}
|
|
737
780
|
|
|
@@ -826,18 +869,26 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
826
869
|
|
|
827
870
|
return response;
|
|
828
871
|
} catch (error) {
|
|
829
|
-
const
|
|
872
|
+
const err = generateTaskErrorObject(error, METHODS.WRAPUP, TASK_FILE);
|
|
873
|
+
const taskErrorProps = {
|
|
874
|
+
trackingId: err.data?.trackingId,
|
|
875
|
+
errorMessage: err.data?.message,
|
|
876
|
+
errorType: err.data?.errorType,
|
|
877
|
+
errorData: err.data?.errorData,
|
|
878
|
+
reasonCode: err.data?.reasonCode,
|
|
879
|
+
};
|
|
830
880
|
this.metricsManager.trackEvent(
|
|
831
881
|
METRIC_EVENT_NAMES.TASK_WRAPUP_FAILED,
|
|
832
882
|
{
|
|
833
883
|
taskId: this.data.interactionId,
|
|
834
884
|
wrapUpCode: wrapupPayload.auxCodeId,
|
|
835
885
|
wrapUpReason: wrapupPayload.wrapUpReason,
|
|
886
|
+
...taskErrorProps,
|
|
836
887
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
837
888
|
},
|
|
838
889
|
['operational', 'behavioral', 'business']
|
|
839
890
|
);
|
|
840
|
-
throw
|
|
891
|
+
throw err;
|
|
841
892
|
}
|
|
842
893
|
}
|
|
843
894
|
|
|
@@ -906,17 +957,25 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
906
957
|
|
|
907
958
|
return result;
|
|
908
959
|
} catch (error) {
|
|
909
|
-
const
|
|
960
|
+
const err = generateTaskErrorObject(error, METHODS.PAUSE_RECORDING, TASK_FILE);
|
|
961
|
+
const taskErrorProps = {
|
|
962
|
+
trackingId: err.data?.trackingId,
|
|
963
|
+
errorMessage: err.data?.message,
|
|
964
|
+
errorType: err.data?.errorType,
|
|
965
|
+
errorData: err.data?.errorData,
|
|
966
|
+
reasonCode: err.data?.reasonCode,
|
|
967
|
+
};
|
|
910
968
|
this.metricsManager.trackEvent(
|
|
911
969
|
METRIC_EVENT_NAMES.TASK_PAUSE_RECORDING_FAILED,
|
|
912
970
|
{
|
|
913
971
|
taskId: this.data.interactionId,
|
|
914
972
|
error: error.toString(),
|
|
973
|
+
...taskErrorProps,
|
|
915
974
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
916
975
|
},
|
|
917
976
|
['operational', 'behavioral', 'business']
|
|
918
977
|
);
|
|
919
|
-
throw
|
|
978
|
+
throw err;
|
|
920
979
|
}
|
|
921
980
|
}
|
|
922
981
|
|
|
@@ -997,17 +1056,25 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
997
1056
|
|
|
998
1057
|
return result;
|
|
999
1058
|
} catch (error) {
|
|
1000
|
-
const
|
|
1059
|
+
const err = generateTaskErrorObject(error, METHODS.RESUME_RECORDING, TASK_FILE);
|
|
1060
|
+
const taskErrorProps = {
|
|
1061
|
+
trackingId: err.data?.trackingId,
|
|
1062
|
+
errorMessage: err.data?.message,
|
|
1063
|
+
errorType: err.data?.errorType,
|
|
1064
|
+
errorData: err.data?.errorData,
|
|
1065
|
+
reasonCode: err.data?.reasonCode,
|
|
1066
|
+
};
|
|
1001
1067
|
this.metricsManager.trackEvent(
|
|
1002
1068
|
METRIC_EVENT_NAMES.TASK_RESUME_RECORDING_FAILED,
|
|
1003
1069
|
{
|
|
1004
1070
|
taskId: this.data.interactionId,
|
|
1005
1071
|
error: error.toString(),
|
|
1072
|
+
...taskErrorProps,
|
|
1006
1073
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
1007
1074
|
},
|
|
1008
1075
|
['operational', 'behavioral', 'business']
|
|
1009
1076
|
);
|
|
1010
|
-
throw
|
|
1077
|
+
throw err;
|
|
1011
1078
|
}
|
|
1012
1079
|
}
|
|
1013
1080
|
|
|
@@ -1082,7 +1149,14 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
1082
1149
|
|
|
1083
1150
|
return result;
|
|
1084
1151
|
} catch (error) {
|
|
1085
|
-
const
|
|
1152
|
+
const err = generateTaskErrorObject(error, METHODS.CONSULT, TASK_FILE);
|
|
1153
|
+
const taskErrorProps = {
|
|
1154
|
+
trackingId: err.data?.trackingId,
|
|
1155
|
+
errorMessage: err.data?.message,
|
|
1156
|
+
errorType: err.data?.errorType,
|
|
1157
|
+
errorData: err.data?.errorData,
|
|
1158
|
+
reasonCode: err.data?.reasonCode,
|
|
1159
|
+
};
|
|
1086
1160
|
this.metricsManager.trackEvent(
|
|
1087
1161
|
METRIC_EVENT_NAMES.TASK_CONSULT_START_FAILED,
|
|
1088
1162
|
{
|
|
@@ -1090,11 +1164,12 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
1090
1164
|
destination: consultPayload.to,
|
|
1091
1165
|
destinationType: consultPayload.destinationType,
|
|
1092
1166
|
error: error.toString(),
|
|
1167
|
+
...taskErrorProps,
|
|
1093
1168
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
1094
1169
|
},
|
|
1095
1170
|
['operational', 'behavioral', 'business']
|
|
1096
1171
|
);
|
|
1097
|
-
throw
|
|
1172
|
+
throw err;
|
|
1098
1173
|
}
|
|
1099
1174
|
}
|
|
1100
1175
|
|
|
@@ -1167,17 +1242,25 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
1167
1242
|
|
|
1168
1243
|
return result;
|
|
1169
1244
|
} catch (error) {
|
|
1170
|
-
const
|
|
1245
|
+
const err = generateTaskErrorObject(error, METHODS.END_CONSULT, TASK_FILE);
|
|
1246
|
+
const taskErrorProps = {
|
|
1247
|
+
trackingId: err.data?.trackingId,
|
|
1248
|
+
errorMessage: err.data?.message,
|
|
1249
|
+
errorType: err.data?.errorType,
|
|
1250
|
+
errorData: err.data?.errorData,
|
|
1251
|
+
reasonCode: err.data?.reasonCode,
|
|
1252
|
+
};
|
|
1171
1253
|
this.metricsManager.trackEvent(
|
|
1172
1254
|
METRIC_EVENT_NAMES.TASK_CONSULT_END_FAILED,
|
|
1173
1255
|
{
|
|
1174
1256
|
taskId: this.data.interactionId,
|
|
1175
1257
|
error: error.toString(),
|
|
1258
|
+
...taskErrorProps,
|
|
1176
1259
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
1177
1260
|
},
|
|
1178
1261
|
['operational', 'behavioral', 'business']
|
|
1179
1262
|
);
|
|
1180
|
-
throw
|
|
1263
|
+
throw err;
|
|
1181
1264
|
}
|
|
1182
1265
|
}
|
|
1183
1266
|
|
|
@@ -1258,7 +1341,14 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
1258
1341
|
|
|
1259
1342
|
return result;
|
|
1260
1343
|
} catch (error) {
|
|
1261
|
-
const
|
|
1344
|
+
const err = generateTaskErrorObject(error, METHODS.TRANSFER, TASK_FILE);
|
|
1345
|
+
const taskErrorProps = {
|
|
1346
|
+
trackingId: err.data?.trackingId,
|
|
1347
|
+
errorMessage: err.data?.message,
|
|
1348
|
+
errorType: err.data?.errorType,
|
|
1349
|
+
errorData: err.data?.errorData,
|
|
1350
|
+
reasonCode: err.data?.reasonCode,
|
|
1351
|
+
};
|
|
1262
1352
|
this.metricsManager.trackEvent(
|
|
1263
1353
|
METRIC_EVENT_NAMES.TASK_TRANSFER_FAILED,
|
|
1264
1354
|
{
|
|
@@ -1267,11 +1357,12 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
1267
1357
|
destinationType: transferPayload.destinationType,
|
|
1268
1358
|
isConsultTransfer: false,
|
|
1269
1359
|
error: error.toString(),
|
|
1360
|
+
...taskErrorProps,
|
|
1270
1361
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
1271
1362
|
},
|
|
1272
1363
|
['operational', 'behavioral', 'business']
|
|
1273
1364
|
);
|
|
1274
|
-
throw
|
|
1365
|
+
throw err;
|
|
1275
1366
|
}
|
|
1276
1367
|
}
|
|
1277
1368
|
|
|
@@ -1308,68 +1399,93 @@ export default class Task extends EventEmitter implements ITask {
|
|
|
1308
1399
|
* ```
|
|
1309
1400
|
*/
|
|
1310
1401
|
public async consultTransfer(
|
|
1311
|
-
consultTransferPayload
|
|
1402
|
+
consultTransferPayload?: ConsultTransferPayLoad
|
|
1312
1403
|
): Promise<TaskResponse> {
|
|
1313
1404
|
try {
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1405
|
+
// Get the destination agent ID using custom logic from participants data
|
|
1406
|
+
const destAgentId = getDestinationAgentId(
|
|
1407
|
+
this.data.interaction?.participants,
|
|
1408
|
+
this.data.agentId
|
|
1409
|
+
);
|
|
1319
1410
|
|
|
1320
|
-
//
|
|
1321
|
-
if (
|
|
1322
|
-
|
|
1323
|
-
|
|
1411
|
+
// Resolve the target id (queue consult transfers go to the accepted agent)
|
|
1412
|
+
if (!destAgentId) {
|
|
1413
|
+
throw new Error('No agent has accepted this queue consult yet');
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
LoggerProxy.info(
|
|
1417
|
+
`Initiating consult transfer to ${consultTransferPayload?.to || destAgentId}`,
|
|
1418
|
+
{
|
|
1419
|
+
module: TASK_FILE,
|
|
1420
|
+
method: METHODS.CONSULT_TRANSFER,
|
|
1421
|
+
interactionId: this.data.interactionId,
|
|
1324
1422
|
}
|
|
1423
|
+
);
|
|
1424
|
+
// Obtain payload based on desktop logic using TaskData
|
|
1425
|
+
const finalDestinationType = deriveConsultTransferDestinationType(this.data);
|
|
1325
1426
|
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
}
|
|
1427
|
+
// By default we always use the computed destAgentId as the target id
|
|
1428
|
+
const consultTransferRequest: ConsultTransferPayLoad = {
|
|
1429
|
+
to: destAgentId,
|
|
1430
|
+
destinationType: finalDestinationType,
|
|
1431
|
+
};
|
|
1332
1432
|
|
|
1333
1433
|
const result = await this.contact.consultTransfer({
|
|
1334
1434
|
interactionId: this.data.interactionId,
|
|
1335
|
-
data:
|
|
1435
|
+
data: consultTransferRequest,
|
|
1336
1436
|
});
|
|
1337
1437
|
|
|
1338
1438
|
this.metricsManager.trackEvent(
|
|
1339
1439
|
METRIC_EVENT_NAMES.TASK_TRANSFER_SUCCESS,
|
|
1340
1440
|
{
|
|
1341
1441
|
taskId: this.data.interactionId,
|
|
1342
|
-
destination:
|
|
1343
|
-
destinationType:
|
|
1442
|
+
destination: consultTransferRequest.to,
|
|
1443
|
+
destinationType: consultTransferRequest.destinationType,
|
|
1344
1444
|
isConsultTransfer: true,
|
|
1345
1445
|
...MetricsManager.getCommonTrackingFieldForAQMResponse(result),
|
|
1346
1446
|
},
|
|
1347
1447
|
['operational', 'behavioral', 'business']
|
|
1348
1448
|
);
|
|
1349
1449
|
|
|
1350
|
-
LoggerProxy.log(
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1450
|
+
LoggerProxy.log(
|
|
1451
|
+
`Consult transfer completed successfully to ${consultTransferPayload?.to || destAgentId}`,
|
|
1452
|
+
{
|
|
1453
|
+
module: TASK_FILE,
|
|
1454
|
+
method: METHODS.CONSULT_TRANSFER,
|
|
1455
|
+
trackingId: result.trackingId,
|
|
1456
|
+
interactionId: this.data.interactionId,
|
|
1457
|
+
}
|
|
1458
|
+
);
|
|
1356
1459
|
|
|
1357
1460
|
return result;
|
|
1358
1461
|
} catch (error) {
|
|
1359
|
-
const
|
|
1462
|
+
const err = generateTaskErrorObject(error, METHODS.CONSULT_TRANSFER, TASK_FILE);
|
|
1463
|
+
const taskErrorProps = {
|
|
1464
|
+
trackingId: err.data?.trackingId,
|
|
1465
|
+
errorMessage: err.data?.message,
|
|
1466
|
+
errorType: err.data?.errorType,
|
|
1467
|
+
errorData: err.data?.errorData,
|
|
1468
|
+
reasonCode: err.data?.reasonCode,
|
|
1469
|
+
};
|
|
1470
|
+
const failedDestinationType = deriveConsultTransferDestinationType(this.data);
|
|
1471
|
+
const failedDestAgentId = getDestinationAgentId(
|
|
1472
|
+
this.data.interaction?.participants,
|
|
1473
|
+
this.data.agentId
|
|
1474
|
+
);
|
|
1360
1475
|
this.metricsManager.trackEvent(
|
|
1361
1476
|
METRIC_EVENT_NAMES.TASK_TRANSFER_FAILED,
|
|
1362
1477
|
{
|
|
1363
1478
|
taskId: this.data.interactionId,
|
|
1364
|
-
destination:
|
|
1365
|
-
destinationType:
|
|
1479
|
+
destination: failedDestAgentId || '',
|
|
1480
|
+
destinationType: failedDestinationType,
|
|
1366
1481
|
isConsultTransfer: true,
|
|
1367
1482
|
error: error.toString(),
|
|
1483
|
+
...taskErrorProps,
|
|
1368
1484
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(error.details || {}),
|
|
1369
1485
|
},
|
|
1370
1486
|
['operational', 'behavioral', 'business']
|
|
1371
1487
|
);
|
|
1372
|
-
throw
|
|
1488
|
+
throw err;
|
|
1373
1489
|
}
|
|
1374
1490
|
}
|
|
1375
1491
|
}
|
package/src/types.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import * as Agent from './services/agent/types';
|
|
8
8
|
import * as Contact from './services/task/types';
|
|
9
9
|
import {Profile} from './services/config/types';
|
|
10
|
+
import {PaginatedResponse, BaseSearchParams} from './utils/PageCache';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Generic type for converting a const enum object into a union type of its values.
|
|
@@ -192,6 +193,10 @@ export interface LogContext {
|
|
|
192
193
|
method?: string;
|
|
193
194
|
interactionId?: string;
|
|
194
195
|
trackingId?: string;
|
|
196
|
+
/** Additional structured data to include in logs */
|
|
197
|
+
data?: Record<string, any>;
|
|
198
|
+
/** Error object to include in logs */
|
|
199
|
+
error?: Error | unknown;
|
|
195
200
|
}
|
|
196
201
|
|
|
197
202
|
/**
|
|
@@ -620,6 +625,181 @@ export type StationReLoginResponse = Agent.ReloginSuccess | Error;
|
|
|
620
625
|
*/
|
|
621
626
|
export type SetStateResponse = Agent.StateChangeSuccess | Error;
|
|
622
627
|
|
|
628
|
+
/**
|
|
629
|
+
* AddressBook types
|
|
630
|
+
*/
|
|
631
|
+
export interface AddressBookEntry {
|
|
632
|
+
id: string;
|
|
633
|
+
organizationId?: string;
|
|
634
|
+
version?: number;
|
|
635
|
+
name: string;
|
|
636
|
+
number: string;
|
|
637
|
+
createdTime?: number;
|
|
638
|
+
lastUpdatedTime?: number;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
export type AddressBookEntriesResponse = PaginatedResponse<AddressBookEntry>;
|
|
642
|
+
|
|
643
|
+
export interface AddressBookEntrySearchParams extends BaseSearchParams {
|
|
644
|
+
addressBookId?: string;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* EntryPointRecord types
|
|
649
|
+
*/
|
|
650
|
+
export interface EntryPointRecord {
|
|
651
|
+
id: string;
|
|
652
|
+
name: string;
|
|
653
|
+
description?: string;
|
|
654
|
+
type: string;
|
|
655
|
+
isActive: boolean;
|
|
656
|
+
orgId: string;
|
|
657
|
+
createdAt?: string;
|
|
658
|
+
updatedAt?: string;
|
|
659
|
+
settings?: Record<string, any>;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export type EntryPointListResponse = PaginatedResponse<EntryPointRecord>;
|
|
663
|
+
export type EntryPointSearchParams = BaseSearchParams;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Queue types
|
|
667
|
+
*/
|
|
668
|
+
export interface QueueSkillRequirement {
|
|
669
|
+
organizationId?: string;
|
|
670
|
+
id?: string;
|
|
671
|
+
version?: number;
|
|
672
|
+
skillId: string;
|
|
673
|
+
skillName?: string;
|
|
674
|
+
skillType?: string;
|
|
675
|
+
condition: string;
|
|
676
|
+
skillValue: string;
|
|
677
|
+
createdTime?: number;
|
|
678
|
+
lastUpdatedTime?: number;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export interface QueueAgent {
|
|
682
|
+
id: string;
|
|
683
|
+
ciUserId?: string;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export interface AgentGroup {
|
|
687
|
+
teamId: string;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
export interface CallDistributionGroup {
|
|
691
|
+
agentGroups: AgentGroup[];
|
|
692
|
+
order: number;
|
|
693
|
+
duration?: number;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
export interface AssistantSkillMapping {
|
|
697
|
+
assistantSkillId?: string;
|
|
698
|
+
assistantSkillUpdatedTime?: number;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Configuration for a contact service queue
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
export interface ContactServiceQueue {
|
|
706
|
+
/** Organization ID */
|
|
707
|
+
organizationId?: string;
|
|
708
|
+
/** Unique identifier for the queue */
|
|
709
|
+
id?: string;
|
|
710
|
+
/** Version of the queue */
|
|
711
|
+
version?: number;
|
|
712
|
+
/** Name of the Contact Service Queue */
|
|
713
|
+
name: string;
|
|
714
|
+
/** Description of the queue */
|
|
715
|
+
description?: string;
|
|
716
|
+
/** Queue type (INBOUND, OUTBOUND) */
|
|
717
|
+
queueType: 'INBOUND' | 'OUTBOUND';
|
|
718
|
+
/** Whether to check agent availability */
|
|
719
|
+
checkAgentAvailability: boolean;
|
|
720
|
+
/** Channel type (TELEPHONY, EMAIL, SOCIAL_CHANNEL, CHAT, etc.) */
|
|
721
|
+
channelType: 'TELEPHONY' | 'EMAIL' | 'FAX' | 'CHAT' | 'VIDEO' | 'OTHERS' | 'SOCIAL_CHANNEL';
|
|
722
|
+
/** Social channel type for SOCIAL_CHANNEL channelType */
|
|
723
|
+
socialChannelType?:
|
|
724
|
+
| 'MESSAGEBIRD'
|
|
725
|
+
| 'MESSENGER'
|
|
726
|
+
| 'WHATSAPP'
|
|
727
|
+
| 'APPLE_BUSINESS_CHAT'
|
|
728
|
+
| 'GOOGLE_BUSINESS_MESSAGES';
|
|
729
|
+
/** Service level threshold in seconds */
|
|
730
|
+
serviceLevelThreshold: number;
|
|
731
|
+
/** Maximum number of simultaneous contacts */
|
|
732
|
+
maxActiveContacts: number;
|
|
733
|
+
/** Maximum time in queue in seconds */
|
|
734
|
+
maxTimeInQueue: number;
|
|
735
|
+
/** Default music in queue media file ID */
|
|
736
|
+
defaultMusicInQueueMediaFileId: string;
|
|
737
|
+
/** Timezone for routing strategies */
|
|
738
|
+
timezone?: string;
|
|
739
|
+
/** Whether the queue is active */
|
|
740
|
+
active: boolean;
|
|
741
|
+
/** Whether outdial campaign is enabled */
|
|
742
|
+
outdialCampaignEnabled?: boolean;
|
|
743
|
+
/** Whether monitoring is permitted */
|
|
744
|
+
monitoringPermitted: boolean;
|
|
745
|
+
/** Whether parking is permitted */
|
|
746
|
+
parkingPermitted: boolean;
|
|
747
|
+
/** Whether recording is permitted */
|
|
748
|
+
recordingPermitted: boolean;
|
|
749
|
+
/** Whether recording all calls is permitted */
|
|
750
|
+
recordingAllCallsPermitted: boolean;
|
|
751
|
+
/** Whether pausing recording is permitted */
|
|
752
|
+
pauseRecordingPermitted: boolean;
|
|
753
|
+
/** Recording pause duration in seconds */
|
|
754
|
+
recordingPauseDuration?: number;
|
|
755
|
+
/** Control flow script URL */
|
|
756
|
+
controlFlowScriptUrl: string;
|
|
757
|
+
/** IVR requeue URL */
|
|
758
|
+
ivrRequeueUrl: string;
|
|
759
|
+
/** Overflow number for telephony */
|
|
760
|
+
overflowNumber?: string;
|
|
761
|
+
/** Vendor ID */
|
|
762
|
+
vendorId?: string;
|
|
763
|
+
/** Routing type */
|
|
764
|
+
routingType: 'LONGEST_AVAILABLE_AGENT' | 'SKILLS_BASED' | 'CIRCULAR' | 'LINEAR';
|
|
765
|
+
/** Skills-based routing type */
|
|
766
|
+
skillBasedRoutingType?: 'LONGEST_AVAILABLE_AGENT' | 'BEST_AVAILABLE_AGENT';
|
|
767
|
+
/** Queue routing type */
|
|
768
|
+
queueRoutingType: 'TEAM_BASED' | 'SKILL_BASED' | 'AGENT_BASED';
|
|
769
|
+
/** Queue skill requirements */
|
|
770
|
+
queueSkillRequirements?: QueueSkillRequirement[];
|
|
771
|
+
/** List of agents for agent-based queue */
|
|
772
|
+
agents?: QueueAgent[];
|
|
773
|
+
/** Call distribution groups */
|
|
774
|
+
callDistributionGroups: CallDistributionGroup[];
|
|
775
|
+
/** XSP version */
|
|
776
|
+
xspVersion?: string;
|
|
777
|
+
/** Subscription ID */
|
|
778
|
+
subscriptionId?: string;
|
|
779
|
+
/** Assistant skill mapping */
|
|
780
|
+
assistantSkill?: AssistantSkillMapping;
|
|
781
|
+
/** Whether this is a system default queue */
|
|
782
|
+
systemDefault?: boolean;
|
|
783
|
+
/** User who last updated agents list */
|
|
784
|
+
agentsLastUpdatedByUserName?: string;
|
|
785
|
+
/** Email of user who last updated agents list */
|
|
786
|
+
agentsLastUpdatedByUserEmailPrefix?: string;
|
|
787
|
+
/** When agents list was last updated */
|
|
788
|
+
agentsLastUpdatedTime?: number;
|
|
789
|
+
/** Creation timestamp in epoch millis */
|
|
790
|
+
createdTime?: number;
|
|
791
|
+
/** Last updated timestamp in epoch millis */
|
|
792
|
+
lastUpdatedTime?: number;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export type ContactServiceQueuesResponse = PaginatedResponse<ContactServiceQueue>;
|
|
796
|
+
|
|
797
|
+
export interface ContactServiceQueueSearchParams extends BaseSearchParams {
|
|
798
|
+
desktopProfileFilter?: boolean;
|
|
799
|
+
provisioningView?: boolean;
|
|
800
|
+
singleObjectResponse?: boolean;
|
|
801
|
+
}
|
|
802
|
+
|
|
623
803
|
/**
|
|
624
804
|
* Response type for buddy agents query operations.
|
|
625
805
|
* Either a success response with list of buddy agents or an error.
|