@webex/contact-center 3.12.0 → 3.13.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/.repo-context.json +704 -0
- package/.sdd/manifest.json +1613 -0
- package/AGENTS.md +969 -0
- package/dist/cc.js +1102 -47
- package/dist/cc.js.map +1 -1
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +46 -3
- package/dist/constants.js.map +1 -1
- package/dist/index.js +86 -17
- package/dist/index.js.map +1 -1
- package/dist/metrics/MetricsManager.js +16 -0
- package/dist/metrics/MetricsManager.js.map +1 -1
- package/dist/metrics/behavioral-events.js +211 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +58 -4
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/AddressBook.js +18 -15
- package/dist/services/AddressBook.js.map +1 -1
- package/dist/services/AnswerCallOnWebexService.js +202 -0
- package/dist/services/AnswerCallOnWebexService.js.map +1 -0
- package/dist/services/ApiAiAssistant.js +369 -14
- package/dist/services/ApiAiAssistant.js.map +1 -1
- package/dist/services/EntryPoint.js +46 -68
- package/dist/services/EntryPoint.js.map +1 -1
- package/dist/services/Queue.js +27 -22
- package/dist/services/Queue.js.map +1 -1
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/WebCallingService.js +287 -37
- package/dist/services/WebCallingService.js.map +1 -1
- package/dist/services/WebexCrossClientService.js +225 -0
- package/dist/services/WebexCrossClientService.js.map +1 -0
- package/dist/services/WxAppTelephonyMercurySync.js +111 -0
- package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
- package/dist/services/config/Util.js +48 -48
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +57 -79
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +100 -226
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +100 -40
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/constants.js +19 -1
- package/dist/services/constants.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +131 -32
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/WebexRequest.js +6 -2
- package/dist/services/core/WebexRequest.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +17 -11
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/constants.js +9 -1
- package/dist/services/core/constants.js.map +1 -1
- package/dist/services/core/types.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +26 -6
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/connection-service.js +3 -1
- package/dist/services/core/websocket/connection-service.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +955 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +50 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +1275 -504
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +221 -27
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/WebexCallingUtils.js +70 -0
- package/dist/services/task/WebexCallingUtils.js.map +1 -0
- package/dist/services/task/constants.js +22 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/contact.js +29 -0
- package/dist/services/task/contact.js.map +1 -1
- package/dist/services/task/dialer.js +78 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/digital/Digital.js +78 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +982 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +572 -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 +379 -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 +703 -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 +259 -5
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1504 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +152 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/services/task/voice/wxAppOfferObservability.js +145 -0
- package/dist/services/task/voice/wxAppOfferObservability.js.map +1 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js +395 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
- package/dist/services/wxAppDiagnosticLogging.js +159 -0
- package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
- package/dist/services/wxAppTelephonyUtils.js +19 -0
- package/dist/services/wxAppTelephonyUtils.js.map +1 -0
- package/dist/types/cc.d.ts +222 -10
- package/dist/types/config.d.ts +13 -0
- package/dist/types/constants.d.ts +40 -1
- package/dist/types/index.d.ts +58 -22
- package/dist/types/metrics/MetricsManager.d.ts +6 -0
- package/dist/types/metrics/constants.d.ts +52 -1
- package/dist/types/services/AddressBook.d.ts +2 -1
- package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
- package/dist/types/services/ApiAiAssistant.d.ts +67 -5
- package/dist/types/services/EntryPoint.d.ts +7 -5
- package/dist/types/services/Queue.d.ts +5 -3
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/WebexCrossClientService.d.ts +32 -0
- package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
- package/dist/types/services/config/Util.d.ts +4 -8
- package/dist/types/services/config/constants.d.ts +49 -76
- package/dist/types/services/config/index.d.ts +16 -64
- package/dist/types/services/config/types.d.ts +252 -114
- package/dist/types/services/constants.d.ts +16 -0
- package/dist/types/services/core/Err.d.ts +6 -0
- package/dist/types/services/core/Utils.d.ts +43 -13
- package/dist/types/services/core/WebexRequest.d.ts +1 -0
- package/dist/types/services/core/constants.d.ts +7 -0
- package/dist/types/services/core/types.d.ts +2 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +2 -0
- package/dist/types/services/core/websocket/types.d.ts +1 -1
- package/dist/types/services/index.d.ts +2 -0
- package/dist/types/services/task/Task.d.ts +186 -0
- package/dist/types/services/task/TaskFactory.d.ts +14 -0
- package/dist/types/services/task/TaskUtils.d.ts +54 -2
- package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
- package/dist/types/services/task/constants.d.ts +20 -0
- package/dist/types/services/task/contact.d.ts +4 -0
- package/dist/types/services/task/dialer.d.ts +30 -0
- package/dist/types/services/task/digital/Digital.d.ts +23 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1442 -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 +103 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +277 -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 +790 -66
- package/dist/types/services/task/voice/Voice.d.ts +241 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +54 -0
- package/dist/types/services/task/voice/wxAppOfferObservability.d.ts +39 -0
- package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +68 -0
- package/dist/types/services/wxAppDiagnosticLogging.d.ts +63 -0
- package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
- package/dist/types/types.d.ts +258 -11
- package/dist/types/utils/PageCache.d.ts +20 -3
- package/dist/types/webex.d.ts +1 -0
- package/dist/types.js +204 -6
- package/dist/types.js.map +1 -1
- package/dist/utils/PageCache.js +19 -5
- package/dist/utils/PageCache.js.map +1 -1
- package/dist/webex.js +22 -2
- package/dist/webex.js.map +1 -1
- package/docs/adr/0001-spec-source-policy.md +97 -0
- package/docs/adr/0002-consult-transfer-list-policy.md +345 -0
- package/docs/adr/0003-repo-standards-migration.md +104 -0
- package/docs/adr/index.md +35 -0
- package/docs/architecture.md +460 -0
- package/docs/getting-started.md +142 -0
- package/docs/index.md +53 -0
- package/docs/specs/README.md +98 -0
- package/package.json +17 -12
- package/schemas/repo-context.schema.json +796 -0
- package/src/cc.ts +1439 -105
- package/src/config.ts +13 -0
- package/src/constants.ts +53 -1
- package/src/docs/README.md +727 -0
- package/src/index.ts +72 -16
- package/src/metrics/MetricsManager.ts +16 -0
- package/src/metrics/behavioral-events.ts +218 -0
- package/src/metrics/constants.ts +63 -4
- package/src/metrics/docs/README.md +710 -0
- package/src/services/AddressBook.ts +17 -6
- package/src/services/AnswerCallOnWebexService.ts +239 -0
- package/src/services/ApiAiAssistant.ts +494 -15
- package/src/services/EntryPoint.ts +59 -60
- package/src/services/Queue.ts +29 -12
- package/src/services/UserPreference.ts +509 -0
- package/src/services/WebCallingService.ts +362 -40
- package/src/services/WebexCrossClientService.ts +298 -0
- package/src/services/WxAppTelephonyMercurySync.ts +142 -0
- package/src/services/agent/docs/README.md +673 -0
- package/src/services/config/Util.ts +54 -84
- package/src/services/config/constants.ts +64 -86
- package/src/services/config/docs/README.md +530 -0
- package/src/services/config/index.ts +116 -277
- package/src/services/config/types.ts +238 -125
- package/src/services/constants.ts +18 -0
- package/src/services/core/Err.ts +3 -0
- package/src/services/core/Utils.ts +151 -37
- package/src/services/core/WebexRequest.ts +3 -1
- package/src/services/core/aqm-reqs.ts +18 -12
- package/src/services/core/constants.ts +8 -0
- package/src/services/core/docs/README.md +993 -0
- package/src/services/core/types.ts +33 -1
- package/src/services/core/websocket/WebSocketManager.ts +37 -8
- package/src/services/core/websocket/connection-service.ts +5 -1
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/docs/README.md +765 -0
- package/src/services/index.ts +4 -0
- package/src/services/task/Task.ts +1211 -0
- package/src/services/task/TaskFactory.ts +82 -0
- package/src/services/task/TaskManager.ts +1551 -584
- package/src/services/task/TaskUtils.ts +316 -25
- package/src/services/task/WebexCallingUtils.ts +136 -0
- package/src/services/task/constants.ts +21 -0
- package/src/services/task/contact.ts +30 -0
- package/src/services/task/dialer.ts +80 -0
- package/src/services/task/digital/Digital.ts +102 -0
- package/src/services/task/docs/README.md +1569 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1320 -0
- package/src/services/task/state-machine/actions.ts +741 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/docs/README.md +1388 -0
- package/src/services/task/state-machine/guards.ts +442 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +258 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +974 -70
- package/src/services/task/voice/Voice.ts +1878 -0
- package/src/services/task/voice/WebRTC.ts +194 -0
- package/src/services/task/voice/wxAppOfferObservability.ts +204 -0
- package/src/services/task/voice/wxAppVoiceMethods.ts +575 -0
- package/src/services/wxAppDiagnosticLogging.ts +286 -0
- package/src/services/wxAppTelephonyUtils.ts +14 -0
- package/src/types.ts +323 -13
- package/src/utils/AGENTS.md +291 -0
- package/src/utils/PageCache.ts +38 -5
- package/src/utils/docs/README.md +413 -0
- package/src/webex.js +10 -0
- package/test/unit/fixtures/aiSummaryTestUtils.ts +40 -0
- package/test/unit/spec/cc.ts +4046 -181
- package/test/unit/spec/index.ts +891 -0
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/metrics/MetricsManager.ts +25 -0
- package/test/unit/spec/metrics/behavioral-events.ts +60 -0
- package/test/unit/spec/services/AddressBook.ts +37 -6
- package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +442 -23
- package/test/unit/spec/services/EntryPoint.ts +87 -40
- package/test/unit/spec/services/Queue.ts +123 -12
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +484 -49
- package/test/unit/spec/services/WebexCrossClientService.ts +509 -0
- package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
- package/test/unit/spec/services/config/Util.ts +501 -0
- package/test/unit/spec/services/config/index.ts +318 -548
- package/test/unit/spec/services/core/Utils.ts +447 -8
- package/test/unit/spec/services/core/WebexRequest.ts +8 -7
- package/test/unit/spec/services/core/aqm-reqs.ts +142 -1
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +132 -56
- package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +2723 -0
- package/test/unit/spec/services/task/TaskFactory.ts +116 -0
- package/test/unit/spec/services/task/TaskManager.ts +4800 -1586
- package/test/unit/spec/services/task/TaskUtils.ts +307 -0
- package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
- package/test/unit/spec/services/task/contact.ts +33 -0
- package/test/unit/spec/services/task/dialer.ts +190 -0
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +4060 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +2355 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
- package/test/unit/spec/services/task/voice/wxAppOfferObservability.ts +361 -0
- package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +719 -0
- package/test/unit/spec/services/wxAppDiagnosticLogging.ts +179 -0
- package/test/unit/spec/wellnessSampleUtils.ts +288 -0
- package/typedoc.md +1 -1
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
- package/dist/services/task/index.js +0 -1525
- 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 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -4,14 +4,22 @@ 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';
|
|
14
18
|
|
|
19
|
+
/** Returns whether a value is a non-null object with string keys. */
|
|
20
|
+
export const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
21
|
+
typeof value === 'object' && value !== null;
|
|
22
|
+
|
|
15
23
|
/**
|
|
16
24
|
* Extracts common error details from a Webex request payload.
|
|
17
25
|
*
|
|
@@ -28,60 +36,97 @@ const getCommonErrorDetails = (errObj: WebexRequestPayload) => {
|
|
|
28
36
|
};
|
|
29
37
|
|
|
30
38
|
/**
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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.
|
|
39
|
+
* Strips characters defined in the dial plan entry from the input string.
|
|
40
|
+
*
|
|
41
|
+
* @param input - The dial number to sanitize
|
|
42
|
+
* @param strippedChars - String of characters to remove from the input
|
|
43
|
+
* @returns The sanitized input with specified characters removed
|
|
40
44
|
*/
|
|
41
|
-
const
|
|
42
|
-
|
|
45
|
+
export const stripDialPlanChars = (input: string, strippedChars: string): string => {
|
|
46
|
+
if (!strippedChars) {
|
|
47
|
+
return input;
|
|
48
|
+
}
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
const isDialNumber = destAgentType === 'DN';
|
|
46
|
-
const isEntryPointVariant = isEntryPointOrEpdn(destAgentType);
|
|
50
|
+
const charsToStrip = new Set(strippedChars.split(''));
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
return input
|
|
53
|
+
.split('')
|
|
54
|
+
.filter((c) => !charsToStrip.has(c))
|
|
55
|
+
.join('');
|
|
50
56
|
};
|
|
51
57
|
|
|
52
|
-
// Fallback regex for US/Canada dial numbers when no dial plan entries are configured
|
|
53
|
-
export const FALLBACK_DIAL_NUMBER_REGEX = /1[0-9]{3}[2-9][0-9]{6}([,]{1,10}[0-9]+){0,1}/;
|
|
54
|
-
|
|
55
58
|
/**
|
|
56
59
|
* Validates a dial number against the provided dial plan regex patterns.
|
|
57
60
|
* A number is valid if it matches at least one regex pattern in the dial plans.
|
|
58
|
-
*
|
|
61
|
+
* Skips validation when no dial plan entries are configured, deferring to the server.
|
|
59
62
|
*
|
|
60
63
|
* @param input - The dial number to validate
|
|
61
64
|
* @param dialPlanEntries - Array of dial plan entries containing regex patterns
|
|
62
|
-
* @returns true if the input matches at least one dial plan regex pattern, false otherwise
|
|
65
|
+
* @returns true if the input matches at least one dial plan regex pattern or no entries are configured, false otherwise
|
|
63
66
|
*/
|
|
64
67
|
export const isValidDialNumber = (
|
|
65
68
|
input: string,
|
|
66
69
|
dialPlanEntries: DialPlan['dialPlanEntity']
|
|
67
70
|
): boolean => {
|
|
71
|
+
if (!input) {
|
|
72
|
+
LoggerProxy.warn('Dial number is empty or undefined.', {
|
|
73
|
+
module: 'Utils',
|
|
74
|
+
method: 'isValidDialNumber',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
if (!dialPlanEntries || dialPlanEntries.length === 0) {
|
|
69
|
-
LoggerProxy.
|
|
81
|
+
LoggerProxy.log(
|
|
82
|
+
'No dial plan entries found. Skipping client-side validation, deferring to server.',
|
|
83
|
+
{module: 'Utils', method: 'isValidDialNumber'}
|
|
84
|
+
);
|
|
70
85
|
|
|
71
|
-
return
|
|
86
|
+
return true;
|
|
72
87
|
}
|
|
73
88
|
|
|
74
89
|
return dialPlanEntries.some((entry) => {
|
|
75
90
|
try {
|
|
91
|
+
const sanitizedInput = stripDialPlanChars(input, entry.strippedChars);
|
|
76
92
|
const regex = new RegExp(entry.regex);
|
|
77
93
|
|
|
78
|
-
return regex.test(
|
|
79
|
-
} catch {
|
|
94
|
+
return regex.test(sanitizedInput);
|
|
95
|
+
} catch (e) {
|
|
96
|
+
LoggerProxy.warn(`Failed to validate dial number against entry "${entry.name}": ${e}`, {
|
|
97
|
+
module: 'Utils',
|
|
98
|
+
method: 'isValidDialNumber',
|
|
99
|
+
});
|
|
100
|
+
|
|
80
101
|
return false;
|
|
81
102
|
}
|
|
82
103
|
});
|
|
83
104
|
};
|
|
84
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Checks whether a URL's hostname is, or is a subdomain of, one of the allowed domains.
|
|
108
|
+
*
|
|
109
|
+
* @param url - The candidate URL to validate
|
|
110
|
+
* @param allowedDomains - Domains (or domain suffixes) the URL's hostname must match
|
|
111
|
+
* @returns true when the URL parses and its hostname matches an allowed domain, false otherwise
|
|
112
|
+
*/
|
|
113
|
+
export const isAllowedUrlHost = (
|
|
114
|
+
url: string | undefined | null,
|
|
115
|
+
allowedDomains: string[]
|
|
116
|
+
): boolean => {
|
|
117
|
+
if (!url) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
const hostname = new URL(url).hostname.toLowerCase();
|
|
123
|
+
|
|
124
|
+
return allowedDomains.some((domain) => hostname === domain || hostname.endsWith(`.${domain}`));
|
|
125
|
+
} catch (error) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
85
130
|
export const getStationLoginErrorData = (failure: Failure, loginOption: LoginOption) => {
|
|
86
131
|
let duplicateLocationMessage = 'This value is already in use';
|
|
87
132
|
|
|
@@ -243,6 +288,7 @@ export const createErrDetailsObject = (errObj: WebexRequestPayload) => {
|
|
|
243
288
|
return new Err.Details('Service.reqs.generic.failure', details);
|
|
244
289
|
};
|
|
245
290
|
|
|
291
|
+
/*
|
|
246
292
|
/**
|
|
247
293
|
* Gets the consulted agent ID from the media object by finding the agent
|
|
248
294
|
* in the consult media participants (excluding the current agent).
|
|
@@ -321,9 +367,16 @@ export const calculateDestAgentId = (interaction: Interaction, agentId: string):
|
|
|
321
367
|
return destAgentIdCBT;
|
|
322
368
|
}
|
|
323
369
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
370
|
+
const participant = interaction.participants[consultingAgent];
|
|
371
|
+
if (!participant) {
|
|
372
|
+
return '';
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (participant.type === PARTICIPANT_TYPES.EP_DN) {
|
|
376
|
+
return (participant as InteractionParticipant & {epId?: string}).epId ?? '';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return participant.id ?? '';
|
|
327
380
|
};
|
|
328
381
|
|
|
329
382
|
/**
|
|
@@ -358,16 +411,77 @@ export const calculateDestType = (interaction: Interaction, agentId: string): st
|
|
|
358
411
|
return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
|
|
359
412
|
};
|
|
360
413
|
|
|
414
|
+
/**
|
|
415
|
+
* Gets the destination agent ID from participants.
|
|
416
|
+
* Finds a participant who is not the current agent and is an agent type.
|
|
417
|
+
*
|
|
418
|
+
* @param participants - The participants object from interaction
|
|
419
|
+
* @param agentId - The current agent's ID
|
|
420
|
+
* @returns The destination agent ID, or undefined if none found
|
|
421
|
+
*/
|
|
422
|
+
export const buildConsultConferenceParamData = (
|
|
423
|
+
dataPassed: consultConferencePayloadData,
|
|
424
|
+
interactionIdPassed: string
|
|
425
|
+
): {interactionId: string; data: ConsultConferenceData} => {
|
|
426
|
+
const data: ConsultConferenceData = {
|
|
427
|
+
...('agentId' in dataPassed && {agentId: dataPassed.agentId}),
|
|
428
|
+
to: dataPassed.destAgentId,
|
|
429
|
+
destinationType: '',
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
if ('destinationType' in dataPassed) {
|
|
433
|
+
const destinationType = String(dataPassed.destinationType || '').trim();
|
|
434
|
+
const normalizedDestinationType = destinationType.toUpperCase().replace(/[-_\s]/g, '');
|
|
435
|
+
|
|
436
|
+
if (normalizedDestinationType === 'DN' || normalizedDestinationType === 'DIALNUMBER') {
|
|
437
|
+
data.destinationType = DESTINATION_TYPE.DIALNUMBER;
|
|
438
|
+
} else if (normalizedDestinationType === 'EPDN' || normalizedDestinationType === 'ENTRYPOINT') {
|
|
439
|
+
data.destinationType = DESTINATION_TYPE.ENTRYPOINT;
|
|
440
|
+
} else if (normalizedDestinationType === 'QUEUE') {
|
|
441
|
+
data.destinationType = DESTINATION_TYPE.QUEUE;
|
|
442
|
+
} else if (normalizedDestinationType === 'AGENT') {
|
|
443
|
+
data.destinationType = DESTINATION_TYPE.AGENT;
|
|
444
|
+
} else {
|
|
445
|
+
data.destinationType = destinationType as ConsultConferenceData['destinationType'];
|
|
446
|
+
}
|
|
447
|
+
} else {
|
|
448
|
+
data.destinationType = DESTINATION_TYPE.AGENT;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return {
|
|
452
|
+
interactionId: interactionIdPassed,
|
|
453
|
+
data,
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Derives the consult transfer destination type based on task data.
|
|
459
|
+
* This function determines the appropriate destination type for a consult transfer
|
|
460
|
+
* by examining the destination type stored in the task data.
|
|
461
|
+
*
|
|
462
|
+
* @param taskData - The task data containing destination information
|
|
463
|
+
* @returns The derived consult transfer destination type
|
|
464
|
+
* @public
|
|
465
|
+
*/
|
|
361
466
|
export const deriveConsultTransferDestinationType = (
|
|
362
|
-
taskData
|
|
363
|
-
):
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
467
|
+
taskData: TaskData
|
|
468
|
+
): ConsultTransferDestinationType => {
|
|
469
|
+
const destType = taskData?.destinationType;
|
|
470
|
+
const normalizedDestType = String(destType || '')
|
|
471
|
+
.toUpperCase()
|
|
472
|
+
.replace(/[-_\s]/g, '');
|
|
473
|
+
|
|
474
|
+
// Map destination types to consult transfer destination types
|
|
475
|
+
if (normalizedDestType === 'DN' || normalizedDestType === 'DIALNUMBER') {
|
|
476
|
+
return CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;
|
|
477
|
+
}
|
|
478
|
+
if (normalizedDestType === 'EPDN' || normalizedDestType === 'ENTRYPOINT') {
|
|
479
|
+
return CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;
|
|
480
|
+
}
|
|
481
|
+
if (normalizedDestType === 'QUEUE') {
|
|
482
|
+
return CONSULT_TRANSFER_DESTINATION_TYPE.QUEUE;
|
|
370
483
|
}
|
|
371
484
|
|
|
485
|
+
// Default to agent if no specific type matches
|
|
372
486
|
return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
|
|
373
487
|
};
|
|
@@ -34,14 +34,16 @@ class WebexRequest {
|
|
|
34
34
|
resource: string;
|
|
35
35
|
method: HTTP_METHODS;
|
|
36
36
|
body?: RequestBody;
|
|
37
|
+
headers?: Record<string, string | null>;
|
|
37
38
|
}): Promise<IHttpResponse> {
|
|
38
|
-
const {service, resource, method, body} = options;
|
|
39
|
+
const {service, resource, method, body, headers} = options;
|
|
39
40
|
|
|
40
41
|
return this.webex.request({
|
|
41
42
|
service,
|
|
42
43
|
resource,
|
|
43
44
|
method,
|
|
44
45
|
body,
|
|
46
|
+
...(headers ? {headers} : {}),
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -117,16 +117,15 @@ export default class AqmReqs {
|
|
|
117
117
|
clear();
|
|
118
118
|
const notifFail = c.notifFail!;
|
|
119
119
|
if ('errId' in notifFail) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
LoggerProxy.log(`Routing request failed: ${eerr}`, {
|
|
120
|
+
const error = new Err.Details(notifFail.errId, msg as any);
|
|
121
|
+
|
|
122
|
+
// The raw routing-failure payload/error is never logged verbatim; only a
|
|
123
|
+
// redacted, non-sensitive diagnostic is emitted regardless of redactSensitiveLogs.
|
|
124
|
+
LoggerProxy.log('Routing request failed (sensitive details redacted)', {
|
|
126
125
|
module: AQM_REQS_FILE,
|
|
127
126
|
method: METHODS.CREATE_PROMISE,
|
|
128
127
|
});
|
|
129
|
-
reject(
|
|
128
|
+
reject(error);
|
|
130
129
|
} else {
|
|
131
130
|
reject(notifFail.err(msg as any));
|
|
132
131
|
}
|
|
@@ -176,13 +175,20 @@ export default class AqmReqs {
|
|
|
176
175
|
if (response?.headers) {
|
|
177
176
|
response.headers.Authorization = '*';
|
|
178
177
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
178
|
+
if (c.redactSensitiveLogs) {
|
|
179
|
+
LoggerProxy.error('Routing request timeout (sensitive details redacted)', {
|
|
182
180
|
module: AQM_REQS_FILE,
|
|
183
181
|
method: METHODS.CREATE_PROMISE,
|
|
184
|
-
}
|
|
185
|
-
|
|
182
|
+
});
|
|
183
|
+
} else {
|
|
184
|
+
LoggerProxy.error(
|
|
185
|
+
`Routing request timeout${keySuccess}${JSON.stringify(response)}${c.url}`,
|
|
186
|
+
{
|
|
187
|
+
module: AQM_REQS_FILE,
|
|
188
|
+
method: METHODS.CREATE_PROMISE,
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
186
192
|
reject(
|
|
187
193
|
new Err.Details('Service.aqm.reqs.Timeout', {
|
|
188
194
|
key: keySuccess,
|
|
@@ -80,6 +80,14 @@ export const PARTICIPANT_TYPES = {
|
|
|
80
80
|
/** Interaction state for consultation */
|
|
81
81
|
export const STATE_CONSULT = 'consult';
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Trusted domains for the RoutingNotifs WebSocket connection. A `webSocketUrl` returned by the
|
|
85
|
+
* subscribe/register API is only opened when its hostname matches one of these domains exactly
|
|
86
|
+
* or is a subdomain of one of them.
|
|
87
|
+
* @ignore
|
|
88
|
+
*/
|
|
89
|
+
export const ALLOWED_ROUTING_NOTIFS_DOMAINS = ['cisco.com', 'ciscoccservice.com'];
|
|
90
|
+
|
|
83
91
|
// Method names for core services
|
|
84
92
|
export const METHODS = {
|
|
85
93
|
// WebexRequest methods
|