@webex/contact-center 3.12.0-next.8 → 3.12.0-next.80
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 +265 -29
- package/dist/cc.js.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +16 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +101 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +23 -4
- 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/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/config/Util.js +3 -3
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +23 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/types.js +49 -9
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +107 -32
- 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 -526
- 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 +9 -2
- package/dist/services/task/constants.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 +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 +212 -4
- 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 +94 -1
- package/dist/types/config.d.ts +6 -0
- package/dist/types/constants.d.ts +16 -1
- package/dist/types/index.d.ts +21 -6
- package/dist/types/metrics/constants.d.ts +19 -1
- package/dist/types/services/ApiAiAssistant.d.ts +11 -3
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/config/constants.d.ts +21 -0
- package/dist/types/services/config/types.d.ts +171 -10
- package/dist/types/services/core/Err.d.ts +4 -0
- package/dist/types/services/core/Utils.d.ts +33 -13
- 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 +7 -0
- package/dist/types/services/task/dialer.d.ts +30 -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 +603 -66
- 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 +94 -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 +329 -30
- package/src/config.ts +6 -0
- package/src/constants.ts +16 -1
- package/src/index.ts +23 -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 +106 -0
- package/src/metrics/constants.ts +23 -4
- package/src/services/ApiAiAssistant.ts +104 -3
- package/src/services/UserPreference.ts +509 -0
- 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 +3 -3
- package/src/services/config/ai-docs/AGENTS.md +253 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
- package/src/services/config/constants.ts +25 -1
- package/src/services/config/types.ts +174 -11
- package/src/services/core/Err.ts +2 -0
- package/src/services/core/Utils.ts +123 -37
- 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 -613
- 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 +7 -0
- package/src/services/task/dialer.ts +80 -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 +710 -71
- package/src/services/task/voice/Voice.ts +1267 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +122 -2
- package/src/utils/AGENTS.md +276 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +343 -23
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +122 -17
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/config/index.ts +30 -30
- package/test/unit/spec/services/core/Utils.ts +425 -8
- 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 +832 -1702
- package/test/unit/spec/services/task/TaskUtils.ts +206 -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 +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 -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
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
# Config Service - Architecture
|
|
2
|
+
|
|
3
|
+
> **Purpose**: Technical documentation for agent configuration aggregation.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Component Overview
|
|
8
|
+
|
|
9
|
+
| Component | File | Responsibility |
|
|
10
|
+
|-----------|------|----------------|
|
|
11
|
+
| `AgentConfigService` | `config/index.ts` | Main config service class |
|
|
12
|
+
| `parseAgentConfigs` | `config/Util.ts` | Profile parsing/aggregation |
|
|
13
|
+
| `endPointMap` | `config/constants.ts` | API endpoint definitions |
|
|
14
|
+
| `types` | `config/types.ts` | Types, events, interfaces |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Data Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
sequenceDiagram
|
|
22
|
+
participant CC as ContactCenter
|
|
23
|
+
participant Cfg as AgentConfigService
|
|
24
|
+
participant WR as WebexRequest
|
|
25
|
+
participant API as Backend APIs
|
|
26
|
+
|
|
27
|
+
CC->>Cfg: getAgentConfig(orgId, agentId)
|
|
28
|
+
|
|
29
|
+
par Wave 1 — fire immediately
|
|
30
|
+
Cfg->>WR: getUserUsingCI
|
|
31
|
+
Cfg->>WR: getOrgInfo
|
|
32
|
+
Cfg->>WR: getOrganizationSetting
|
|
33
|
+
Cfg->>WR: getTenantData
|
|
34
|
+
Cfg->>WR: getURLMapping
|
|
35
|
+
Cfg->>WR: getAllAuxCodes
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
WR->>API: 6 parallel API calls
|
|
39
|
+
API-->>WR: Responses
|
|
40
|
+
Note over Cfg: await userConfigData (needed for wave 2)
|
|
41
|
+
|
|
42
|
+
par Wave 2 — depends on userConfigData
|
|
43
|
+
Cfg->>WR: getDesktopProfileById(agentProfileId)
|
|
44
|
+
Cfg->>WR: getSiteInfo(siteId)
|
|
45
|
+
Cfg->>WR: getAllTeams(teamIds)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Note over Cfg: getDialPlanData chained off agentProfile<br/>(fires only if dialPlanEnabled)
|
|
49
|
+
|
|
50
|
+
Note over Cfg: Single Promise.all() awaits all 9 promises<br/>(wave 1 + wave 2 + conditional dialPlan)
|
|
51
|
+
|
|
52
|
+
WR->>API: Remaining API calls
|
|
53
|
+
API-->>WR: Responses
|
|
54
|
+
|
|
55
|
+
Cfg->>Cfg: parseAgentConfigs(allData)
|
|
56
|
+
Cfg-->>CC: Profile
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## API Endpoints
|
|
62
|
+
|
|
63
|
+
The config service uses multiple API endpoints to fetch agent configuration data. These endpoints are defined in `constants.ts` and include:
|
|
64
|
+
|
|
65
|
+
- **Core user data**: User profile, agent settings, site information
|
|
66
|
+
- **Team & organization**: Team memberships, organization settings, tenant configuration
|
|
67
|
+
- **Auxiliary codes**: Idle codes and wrap-up codes with pagination
|
|
68
|
+
- **Communication settings**: Dial plans, URL mappings, multimedia profiles
|
|
69
|
+
- **Outbound features**: Queue lists, entry points, address books, outdial ANI entries
|
|
70
|
+
|
|
71
|
+
### Endpoint Definitions
|
|
72
|
+
|
|
73
|
+
All endpoints are relative to the WCC API Gateway base URL. Query parameters like `agentView=true` filter responses to agent-relevant data.
|
|
74
|
+
|
|
75
|
+
**Example Usage:**
|
|
76
|
+
```typescript
|
|
77
|
+
// Fetch user data
|
|
78
|
+
const resource = endPointMap.userByCI('org-123', 'agent-456');
|
|
79
|
+
// Result: "organization/org-123/user/by-ci-user-id/agent-456"
|
|
80
|
+
|
|
81
|
+
// Fetch teams with pagination and filtering
|
|
82
|
+
const resource = endPointMap.listTeams('org-123', 0, 100, ['team-1', 'team-2']);
|
|
83
|
+
// Result: "organization/org-123/v2/team?page=0&pageSize=100&filter=id=in=(team-1,team-2)"
|
|
84
|
+
|
|
85
|
+
// Fetch organization settings
|
|
86
|
+
const resource = endPointMap.orgSettings('org-123');
|
|
87
|
+
// Result: "organization/org-123/v2/organization-setting?agentView=true"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Full Endpoint Map:**
|
|
91
|
+
```typescript
|
|
92
|
+
export const endPointMap = {
|
|
93
|
+
userByCI: (orgId: string, agentId: string) =>
|
|
94
|
+
`organization/${orgId}/user/by-ci-user-id/${agentId}`,
|
|
95
|
+
|
|
96
|
+
desktopProfile: (orgId: string, desktopProfileId: string) =>
|
|
97
|
+
`organization/${orgId}/agent-profile/${desktopProfileId}`,
|
|
98
|
+
|
|
99
|
+
multimediaProfile: (orgId: string, multimediaProfileId: string) =>
|
|
100
|
+
`organization/${orgId}/multimedia-profile/${multimediaProfileId}`,
|
|
101
|
+
|
|
102
|
+
listTeams: (orgId: string, page: number, pageSize: number, filter: string[]) =>
|
|
103
|
+
`organization/${orgId}/v2/team?page=${page}&pageSize=${pageSize}${
|
|
104
|
+
filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''
|
|
105
|
+
}`,
|
|
106
|
+
|
|
107
|
+
listAuxCodes: (orgId: string, page: number, pageSize: number, filter: string[], attributes: string[]) =>
|
|
108
|
+
`organization/${orgId}/v2/auxiliary-code?page=${page}&pageSize=${pageSize}${
|
|
109
|
+
filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''
|
|
110
|
+
}&attributes=${attributes}`,
|
|
111
|
+
|
|
112
|
+
orgInfo: (orgId: string) =>
|
|
113
|
+
`organization/${orgId}`,
|
|
114
|
+
|
|
115
|
+
orgSettings: (orgId: string) =>
|
|
116
|
+
`organization/${orgId}/v2/organization-setting?agentView=true`,
|
|
117
|
+
|
|
118
|
+
siteInfo: (orgId: string, siteId: string) =>
|
|
119
|
+
`organization/${orgId}/site/${siteId}`,
|
|
120
|
+
|
|
121
|
+
tenantData: (orgId: string) =>
|
|
122
|
+
`organization/${orgId}/v2/tenant-configuration?agentView=true`,
|
|
123
|
+
|
|
124
|
+
urlMapping: (orgId: string) =>
|
|
125
|
+
`organization/${orgId}/v2/org-url-mapping?sort=name,ASC`,
|
|
126
|
+
|
|
127
|
+
dialPlan: (orgId: string) =>
|
|
128
|
+
`organization/${orgId}/dial-plan?agentView=true`,
|
|
129
|
+
|
|
130
|
+
queueList: (orgId: string, queryParams: string) =>
|
|
131
|
+
`/organization/${orgId}/v2/contact-service-queue?${queryParams}`,
|
|
132
|
+
|
|
133
|
+
entryPointList: (orgId: string, queryParams: string) =>
|
|
134
|
+
`/organization/${orgId}/v2/entry-point?${queryParams}`,
|
|
135
|
+
|
|
136
|
+
addressBookEntries: (orgId: string, addressBookId: string, queryParams: string) =>
|
|
137
|
+
`/organization/${orgId}/v2/address-book/${addressBookId}/entry?${queryParams}`,
|
|
138
|
+
|
|
139
|
+
outdialAniEntries: (orgId: string, outdialANI: string, queryParams: string) =>
|
|
140
|
+
`organization/${orgId}/v2/outdial-ani/${outdialANI}/entry${
|
|
141
|
+
queryParams ? `?${queryParams}` : ''
|
|
142
|
+
}`,
|
|
143
|
+
};
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Pagination Pattern
|
|
149
|
+
|
|
150
|
+
For endpoints with pagination (teams, aux codes):
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import {DEFAULT_PAGE} from './constants'; // DEFAULT_PAGE = 0
|
|
154
|
+
|
|
155
|
+
public async getAllTeams(orgId, pageSize, filter): Promise<TeamList[]> {
|
|
156
|
+
let allTeams: TeamList[] = [];
|
|
157
|
+
let page = DEFAULT_PAGE;
|
|
158
|
+
|
|
159
|
+
// First request to get totalPages
|
|
160
|
+
const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter);
|
|
161
|
+
allTeams = allTeams.concat(firstResponse.data);
|
|
162
|
+
const totalPages = firstResponse.meta.totalPages;
|
|
163
|
+
|
|
164
|
+
// Parallel requests for remaining pages
|
|
165
|
+
const requests = [];
|
|
166
|
+
for (page = DEFAULT_PAGE + 1; page < totalPages; page += 1) {
|
|
167
|
+
requests.push(this.getListOfTeams(orgId, page, pageSize, filter));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const responses = await Promise.all(requests);
|
|
171
|
+
for (const response of responses) {
|
|
172
|
+
allTeams = allTeams.concat(response.data);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return allTeams;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Profile Parsing
|
|
182
|
+
|
|
183
|
+
`parseAgentConfigs` in Util.ts combines all data into a unified `Profile` object. See [types.ts](../types.ts) for full type definitions.
|
|
184
|
+
|
|
185
|
+
### API Response Structures
|
|
186
|
+
|
|
187
|
+
The service fetches data from multiple APIs with these response structures:
|
|
188
|
+
|
|
189
|
+
| API Method | Response Type | Key Fields | Usage |
|
|
190
|
+
|------------|---------------|------------|-------|
|
|
191
|
+
| `getUserUsingCI` | `AgentResponse` | `ciUserId`, `id`, `firstName`, `lastName`, `email`, `teamIds`, `agentProfileId`, `siteId` | Primary agent identity and profile references |
|
|
192
|
+
| `getDesktopProfileById` | `DesktopProfileResponse` | `dialPlanEnabled`, `autoAnswer`, `accessWrapUpCode`, `wrapUpCodes`, `accessIdleCode`, `idleCodes`, `loginVoiceOptions` | Agent desktop settings and feature enablement |
|
|
193
|
+
| `getAllTeams` | `TeamList[]` | `id`, `name`, `type`, `channelMap` (+ 10 more fields) | Full team details with channel configurations |
|
|
194
|
+
| `getTenantData` | `TenantData` | `outdialEnabled`, `forceDefaultDn`, `privacyShieldVisible`, `timeoutDesktopInactivityEnabled` | Tenant-level feature flags |
|
|
195
|
+
| `getOrgInfo` | `OrgInfo` | `tenantId`, `timezone` | Organization metadata |
|
|
196
|
+
| `getAllAuxCodes` | `AuxCode[]` | `id`, `name`, `workTypeCode`, `active`, `isSystemCode`, `defaultCode` | Auxiliary codes for idle/wrap-up states |
|
|
197
|
+
| `getOrganizationSetting` | `OrgSettings` | `webRtcEnabled`, `maskSensitiveData`, `campaignManagerEnabled` | Organization-level feature flags |
|
|
198
|
+
| `getDialPlanData` | `DialPlanEntity[]` | `id`, `name`, `regularExpression`, `prefix`, `strippedChars` | Dial plan rules for outbound calling |
|
|
199
|
+
| `getURLMapping` | `URLMapping[]` | `name`, `url` | External service URL mappings |
|
|
200
|
+
| `getSiteInfo` | `SiteInfo` | Site-specific configuration | Site details |
|
|
201
|
+
|
|
202
|
+
These responses are parsed and aggregated into a single `Profile` object by the `parseAgentConfigs` function.
|
|
203
|
+
|
|
204
|
+
### Profile Aggregation Function
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
// See full implementation in Util.ts
|
|
208
|
+
function parseAgentConfigs(profileData: {
|
|
209
|
+
userData: AgentResponse; // See types.ts:AgentResponse
|
|
210
|
+
teamData: Team[]; // NOTE: Declared as Team[] (teamId, teamName) but receives TeamList[] (id, name, + 12 more fields) at runtime
|
|
211
|
+
tenantData: TenantData; // See types.ts:TenantData
|
|
212
|
+
orgInfoData: OrgInfo; // See types.ts:OrgInfo
|
|
213
|
+
auxCodes: AuxCode[]; // See types.ts:AuxCode
|
|
214
|
+
orgSettingsData: OrgSettings; // See types.ts:OrgSettings
|
|
215
|
+
agentProfileData: DesktopProfileResponse; // See types.ts:DesktopProfileResponse
|
|
216
|
+
dialPlanData: DialPlanEntity[]; // See types.ts:DialPlanEntity
|
|
217
|
+
urlMapping: URLMapping[]; // See types.ts:URLMapping
|
|
218
|
+
multimediaProfileId: string;
|
|
219
|
+
}): Profile { // See types.ts:Profile
|
|
220
|
+
const { userData, teamData, tenantData, orgInfoData, auxCodes,
|
|
221
|
+
orgSettingsData, agentProfileData, dialPlanData, urlMapping } = profileData;
|
|
222
|
+
|
|
223
|
+
// Aux code filtering via getFilterAuxCodes():
|
|
224
|
+
// - checks auxCode.active
|
|
225
|
+
// - checks specificCodes access level (ALL → no filter, SPECIFIC → include list)
|
|
226
|
+
// - maps to Entity {id, name, isSystem, isDefault}
|
|
227
|
+
const wrapupCodes = getFilterAuxCodes(auxCodes, WRAP_UP_CODE,
|
|
228
|
+
agentProfileData.accessWrapUpCode === 'ALL' ? [] : agentProfileData.wrapUpCodes);
|
|
229
|
+
const idleCodes = getFilterAuxCodes(auxCodes, IDLE_CODE,
|
|
230
|
+
agentProfileData.accessIdleCode === 'ALL' ? [] : agentProfileData.idleCodes);
|
|
231
|
+
|
|
232
|
+
// Hardcoded "Available" state always appended to idle codes
|
|
233
|
+
idleCodes.push({ id: '0', name: 'Available', isSystem: false, isDefault: false });
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
agentId: userData.ciUserId, // NOTE: uses ciUserId for agent identification
|
|
237
|
+
analyserUserId: userData.id, // NOTE: userData.id is used for analytics/reporting
|
|
238
|
+
agentName: `${userData.firstName} ${userData.lastName}`,
|
|
239
|
+
teams: teamData, // NOTE: Raw TeamList[] passed directly without mapping
|
|
240
|
+
idleCodes, // NOTE: Filtered via getFilterAuxCodes() + hardcoded "Available" state
|
|
241
|
+
wrapupCodes, // NOTE: Filtered via getFilterAuxCodes()
|
|
242
|
+
webRtcEnabled: orgSettingsData.webRtcEnabled,
|
|
243
|
+
loginVoiceOptions: agentProfileData.loginVoiceOptions ?? [],
|
|
244
|
+
enterpriseId: orgInfoData.tenantId,
|
|
245
|
+
tenantTimezone: orgInfoData.timezone,
|
|
246
|
+
multimediaProfileId: profileData.multimediaProfileId,
|
|
247
|
+
// ... 30+ more fields — see Util.ts:184-258 for full implementation
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Error Handling
|
|
255
|
+
|
|
256
|
+
Each method follows consistent error handling:
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
public async getUserUsingCI(orgId: string, agentId: string): Promise<AgentResponse> {
|
|
260
|
+
LoggerProxy.info('Fetching user data using CI', {
|
|
261
|
+
module: CONFIG_FILE_NAME,
|
|
262
|
+
method: METHODS.GET_USER_USING_CI,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
try {
|
|
266
|
+
const resource = endPointMap.userByCI(orgId, agentId);
|
|
267
|
+
const response = await this.webexReq.request({
|
|
268
|
+
service: WCC_API_GATEWAY,
|
|
269
|
+
resource,
|
|
270
|
+
method: HTTP_METHODS.GET,
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
if (response.statusCode !== 200) {
|
|
274
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
LoggerProxy.log('getUserUsingCI api success.', {
|
|
278
|
+
module: CONFIG_FILE_NAME,
|
|
279
|
+
method: METHODS.GET_USER_USING_CI,
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
return Promise.resolve(response.body);
|
|
283
|
+
} catch (error) {
|
|
284
|
+
LoggerProxy.error(`getUserUsingCI API call failed with ${error}`, {
|
|
285
|
+
module: CONFIG_FILE_NAME,
|
|
286
|
+
method: METHODS.GET_USER_USING_CI,
|
|
287
|
+
});
|
|
288
|
+
throw error;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Troubleshooting
|
|
296
|
+
|
|
297
|
+
### Common Issues and Log Patterns
|
|
298
|
+
|
|
299
|
+
#### Issue: Profile incomplete or getAgentConfig fails
|
|
300
|
+
|
|
301
|
+
**Cause**: One of the parallel API calls failed (network error, 401/403/404/500 response)
|
|
302
|
+
|
|
303
|
+
**Log patterns to search for:**
|
|
304
|
+
```typescript
|
|
305
|
+
// General config failure
|
|
306
|
+
"getAgentConfig call failed"
|
|
307
|
+
"module": "config/index.ts", "method": "getAgentConfig"
|
|
308
|
+
|
|
309
|
+
// Specific API method failures
|
|
310
|
+
"getUserUsingCI API call failed"
|
|
311
|
+
"getDesktopProfileById API call failed"
|
|
312
|
+
"getAllTeams API call failed"
|
|
313
|
+
"getAllAuxCodes API call failed"
|
|
314
|
+
|
|
315
|
+
// Look for HTTP error codes
|
|
316
|
+
"API call failed with 401" // Authentication
|
|
317
|
+
"API call failed with 403" // Authorization
|
|
318
|
+
"API call failed with 404" // Not found
|
|
319
|
+
"API call failed with 500" // Server error
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Solution**:
|
|
323
|
+
1. Check logs for specific API that failed
|
|
324
|
+
2. Verify orgId and agentId are correct
|
|
325
|
+
3. Ensure authentication tokens are valid
|
|
326
|
+
4. Check network connectivity to WCC API Gateway
|
|
327
|
+
|
|
328
|
+
#### Issue: Empty teams or aux codes
|
|
329
|
+
|
|
330
|
+
**Cause**: Pagination not completing or filter parameters incorrect
|
|
331
|
+
|
|
332
|
+
**Log patterns:**
|
|
333
|
+
```typescript
|
|
334
|
+
"getAllTeams API call failed"
|
|
335
|
+
"getAllAuxCodes API call failed"
|
|
336
|
+
"method": "getListOfTeams"
|
|
337
|
+
"method": "getListOfAuxCodes"
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Solution**:
|
|
341
|
+
1. Check `totalPages` in first response
|
|
342
|
+
2. Verify filter array contains valid team/aux code IDs
|
|
343
|
+
3. Check if pageSize is appropriate (default: 100)
|
|
344
|
+
4. Ensure all pages are fetched in Promise.all()
|
|
345
|
+
|
|
346
|
+
#### Issue: WebRTC or other features not enabled
|
|
347
|
+
|
|
348
|
+
**Cause**: Organization or tenant settings have feature disabled
|
|
349
|
+
|
|
350
|
+
**Log patterns:**
|
|
351
|
+
```typescript
|
|
352
|
+
"getOrganizationSetting api success"
|
|
353
|
+
"getTenantData api success"
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
**Solution**:
|
|
357
|
+
1. Check `orgSettingsData.webRtcEnabled` in response
|
|
358
|
+
2. Check `tenantData.outdialEnabled` for outbound features
|
|
359
|
+
3. Verify feature is enabled in admin portal settings
|
|
360
|
+
4. Confirm agentProfileData has correct feature flags
|
|
361
|
+
|
|
362
|
+
#### Issue: Missing dial plan data
|
|
363
|
+
|
|
364
|
+
**Cause**: `dialPlanEnabled` is false in desktop profile
|
|
365
|
+
|
|
366
|
+
**Solution**:
|
|
367
|
+
1. Check `agentProfileData.dialPlanEnabled` value
|
|
368
|
+
2. Verify dial plans are assigned in agent profile configuration
|
|
369
|
+
3. Note: dial plan fetch only happens if `dialPlanEnabled === true`
|
|
370
|
+
|
|
371
|
+
#### Issue: Incorrect auxiliary code filtering
|
|
372
|
+
|
|
373
|
+
**Cause**: Access level set to 'SPECIFIC' but missing code IDs
|
|
374
|
+
|
|
375
|
+
**Log patterns:**
|
|
376
|
+
```typescript
|
|
377
|
+
"method": "getFilterAuxCodes"
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Solution**:
|
|
381
|
+
1. Check `agentProfileData.accessWrapUpCode` (should be 'ALL' or 'SPECIFIC')
|
|
382
|
+
2. Check `agentProfileData.accessIdleCode`
|
|
383
|
+
3. If 'SPECIFIC', verify `wrapUpCodes` and `idleCodes` arrays contain valid IDs
|
|
384
|
+
4. Ensure aux codes have `active: true` status
|
|
385
|
+
5. Note: "Available" state is always appended to idle codes
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Types and Events
|
|
390
|
+
|
|
391
|
+
The config service defines comprehensive TypeScript types for all data structures. See [types.ts](../types.ts) for complete definitions.
|
|
392
|
+
|
|
393
|
+
### Core Types
|
|
394
|
+
|
|
395
|
+
**Configuration Types:**
|
|
396
|
+
- `Profile` - Unified agent profile after aggregation
|
|
397
|
+
- `AgentResponse` - User data from userByCI endpoint
|
|
398
|
+
- `DesktopProfileResponse` - Agent desktop settings
|
|
399
|
+
- `TeamList` - Team data with full details (id, name, type, channelMap, etc.)
|
|
400
|
+
- `Team` - Simplified team reference (teamId, teamName, desktopLayoutId)
|
|
401
|
+
- `AuxCode` - Auxiliary code definition
|
|
402
|
+
- `Entity` - Filtered code entity (used for idle/wrapup codes in Profile)
|
|
403
|
+
|
|
404
|
+
**Organization Types:**
|
|
405
|
+
- `OrgInfo` - Organization metadata
|
|
406
|
+
- `OrgSettings` - Organization-level feature flags
|
|
407
|
+
- `TenantData` - Tenant configuration and feature enablement
|
|
408
|
+
- `SiteInfo` - Site-specific configuration
|
|
409
|
+
|
|
410
|
+
**Communication Types:**
|
|
411
|
+
- `DialPlanEntity` - Dial plan rule definition
|
|
412
|
+
- `URLMapping` - External service URL mapping
|
|
413
|
+
- `MultimediaProfile` - Multimedia profile configuration
|
|
414
|
+
|
|
415
|
+
**Note:** The config service itself does not emit events. For agent and task events, see the Agent and Task services. Event constants are defined in [types.ts](../types.ts) under `CC_AGENT_EVENTS` and `CC_TASK_EVENTS`.
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Related Files
|
|
420
|
+
|
|
421
|
+
- [index.ts](../index.ts) - Service implementation with all API methods
|
|
422
|
+
- [types.ts](../types.ts) - Complete type definitions and event constants
|
|
423
|
+
- [Util.ts](../Util.ts) - Profile parsing utilities (parseAgentConfigs, getFilterAuxCodes, etc.)
|
|
424
|
+
- [constants.ts](../constants.ts) - API endpoints, default values, and method names
|
|
@@ -166,7 +166,7 @@ export const endPointMap = {
|
|
|
166
166
|
) =>
|
|
167
167
|
`organization/${orgId}/v2/auxiliary-code?page=${page}&pageSize=${pageSize}${
|
|
168
168
|
filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''
|
|
169
|
-
}&attributes=${attributes}`,
|
|
169
|
+
}&attributes=${attributes}&desktopProfileFilter=true`,
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Gets the endpoint for organization info.
|
|
@@ -298,4 +298,28 @@ export const endPointMap = {
|
|
|
298
298
|
`organization/${orgId}/v2/outdial-ani/${outdialANI}/entry${
|
|
299
299
|
queryParams ? `?${queryParams}` : ''
|
|
300
300
|
}`,
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Gets the endpoint for user preference by user ID.
|
|
304
|
+
* @param orgId - Organization ID.
|
|
305
|
+
* @param userId - User ID.
|
|
306
|
+
* @returns The endpoint URL string.
|
|
307
|
+
* @public
|
|
308
|
+
* @example
|
|
309
|
+
* const url = endPointMap.userPreference('org123', 'user456');
|
|
310
|
+
* @ignore
|
|
311
|
+
*/
|
|
312
|
+
userPreference: (orgId: string, userId: string) =>
|
|
313
|
+
`organization/${orgId}/user-preference/${userId}`,
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Gets the endpoint for creating user preference.
|
|
317
|
+
* @param orgId - Organization ID.
|
|
318
|
+
* @returns The endpoint URL string.
|
|
319
|
+
* @public
|
|
320
|
+
* @example
|
|
321
|
+
* const url = endPointMap.userPreferenceCreate('org123');
|
|
322
|
+
* @ignore
|
|
323
|
+
*/
|
|
324
|
+
userPreferenceCreate: (orgId: string) => `organization/${orgId}/user-preference`,
|
|
301
325
|
};
|