@webex/contact-center 3.12.0-next.72 → 3.12.0-next.74
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/AGENTS.md +438 -0
- package/ai-docs/README.md +131 -0
- package/ai-docs/RULES.md +455 -0
- package/ai-docs/patterns/event-driven-patterns.md +485 -0
- package/ai-docs/patterns/testing-patterns.md +480 -0
- package/ai-docs/patterns/typescript-patterns.md +365 -0
- package/ai-docs/templates/README.md +102 -0
- package/ai-docs/templates/documentation/create-agents-md.md +240 -0
- package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
- package/ai-docs/templates/existing-service/bug-fix.md +254 -0
- package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
- package/ai-docs/templates/new-method/00-master.md +80 -0
- package/ai-docs/templates/new-method/01-requirements.md +232 -0
- package/ai-docs/templates/new-method/02-implementation.md +295 -0
- package/ai-docs/templates/new-method/03-tests.md +201 -0
- package/ai-docs/templates/new-method/04-validation.md +141 -0
- package/ai-docs/templates/new-service/00-master.md +109 -0
- package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
- package/ai-docs/templates/new-service/02-code-generation.md +346 -0
- package/ai-docs/templates/new-service/03-integration.md +178 -0
- package/ai-docs/templates/new-service/04-test-generation.md +205 -0
- package/ai-docs/templates/new-service/05-validation.md +145 -0
- package/dist/cc.js +53 -38
- package/dist/cc.js.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +14 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +26 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +9 -3
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +74 -3
- package/dist/services/ApiAiAssistant.js.map +1 -1
- package/dist/services/config/Util.js +2 -2
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/types.js +25 -9
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/Utils.js +74 -27
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +2 -1
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +688 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +45 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +725 -612
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +162 -26
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +6 -1
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/digital/Digital.js +77 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +837 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +543 -0
- package/dist/services/task/state-machine/actions.js.map +1 -0
- package/dist/services/task/state-machine/constants.js +161 -0
- package/dist/services/task/state-machine/constants.js.map +1 -0
- package/dist/services/task/state-machine/guards.js +340 -0
- package/dist/services/task/state-machine/guards.js.map +1 -0
- package/dist/services/task/state-machine/index.js +53 -0
- package/dist/services/task/state-machine/index.js.map +1 -0
- package/dist/services/task/state-machine/types.js +54 -0
- package/dist/services/task/state-machine/types.js.map +1 -0
- package/dist/services/task/state-machine/uiControlsComputer.js +553 -0
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
- package/dist/services/task/taskDataNormalizer.js +99 -0
- package/dist/services/task/taskDataNormalizer.js.map +1 -0
- package/dist/services/task/types.js +168 -16
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1042 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +149 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/types/cc.d.ts +19 -18
- package/dist/types/config.d.ts +6 -0
- package/dist/types/constants.d.ts +14 -1
- package/dist/types/index.d.ts +11 -5
- package/dist/types/metrics/constants.d.ts +7 -1
- package/dist/types/services/ApiAiAssistant.d.ts +11 -3
- package/dist/types/services/config/types.d.ts +113 -9
- package/dist/types/services/core/Utils.d.ts +23 -10
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
- package/dist/types/services/core/websocket/types.d.ts +1 -1
- package/dist/types/services/index.d.ts +1 -1
- package/dist/types/services/task/Task.d.ts +157 -0
- package/dist/types/services/task/TaskFactory.d.ts +12 -0
- package/dist/types/services/task/TaskUtils.d.ts +46 -2
- package/dist/types/services/task/constants.d.ts +5 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1144 -0
- package/dist/types/services/task/state-machine/actions.d.ts +10 -0
- package/dist/types/services/task/state-machine/constants.d.ts +107 -0
- package/dist/types/services/task/state-machine/guards.d.ts +90 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +267 -0
- package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
- package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
- package/dist/types/services/task/types.d.ts +551 -78
- package/dist/types/services/task/voice/Voice.d.ts +184 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/types.d.ts +92 -0
- package/dist/types/webex.d.ts +1 -0
- package/dist/types.js +85 -0
- package/dist/types.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +15 -12
- package/src/cc.ts +63 -43
- package/src/config.ts +6 -0
- package/src/constants.ts +14 -1
- package/src/index.ts +14 -5
- package/src/metrics/ai-docs/AGENTS.md +348 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +336 -0
- package/src/metrics/behavioral-events.ts +28 -0
- package/src/metrics/constants.ts +9 -4
- package/src/services/ApiAiAssistant.ts +104 -3
- package/src/services/agent/ai-docs/AGENTS.md +238 -0
- package/src/services/agent/ai-docs/ARCHITECTURE.md +302 -0
- package/src/services/ai-docs/AGENTS.md +384 -0
- package/src/services/config/Util.ts +2 -2
- package/src/services/config/ai-docs/AGENTS.md +253 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
- package/src/services/config/types.ts +116 -10
- package/src/services/core/Utils.ts +85 -34
- package/src/services/core/ai-docs/AGENTS.md +379 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
- package/src/services/core/websocket/WebSocketManager.ts +2 -0
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +1 -1
- package/src/services/task/Task.ts +837 -0
- package/src/services/task/TaskFactory.ts +55 -0
- package/src/services/task/TaskManager.ts +738 -697
- package/src/services/task/TaskUtils.ts +205 -25
- package/src/services/task/ai-docs/AGENTS.md +455 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +585 -0
- package/src/services/task/constants.ts +5 -0
- package/src/services/task/digital/Digital.ts +95 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1077 -0
- package/src/services/task/state-machine/actions.ts +685 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +495 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1135 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/guards.ts +406 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +241 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +867 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +654 -85
- package/src/services/task/voice/Voice.ts +1267 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +112 -1
- package/src/utils/AGENTS.md +276 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +133 -3
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +122 -17
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/config/index.ts +27 -27
- package/test/unit/spec/services/core/Utils.ts +335 -1
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +477 -0
- package/test/unit/spec/services/task/TaskFactory.ts +62 -0
- package/test/unit/spec/services/task/TaskManager.ts +821 -1936
- package/test/unit/spec/services/task/TaskUtils.ts +206 -0
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1825 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +479 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2020 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +631 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
- package/dist/services/task/index.js +0 -1530
- package/dist/services/task/index.js.map +0 -1
- package/dist/types/services/task/index.d.ts +0 -650
- package/src/services/task/index.ts +0 -1806
- package/test/unit/spec/services/task/index.ts +0 -2205
|
@@ -65,6 +65,8 @@ export const CC_TASK_EVENTS = {
|
|
|
65
65
|
AGENT_CONFERENCE_TRANSFER_FAILED: 'AgentConferenceTransferFailed',
|
|
66
66
|
/** Event emitted for post-call activity by participant */
|
|
67
67
|
PARTICIPANT_POST_CALL_ACTIVITY: 'ParticipantPostCallActivity',
|
|
68
|
+
/** Event emitted when consulted participant is being moved/transferred */
|
|
69
|
+
CONSULTED_PARTICIPANT_MOVING: 'ConsultedParticipantMoving',
|
|
68
70
|
/** Event emitted when contact is blind transferred */
|
|
69
71
|
AGENT_BLIND_TRANSFERRED: 'AgentBlindTransferred',
|
|
70
72
|
/** Event emitted when blind transfer fails */
|
|
@@ -81,6 +83,8 @@ export const CC_TASK_EVENTS = {
|
|
|
81
83
|
AGENT_CONSULT_TRANSFER_FAILED: 'AgentConsultTransferFailed',
|
|
82
84
|
/** Event emitted when contact recording is paused */
|
|
83
85
|
CONTACT_RECORDING_PAUSED: 'ContactRecordingPaused',
|
|
86
|
+
/** Event emitted when contact recording is started */
|
|
87
|
+
CONTACT_RECORDING_STARTED: 'ContactRecordingStarted',
|
|
84
88
|
/** Event emitted when pausing contact recording fails */
|
|
85
89
|
CONTACT_RECORDING_PAUSE_FAILED: 'ContactRecordingPauseFailed',
|
|
86
90
|
/** Event emitted when contact recording is resumed */
|
|
@@ -91,6 +95,10 @@ export const CC_TASK_EVENTS = {
|
|
|
91
95
|
CONTACT_ENDED: 'ContactEnded',
|
|
92
96
|
/** Event emitted when contact is merged */
|
|
93
97
|
CONTACT_MERGED: 'ContactMerged',
|
|
98
|
+
/** Event emitted when contact payload is updated (routing updates) */
|
|
99
|
+
CONTACT_UPDATED: 'ContactUpdated',
|
|
100
|
+
/** Event emitted when contact owner changes */
|
|
101
|
+
CONTACT_OWNER_CHANGED: 'ContactOwnerChanged',
|
|
94
102
|
/** Event emitted when ending contact fails */
|
|
95
103
|
AGENT_CONTACT_END_FAILED: 'AgentContactEndFailed',
|
|
96
104
|
/** Event emitted when agent enters wrap-up state */
|
|
@@ -123,6 +131,14 @@ export const CC_TASK_EVENTS = {
|
|
|
123
131
|
CAMPAIGN_PREVIEW_REMOVE_FAILED: 'CampaignPreviewRemoveFailed',
|
|
124
132
|
/** Event emitted when a real-time transcript chunk is received */
|
|
125
133
|
REAL_TIME_TRANSCRIPTION: 'REAL_TIME_TRANSCRIPTION',
|
|
134
|
+
/** Event emitted when an AI assistant suggested response is available */
|
|
135
|
+
SUGGESTED_RESPONSE: 'SUGGESTED_RESPONSE',
|
|
136
|
+
/** Event emitted when backend acknowledges it is listening for more context */
|
|
137
|
+
SUGGESTED_RESPONSE_ACKNOWLEDGE: 'SUGGESTED_RESPONSE_ACKNOWLEDGE',
|
|
138
|
+
/** Event emitted when a mid-call summary is available */
|
|
139
|
+
MID_CALL_SUMMARY: 'MID_CALL_SUMMARY',
|
|
140
|
+
/** Event emitted when a post-call summary is available */
|
|
141
|
+
POST_CALL_SUMMARY: 'POST_CALL_SUMMARY',
|
|
126
142
|
} as const;
|
|
127
143
|
|
|
128
144
|
/**
|
|
@@ -189,6 +205,15 @@ export type WelcomeEvent = {
|
|
|
189
205
|
agentId: string;
|
|
190
206
|
};
|
|
191
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Available login options for voice channel access
|
|
210
|
+
* 'AGENT_DN' - Login using agent's DN
|
|
211
|
+
* 'EXTENSION' - Login using extension number
|
|
212
|
+
* 'BROWSER' - Login using browser-based WebRTC
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
export type LoginOption = 'AGENT_DN' | 'EXTENSION' | 'BROWSER';
|
|
216
|
+
|
|
192
217
|
/**
|
|
193
218
|
* Response type for welcome events which can be either success or error
|
|
194
219
|
* @public
|
|
@@ -288,6 +313,31 @@ export type AgentResponse = {
|
|
|
288
313
|
* Represents the response from getDesktopProfileById method.
|
|
289
314
|
*/
|
|
290
315
|
export type DesktopProfileResponse = {
|
|
316
|
+
/**
|
|
317
|
+
* Unique identifier of the agent profile configuration.
|
|
318
|
+
*/
|
|
319
|
+
id: string;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Display name for the agent profile.
|
|
323
|
+
*/
|
|
324
|
+
name: string;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Description of the agent profile.
|
|
328
|
+
*/
|
|
329
|
+
description: string;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Parent entity type for the profile (for example ORGANIZATION).
|
|
333
|
+
*/
|
|
334
|
+
parentType: string;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Indicates whether screen pop is enabled.
|
|
338
|
+
*/
|
|
339
|
+
screenPopup: boolean;
|
|
340
|
+
|
|
291
341
|
/**
|
|
292
342
|
* Represents the voice options of an agent.
|
|
293
343
|
*/
|
|
@@ -328,6 +378,11 @@ export type DesktopProfileResponse = {
|
|
|
328
378
|
*/
|
|
329
379
|
autoWrapUp: boolean;
|
|
330
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Whether the agent personal greeting is enabled.
|
|
383
|
+
*/
|
|
384
|
+
agentPersonalGreeting: boolean;
|
|
385
|
+
|
|
331
386
|
/**
|
|
332
387
|
* Auto answer allowed.
|
|
333
388
|
*/
|
|
@@ -348,6 +403,36 @@ export type DesktopProfileResponse = {
|
|
|
348
403
|
*/
|
|
349
404
|
allowAutoWrapUpExtension: boolean;
|
|
350
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Access control for queues assigned to the agent (ALL or SPECIFIC).
|
|
408
|
+
*/
|
|
409
|
+
accessQueue: string;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Queue identifiers available to the agent when access is SPECIFIC.
|
|
413
|
+
*/
|
|
414
|
+
queues: string[];
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Access control for entry points assigned to the agent.
|
|
418
|
+
*/
|
|
419
|
+
accessEntryPoint: string;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Entry point identifiers available to the agent when access is SPECIFIC.
|
|
423
|
+
*/
|
|
424
|
+
entryPoints: string[];
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Access control for buddy teams assigned to the agent.
|
|
428
|
+
*/
|
|
429
|
+
accessBuddyTeam: string;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Buddy team identifiers available to the agent when access is SPECIFIC.
|
|
433
|
+
*/
|
|
434
|
+
buddyTeams: string[];
|
|
435
|
+
|
|
351
436
|
/**
|
|
352
437
|
* Outdial enabled for the agent.
|
|
353
438
|
*/
|
|
@@ -391,6 +476,11 @@ export type DesktopProfileResponse = {
|
|
|
391
476
|
*/
|
|
392
477
|
agentDNValidation: string;
|
|
393
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Additional DN validation criteria configured for the agent.
|
|
481
|
+
*/
|
|
482
|
+
agentDNValidationCriterions: string[];
|
|
483
|
+
|
|
394
484
|
/**
|
|
395
485
|
* Dial plans of the agent.
|
|
396
486
|
*/
|
|
@@ -425,6 +515,31 @@ export type DesktopProfileResponse = {
|
|
|
425
515
|
* State synchronization in Webex enabled or not.
|
|
426
516
|
*/
|
|
427
517
|
stateSynchronizationWebex: boolean;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Threshold rules configured for the agent profile.
|
|
521
|
+
*/
|
|
522
|
+
thresholdRules: Array<Record<string, string | number>>;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Whether the agent profile is currently active.
|
|
526
|
+
*/
|
|
527
|
+
active: boolean;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Whether this profile is the system default.
|
|
531
|
+
*/
|
|
532
|
+
systemDefault: boolean;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Timestamp when the profile was created.
|
|
536
|
+
*/
|
|
537
|
+
createdTime: number;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Timestamp when the profile was last updated.
|
|
541
|
+
*/
|
|
542
|
+
lastUpdatedTime: number;
|
|
428
543
|
};
|
|
429
544
|
|
|
430
545
|
/**
|
|
@@ -871,15 +986,6 @@ export type WrapupData = {
|
|
|
871
986
|
};
|
|
872
987
|
};
|
|
873
988
|
|
|
874
|
-
/**
|
|
875
|
-
* Available login options for voice channel access
|
|
876
|
-
* 'AGENT_DN' - Login using agent's DN
|
|
877
|
-
* 'EXTENSION' - Login using extension number
|
|
878
|
-
* 'BROWSER' - Login using browser-based WebRTC
|
|
879
|
-
* @public
|
|
880
|
-
*/
|
|
881
|
-
export type LoginOption = 'AGENT_DN' | 'EXTENSION' | 'BROWSER';
|
|
882
|
-
|
|
883
989
|
/**
|
|
884
990
|
* Team configuration information
|
|
885
991
|
* @public
|
|
@@ -1052,7 +1158,7 @@ export type Profile = {
|
|
|
1052
1158
|
/** Outbound entry point */
|
|
1053
1159
|
outDialEp: string;
|
|
1054
1160
|
/** Whether ending calls is enabled */
|
|
1055
|
-
|
|
1161
|
+
isEndTaskEnabled: boolean;
|
|
1056
1162
|
/** Whether ending consultations is enabled */
|
|
1057
1163
|
isEndConsultEnabled: boolean;
|
|
1058
1164
|
/** Optional lifecycle manager URL */
|
|
@@ -4,10 +4,14 @@ import {Failure, AugmentedError} from './GlobalTypes';
|
|
|
4
4
|
import LoggerProxy from '../../logger-proxy';
|
|
5
5
|
import WebexRequest from './WebexRequest';
|
|
6
6
|
import {
|
|
7
|
+
ConsultConferenceData,
|
|
8
|
+
consultConferencePayloadData,
|
|
9
|
+
ConsultTransferDestinationType,
|
|
7
10
|
TaskData,
|
|
8
|
-
ConsultTransferPayLoad,
|
|
9
11
|
CONSULT_TRANSFER_DESTINATION_TYPE,
|
|
12
|
+
DESTINATION_TYPE,
|
|
10
13
|
Interaction,
|
|
14
|
+
InteractionParticipant,
|
|
11
15
|
} from '../task/types';
|
|
12
16
|
import {PARTICIPANT_TYPES, STATE_CONSULT} from './constants';
|
|
13
17
|
import {DialPlan} from '../config/types';
|
|
@@ -27,28 +31,6 @@ const getCommonErrorDetails = (errObj: WebexRequestPayload) => {
|
|
|
27
31
|
};
|
|
28
32
|
};
|
|
29
33
|
|
|
30
|
-
/**
|
|
31
|
-
* Checks if the destination type represents an entry point variant (EPDN or ENTRYPOINT).
|
|
32
|
-
*/
|
|
33
|
-
const isEntryPointOrEpdn = (destAgentType?: string): boolean => {
|
|
34
|
-
return destAgentType === 'EPDN' || destAgentType === 'ENTRYPOINT';
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Determines if the task involves dialing a number based on the destination type.
|
|
39
|
-
* Returns 'DIAL_NUMBER' for dial-related destinations, empty string otherwise.
|
|
40
|
-
*/
|
|
41
|
-
const getAgentActionTypeFromTask = (taskData?: TaskData): 'DIAL_NUMBER' | '' => {
|
|
42
|
-
const destAgentType = taskData?.destinationType;
|
|
43
|
-
|
|
44
|
-
// Check if destination requires dialing: direct dial number or entry point variants
|
|
45
|
-
const isDialNumber = destAgentType === 'DN';
|
|
46
|
-
const isEntryPointVariant = isEntryPointOrEpdn(destAgentType);
|
|
47
|
-
|
|
48
|
-
// If the destination type is a dial number or an entry point variant, return 'DIAL_NUMBER'
|
|
49
|
-
return isDialNumber || isEntryPointVariant ? 'DIAL_NUMBER' : '';
|
|
50
|
-
};
|
|
51
|
-
|
|
52
34
|
/**
|
|
53
35
|
* Strips characters defined in the dial plan entry from the input string.
|
|
54
36
|
*
|
|
@@ -278,6 +260,7 @@ export const createErrDetailsObject = (errObj: WebexRequestPayload) => {
|
|
|
278
260
|
return new Err.Details('Service.reqs.generic.failure', details);
|
|
279
261
|
};
|
|
280
262
|
|
|
263
|
+
/*
|
|
281
264
|
/**
|
|
282
265
|
* Gets the consulted agent ID from the media object by finding the agent
|
|
283
266
|
* in the consult media participants (excluding the current agent).
|
|
@@ -356,9 +339,16 @@ export const calculateDestAgentId = (interaction: Interaction, agentId: string):
|
|
|
356
339
|
return destAgentIdCBT;
|
|
357
340
|
}
|
|
358
341
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
342
|
+
const participant = interaction.participants[consultingAgent];
|
|
343
|
+
if (!participant) {
|
|
344
|
+
return '';
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (participant.type === PARTICIPANT_TYPES.EP_DN) {
|
|
348
|
+
return (participant as InteractionParticipant & {epId?: string}).epId ?? '';
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return participant.id ?? '';
|
|
362
352
|
};
|
|
363
353
|
|
|
364
354
|
/**
|
|
@@ -393,16 +383,77 @@ export const calculateDestType = (interaction: Interaction, agentId: string): st
|
|
|
393
383
|
return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
|
|
394
384
|
};
|
|
395
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Gets the destination agent ID from participants.
|
|
388
|
+
* Finds a participant who is not the current agent and is an agent type.
|
|
389
|
+
*
|
|
390
|
+
* @param participants - The participants object from interaction
|
|
391
|
+
* @param agentId - The current agent's ID
|
|
392
|
+
* @returns The destination agent ID, or undefined if none found
|
|
393
|
+
*/
|
|
394
|
+
export const buildConsultConferenceParamData = (
|
|
395
|
+
dataPassed: consultConferencePayloadData,
|
|
396
|
+
interactionIdPassed: string
|
|
397
|
+
): {interactionId: string; data: ConsultConferenceData} => {
|
|
398
|
+
const data: ConsultConferenceData = {
|
|
399
|
+
...('agentId' in dataPassed && {agentId: dataPassed.agentId}),
|
|
400
|
+
to: dataPassed.destAgentId,
|
|
401
|
+
destinationType: '',
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
if ('destinationType' in dataPassed) {
|
|
405
|
+
const destinationType = String(dataPassed.destinationType || '').trim();
|
|
406
|
+
const normalizedDestinationType = destinationType.toUpperCase().replace(/[-_\s]/g, '');
|
|
407
|
+
|
|
408
|
+
if (normalizedDestinationType === 'DN' || normalizedDestinationType === 'DIALNUMBER') {
|
|
409
|
+
data.destinationType = DESTINATION_TYPE.DIALNUMBER;
|
|
410
|
+
} else if (normalizedDestinationType === 'EPDN' || normalizedDestinationType === 'ENTRYPOINT') {
|
|
411
|
+
data.destinationType = DESTINATION_TYPE.ENTRYPOINT;
|
|
412
|
+
} else if (normalizedDestinationType === 'QUEUE') {
|
|
413
|
+
data.destinationType = DESTINATION_TYPE.QUEUE;
|
|
414
|
+
} else if (normalizedDestinationType === 'AGENT') {
|
|
415
|
+
data.destinationType = DESTINATION_TYPE.AGENT;
|
|
416
|
+
} else {
|
|
417
|
+
data.destinationType = destinationType as ConsultConferenceData['destinationType'];
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
data.destinationType = DESTINATION_TYPE.AGENT;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return {
|
|
424
|
+
interactionId: interactionIdPassed,
|
|
425
|
+
data,
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Derives the consult transfer destination type based on task data.
|
|
431
|
+
* This function determines the appropriate destination type for a consult transfer
|
|
432
|
+
* by examining the destination type stored in the task data.
|
|
433
|
+
*
|
|
434
|
+
* @param taskData - The task data containing destination information
|
|
435
|
+
* @returns The derived consult transfer destination type
|
|
436
|
+
* @public
|
|
437
|
+
*/
|
|
396
438
|
export const deriveConsultTransferDestinationType = (
|
|
397
|
-
taskData
|
|
398
|
-
):
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
439
|
+
taskData: TaskData
|
|
440
|
+
): ConsultTransferDestinationType => {
|
|
441
|
+
const destType = taskData?.destinationType;
|
|
442
|
+
const normalizedDestType = String(destType || '')
|
|
443
|
+
.toUpperCase()
|
|
444
|
+
.replace(/[-_\s]/g, '');
|
|
445
|
+
|
|
446
|
+
// Map destination types to consult transfer destination types
|
|
447
|
+
if (normalizedDestType === 'DN' || normalizedDestType === 'DIALNUMBER') {
|
|
448
|
+
return CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;
|
|
449
|
+
}
|
|
450
|
+
if (normalizedDestType === 'EPDN' || normalizedDestType === 'ENTRYPOINT') {
|
|
451
|
+
return CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;
|
|
452
|
+
}
|
|
453
|
+
if (normalizedDestType === 'QUEUE') {
|
|
454
|
+
return CONSULT_TRANSFER_DESTINATION_TYPE.QUEUE;
|
|
405
455
|
}
|
|
406
456
|
|
|
457
|
+
// Default to agent if no specific type matches
|
|
407
458
|
return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
|
|
408
459
|
};
|