@webex/contact-center 3.9.0 → 3.10.0-multi-llms.1
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 +207 -47
- package/dist/cc.js.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/index.js +9 -0
- 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 +89 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +32 -2
- 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 +36 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +29 -21
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +33 -1
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/GlobalTypes.js.map +1 -1
- package/dist/services/core/Utils.js +181 -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/constants.js +17 -1
- package/dist/services/core/constants.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 +151 -7
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +104 -0
- package/dist/services/task/TaskUtils.js.map +1 -0
- package/dist/services/task/constants.js +26 -1
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/contact.js +86 -0
- package/dist/services/task/contact.js.map +1 -1
- package/dist/services/task/index.js +428 -91
- package/dist/services/task/index.js.map +1 -1
- package/dist/services/task/types.js +12 -0
- package/dist/services/task/types.js.map +1 -1
- package/dist/types/cc.d.ts +121 -35
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +4 -3
- package/dist/types/metrics/constants.d.ts +25 -1
- 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 +35 -1
- package/dist/types/services/config/index.d.ts +6 -9
- package/dist/types/services/config/types.d.ts +79 -58
- package/dist/types/services/core/GlobalTypes.d.ts +25 -0
- package/dist/types/services/core/Utils.d.ts +55 -1
- package/dist/types/services/core/constants.d.ts +14 -0
- package/dist/types/services/task/TaskUtils.d.ts +42 -0
- package/dist/types/services/task/constants.d.ts +23 -0
- package/dist/types/services/task/contact.d.ts +10 -0
- package/dist/types/services/task/index.d.ts +85 -4
- package/dist/types/services/task/types.d.ts +245 -21
- 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 -9
- package/src/cc.ts +232 -52
- package/src/constants.ts +1 -0
- package/src/index.ts +17 -2
- package/src/logger-proxy.ts +24 -1
- package/src/metrics/MetricsManager.ts +1 -1
- package/src/metrics/behavioral-events.ts +94 -0
- package/src/metrics/constants.ts +37 -1
- 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 +42 -2
- package/src/services/config/index.ts +30 -30
- package/src/services/config/types.ts +59 -58
- package/src/services/core/GlobalTypes.ts +27 -0
- package/src/services/core/Utils.ts +215 -1
- package/src/services/core/aqm-reqs.ts +0 -5
- package/src/services/core/constants.ts +16 -0
- package/src/services/core/websocket/WebSocketManager.ts +0 -4
- package/src/services/task/TaskManager.ts +182 -9
- package/src/services/task/TaskUtils.ts +113 -0
- package/src/services/task/constants.ts +25 -0
- package/src/services/task/contact.ts +80 -0
- package/src/services/task/index.ts +497 -71
- package/src/services/task/types.ts +264 -20
- package/src/types.ts +180 -0
- package/src/utils/PageCache.ts +252 -0
- package/test/unit/spec/cc.ts +282 -85
- package/test/unit/spec/metrics/MetricsManager.ts +0 -1
- package/test/unit/spec/metrics/behavioral-events.ts +42 -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 +279 -65
- package/test/unit/spec/services/core/Utils.ts +282 -1
- 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 +760 -2
- package/test/unit/spec/services/task/TaskUtils.ts +131 -0
- package/test/unit/spec/services/task/contact.ts +31 -1
- package/test/unit/spec/services/task/index.ts +873 -163
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
package/src/cc.ts
CHANGED
|
@@ -38,19 +38,20 @@ import {
|
|
|
38
38
|
MERCURY_DISCONNECTED_SUCCESS,
|
|
39
39
|
METHODS,
|
|
40
40
|
} from './constants';
|
|
41
|
+
import {AGENT_STATE_AVAILABLE, AGENT_STATE_AVAILABLE_ID} from './services/config/constants';
|
|
41
42
|
import {AGENT, WEB_RTC_PREFIX} from './services/constants';
|
|
42
43
|
import Services from './services';
|
|
43
44
|
import WebexRequest from './services/core/WebexRequest';
|
|
44
45
|
import LoggerProxy from './logger-proxy';
|
|
45
46
|
import {StateChange, Logout, StateChangeSuccess, AGENT_EVENTS} from './services/agent/types';
|
|
46
47
|
import {getErrorDetails, isValidDialNumber} from './services/core/Utils';
|
|
47
|
-
import {Profile, WelcomeEvent, CC_EVENTS, ContactServiceQueue} from './services/config/types';
|
|
48
48
|
import {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
Profile,
|
|
50
|
+
WelcomeEvent,
|
|
51
|
+
CC_EVENTS,
|
|
52
|
+
OutdialAniEntriesResponse,
|
|
53
|
+
OutdialAniParams,
|
|
54
|
+
} from './services/config/types';
|
|
54
55
|
import {ConnectionLostDetails} from './services/core/websocket/types';
|
|
55
56
|
import TaskManager from './services/task/TaskManager';
|
|
56
57
|
import WebCallingService from './services/WebCallingService';
|
|
@@ -58,6 +59,15 @@ import {ITask, TASK_EVENTS, TaskResponse, DialerPayload} from './services/task/t
|
|
|
58
59
|
import MetricsManager from './metrics/MetricsManager';
|
|
59
60
|
import {METRIC_EVENT_NAMES} from './metrics/constants';
|
|
60
61
|
import {Failure} from './services/core/GlobalTypes';
|
|
62
|
+
import EntryPoint from './services/EntryPoint';
|
|
63
|
+
import AddressBook from './services/AddressBook';
|
|
64
|
+
import Queue from './services/Queue';
|
|
65
|
+
import type {
|
|
66
|
+
EntryPointListResponse,
|
|
67
|
+
EntryPointSearchParams,
|
|
68
|
+
ContactServiceQueuesResponse,
|
|
69
|
+
ContactServiceQueueSearchParams,
|
|
70
|
+
} from './types';
|
|
61
71
|
|
|
62
72
|
/**
|
|
63
73
|
* The main Contact Center plugin class that enables integration with Webex Contact Center.
|
|
@@ -163,6 +173,7 @@ import {Failure} from './services/core/GlobalTypes';
|
|
|
163
173
|
*
|
|
164
174
|
* @public
|
|
165
175
|
*/
|
|
176
|
+
|
|
166
177
|
export default class ContactCenter extends WebexPlugin implements IContactCenter {
|
|
167
178
|
/**
|
|
168
179
|
* The plugin's unique namespace identifier in the Webex SDK.
|
|
@@ -243,6 +254,71 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
243
254
|
*/
|
|
244
255
|
private metricsManager: MetricsManager;
|
|
245
256
|
|
|
257
|
+
/**
|
|
258
|
+
* API instance for managing Webex Contact Center entry points
|
|
259
|
+
* Provides functionality to fetch entry points with caching support
|
|
260
|
+
* @type {EntryPoint}
|
|
261
|
+
* @public
|
|
262
|
+
* @example
|
|
263
|
+
* ```typescript
|
|
264
|
+
* const cc = webex.cc;
|
|
265
|
+
* await cc.register();
|
|
266
|
+
* await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
|
|
267
|
+
*
|
|
268
|
+
* // Access EntryPointRecord
|
|
269
|
+
* const response = await cc.entryPoint.getEntryPoints({
|
|
270
|
+
* page: 0,
|
|
271
|
+
* pageSize: 50
|
|
272
|
+
* });
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
private entryPoint: EntryPoint;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* API instance for managing Webex Contact Center address book contacts
|
|
279
|
+
* Provides functionality to fetch address book entries with caching support
|
|
280
|
+
* @type {AddressBook}
|
|
281
|
+
* @public
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const cc = webex.cc;
|
|
285
|
+
* await cc.register();
|
|
286
|
+
* await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
|
|
287
|
+
*
|
|
288
|
+
* // Access AddressBook API
|
|
289
|
+
* const response = await cc.addressBook.getEntries({
|
|
290
|
+
* page: 0,
|
|
291
|
+
* pageSize: 25
|
|
292
|
+
* });
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
public addressBook: AddressBook;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* API instance for managing Webex Contact Center queues
|
|
299
|
+
* Provides functionality to fetch queues with caching support
|
|
300
|
+
* @type {Queue}
|
|
301
|
+
* @public
|
|
302
|
+
* @example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* const cc = webex.cc;
|
|
305
|
+
* await cc.register();
|
|
306
|
+
* await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
|
|
307
|
+
*
|
|
308
|
+
* // Access Queue API
|
|
309
|
+
* const response = await cc.queue.getQueues({
|
|
310
|
+
* page: 0,
|
|
311
|
+
* pageSize: 50
|
|
312
|
+
* });
|
|
313
|
+
*
|
|
314
|
+
* // Filter queues by specific criteria
|
|
315
|
+
* const filteredQueues = await cc.queue.getQueues({
|
|
316
|
+
* filter: 'id=="queue-id-123"'
|
|
317
|
+
* });
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
private queue: Queue;
|
|
321
|
+
|
|
246
322
|
/**
|
|
247
323
|
* Logger utility for Contact Center plugin
|
|
248
324
|
* Provides consistent logging across the plugin
|
|
@@ -289,6 +365,13 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
289
365
|
);
|
|
290
366
|
this.incomingTaskListener();
|
|
291
367
|
|
|
368
|
+
// Initialize API instances
|
|
369
|
+
// will have future function for indivdual fetch etc so better be in an object
|
|
370
|
+
this.entryPoint = new EntryPoint(this.$webex);
|
|
371
|
+
this.addressBook = new AddressBook(this.$webex, () => this.agentConfig?.addressBookId);
|
|
372
|
+
this.queue = new Queue(this.$webex);
|
|
373
|
+
|
|
374
|
+
// Initialize logger
|
|
292
375
|
LoggerProxy.initialize(this.$webex.logger);
|
|
293
376
|
});
|
|
294
377
|
}
|
|
@@ -313,6 +396,16 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
313
396
|
this.trigger(TASK_EVENTS.TASK_HYDRATE, task);
|
|
314
397
|
};
|
|
315
398
|
|
|
399
|
+
/**
|
|
400
|
+
* Handles task merged events when tasks are combined eg: EPDN merge/transfer
|
|
401
|
+
* @private
|
|
402
|
+
* @param {ITask} task The task object that has been merged
|
|
403
|
+
*/
|
|
404
|
+
private handleTaskMerged = (task: ITask) => {
|
|
405
|
+
// @ts-ignore
|
|
406
|
+
this.trigger(TASK_EVENTS.TASK_MERGED, task);
|
|
407
|
+
};
|
|
408
|
+
|
|
316
409
|
/**
|
|
317
410
|
* Sets up event listeners for incoming tasks and task hydration
|
|
318
411
|
* Subscribes to task events from the task manager
|
|
@@ -321,6 +414,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
321
414
|
private incomingTaskListener() {
|
|
322
415
|
this.taskManager.on(TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
|
|
323
416
|
this.taskManager.on(TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
|
|
417
|
+
this.taskManager.on(TASK_EVENTS.TASK_MERGED, this.handleTaskMerged);
|
|
324
418
|
}
|
|
325
419
|
|
|
326
420
|
/**
|
|
@@ -614,6 +708,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
614
708
|
});
|
|
615
709
|
// TODO: Make profile a singleton to make it available throughout app/sdk so we dont need to inject info everywhere
|
|
616
710
|
this.taskManager.setWrapupData(this.agentConfig.wrapUpData);
|
|
711
|
+
this.taskManager.setAgentId(this.agentConfig.agentId);
|
|
617
712
|
|
|
618
713
|
if (
|
|
619
714
|
this.agentConfig.webRtcEnabled &&
|
|
@@ -700,7 +795,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
700
795
|
throw error;
|
|
701
796
|
}
|
|
702
797
|
|
|
703
|
-
const loginResponse = this.services.agent.stationLogin({
|
|
798
|
+
const loginResponse = await this.services.agent.stationLogin({
|
|
704
799
|
data: {
|
|
705
800
|
dialNumber:
|
|
706
801
|
data.loginOption === LoginOption.BROWSER ? this.agentConfig.agentId : data.dialNumber,
|
|
@@ -984,6 +1079,20 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
984
1079
|
method: METHODS.HANDLE_WEBSOCKET_MESSAGE,
|
|
985
1080
|
});
|
|
986
1081
|
|
|
1082
|
+
// Emit metrics for all websocket events except keepalive and welcome
|
|
1083
|
+
const topLevelType = eventData.type;
|
|
1084
|
+
const nestedType = eventData?.data?.type;
|
|
1085
|
+
if (topLevelType !== CC_EVENTS.WELCOME && eventData.keepalive !== 'true') {
|
|
1086
|
+
const metricsPayload: Record<string, any> = {
|
|
1087
|
+
ws_event_type: nestedType || topLevelType,
|
|
1088
|
+
top_level_type: topLevelType,
|
|
1089
|
+
has_data: Boolean(eventData.data),
|
|
1090
|
+
};
|
|
1091
|
+
this.metricsManager.trackEvent(METRIC_EVENT_NAMES.WEBSOCKET_EVENT_RECEIVED, metricsPayload, [
|
|
1092
|
+
'operational',
|
|
1093
|
+
]);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
987
1096
|
switch (eventData.type) {
|
|
988
1097
|
case CC_EVENTS.AGENT_MULTI_LOGIN:
|
|
989
1098
|
// @ts-ignore
|
|
@@ -1238,6 +1347,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1238
1347
|
* Makes an outbound call to a specified phone number.
|
|
1239
1348
|
*
|
|
1240
1349
|
* @param {string} destination - The phone number to dial (e.g., '+1234567890').
|
|
1350
|
+
* @param {string} origin - The contact center number that will be used while making a call to the customer.
|
|
1241
1351
|
* Should include country code and be in E.164 format.
|
|
1242
1352
|
* @returns {Promise<TaskResponse>} Resolves with the task response containing:
|
|
1243
1353
|
* - interactionId: Unique identifier for the outbound call
|
|
@@ -1273,7 +1383,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1273
1383
|
*
|
|
1274
1384
|
* // Start the outbound call
|
|
1275
1385
|
* const destination = '+1234567890';
|
|
1276
|
-
* const task = await cc.startOutdial(destination);
|
|
1386
|
+
* const task = await cc.startOutdial(destination, origin);
|
|
1277
1387
|
*
|
|
1278
1388
|
* // Listen for all relevant task events
|
|
1279
1389
|
* task.on('task:ringing', () => {
|
|
@@ -1341,7 +1451,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1341
1451
|
* }
|
|
1342
1452
|
* ```
|
|
1343
1453
|
*/
|
|
1344
|
-
public async startOutdial(destination: string): Promise<TaskResponse> {
|
|
1454
|
+
public async startOutdial(destination: string, origin: string): Promise<TaskResponse> {
|
|
1345
1455
|
LoggerProxy.info('Starting outbound dial', {
|
|
1346
1456
|
module: CC_FILE,
|
|
1347
1457
|
method: METHODS.START_OUTDIAL,
|
|
@@ -1355,6 +1465,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1355
1465
|
// Construct the outdial payload.
|
|
1356
1466
|
const outDialPayload: DialerPayload = {
|
|
1357
1467
|
destination,
|
|
1468
|
+
origin,
|
|
1358
1469
|
entryPointId: this.agentConfig.outDialEp,
|
|
1359
1470
|
direction: OUTDIAL_DIRECTION,
|
|
1360
1471
|
attributes: ATTRIBUTES,
|
|
@@ -1369,6 +1480,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1369
1480
|
{
|
|
1370
1481
|
...MetricsManager.getCommonTrackingFieldForAQMResponse(result),
|
|
1371
1482
|
destination,
|
|
1483
|
+
origin,
|
|
1372
1484
|
mediaType: OUTDIAL_MEDIA_TYPE,
|
|
1373
1485
|
},
|
|
1374
1486
|
['behavioral', 'business', 'operational']
|
|
@@ -1389,6 +1501,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1389
1501
|
{
|
|
1390
1502
|
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1391
1503
|
destination,
|
|
1504
|
+
origin,
|
|
1392
1505
|
mediaType: OUTDIAL_MEDIA_TYPE,
|
|
1393
1506
|
},
|
|
1394
1507
|
['behavioral', 'business', 'operational']
|
|
@@ -1399,55 +1512,55 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1399
1512
|
}
|
|
1400
1513
|
|
|
1401
1514
|
/**
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1408
|
-
* @
|
|
1515
|
+
* Fetches outdial ANI (Automatic Number Identification) entries for an outdial ANI ID.
|
|
1516
|
+
*
|
|
1517
|
+
* This method retrieves the list of phone numbers that can be used as caller ID when making
|
|
1518
|
+
* outbound calls. The ANI data is associated with an outdial ANI ID and can be filtered
|
|
1519
|
+
* and paginated as needed.
|
|
1520
|
+
*
|
|
1521
|
+
* @param {string} outdialANI - The outdial ANI ID to fetch ANI data for
|
|
1522
|
+
* @param {number} [page] - Optional page number for pagination (0-based)
|
|
1523
|
+
* @param {number} [pageSize] - Optional number of items per page
|
|
1524
|
+
* @param {string} [search] - Optional search term to filter results by name or number
|
|
1525
|
+
* @param {string} [filter] - Optional filter string
|
|
1526
|
+
* @param {string} [attributes] - Optional attributes to include in response
|
|
1527
|
+
* @returns {Promise<OutdialAniEntriesResponse>} Promise resolving to outdial ANI response containing:
|
|
1528
|
+
* - data: Array of ANI entries with number and name
|
|
1529
|
+
* - meta: Pagination metadata
|
|
1530
|
+
* @throws {Error} If the operation fails or agent is not registered
|
|
1409
1531
|
* @public
|
|
1410
1532
|
* @example
|
|
1411
1533
|
* ```typescript
|
|
1412
1534
|
* const cc = webex.cc;
|
|
1413
1535
|
* await cc.register();
|
|
1414
|
-
* await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
|
|
1415
1536
|
*
|
|
1416
|
-
* //
|
|
1417
|
-
* const
|
|
1537
|
+
* // Get agent profile to obtain outdial ANI ID
|
|
1538
|
+
* const agentProfile = cc.agentConfig;
|
|
1539
|
+
* const outdialANI = agentProfile.outdialANIId;
|
|
1418
1540
|
*
|
|
1419
|
-
* //
|
|
1420
|
-
* const
|
|
1541
|
+
* // Basic usage - get all ANI data for an outdial ANI ID
|
|
1542
|
+
* const aniData = await cc.getOutdialAniEntries({ outdialANI });
|
|
1421
1543
|
*
|
|
1422
|
-
* //
|
|
1423
|
-
* const
|
|
1424
|
-
*
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1427
|
-
*
|
|
1428
|
-
* );
|
|
1544
|
+
* // With pagination and search
|
|
1545
|
+
* const paginatedAni = await cc.getOutdialAniEntries({
|
|
1546
|
+
* outdialANI,
|
|
1547
|
+
* page: 0,
|
|
1548
|
+
* pageSize: 50,
|
|
1549
|
+
* search: '555' // search for numbers containing '555'
|
|
1550
|
+
* });
|
|
1429
1551
|
*
|
|
1430
|
-
* // Process
|
|
1431
|
-
*
|
|
1432
|
-
* console.log(
|
|
1433
|
-
* id: queue.queueId,
|
|
1434
|
-
* name: queue.queueName,
|
|
1435
|
-
* channelType: queue.channelType,
|
|
1436
|
-
* isActive: queue.isActive,
|
|
1437
|
-
* description: queue.description
|
|
1438
|
-
* });
|
|
1552
|
+
* // Process the results
|
|
1553
|
+
* paginatedAni.forEach(ani => {
|
|
1554
|
+
* console.log(`ANI: ${ani.number} - ${ani.name}`);
|
|
1439
1555
|
* });
|
|
1440
1556
|
* ```
|
|
1441
1557
|
*/
|
|
1442
|
-
public async
|
|
1443
|
-
search
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
pageSize = DEFAULT_PAGE_SIZE
|
|
1447
|
-
): Promise<ContactServiceQueue[]> {
|
|
1448
|
-
LoggerProxy.info('Fetching queues', {
|
|
1558
|
+
public async getOutdialAniEntries(params: OutdialAniParams): Promise<OutdialAniEntriesResponse> {
|
|
1559
|
+
const {outdialANI, page, pageSize, search, filter, attributes} = params;
|
|
1560
|
+
|
|
1561
|
+
LoggerProxy.info('Fetching outdial ANI entries', {
|
|
1449
1562
|
module: CC_FILE,
|
|
1450
|
-
method: METHODS.
|
|
1563
|
+
method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
|
|
1451
1564
|
});
|
|
1452
1565
|
|
|
1453
1566
|
const orgId = this.$webex.credentials.getOrgId();
|
|
@@ -1455,20 +1568,65 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1455
1568
|
if (!orgId) {
|
|
1456
1569
|
LoggerProxy.error('Org ID not found.', {
|
|
1457
1570
|
module: CC_FILE,
|
|
1458
|
-
method: METHODS.
|
|
1571
|
+
method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
|
|
1459
1572
|
});
|
|
1460
1573
|
|
|
1461
1574
|
throw new Error('Org ID not found.');
|
|
1462
1575
|
}
|
|
1463
1576
|
|
|
1464
|
-
|
|
1577
|
+
try {
|
|
1578
|
+
const result = await this.services.config.getOutdialAniEntries(orgId, {
|
|
1579
|
+
outdialANI,
|
|
1580
|
+
page,
|
|
1581
|
+
pageSize,
|
|
1582
|
+
search,
|
|
1583
|
+
filter,
|
|
1584
|
+
attributes,
|
|
1585
|
+
});
|
|
1465
1586
|
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1587
|
+
this.metricsManager.trackEvent(
|
|
1588
|
+
METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_SUCCESS,
|
|
1589
|
+
{
|
|
1590
|
+
outdialANI,
|
|
1591
|
+
resultCount: result?.length || 0,
|
|
1592
|
+
},
|
|
1593
|
+
['behavioral', 'business', 'operational']
|
|
1594
|
+
);
|
|
1595
|
+
|
|
1596
|
+
LoggerProxy.log(`Successfully retrieved outdial ANI entries for ANI ID ${outdialANI}`, {
|
|
1597
|
+
module: CC_FILE,
|
|
1598
|
+
method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
|
|
1599
|
+
});
|
|
1470
1600
|
|
|
1471
|
-
|
|
1601
|
+
return result;
|
|
1602
|
+
} catch (error) {
|
|
1603
|
+
const failure = error.details as Failure;
|
|
1604
|
+
this.metricsManager.trackEvent(
|
|
1605
|
+
METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_FAILED,
|
|
1606
|
+
{
|
|
1607
|
+
...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1608
|
+
outdialANI,
|
|
1609
|
+
error,
|
|
1610
|
+
},
|
|
1611
|
+
['behavioral', 'business', 'operational']
|
|
1612
|
+
);
|
|
1613
|
+
|
|
1614
|
+
LoggerProxy.error(
|
|
1615
|
+
`Failed to fetch outdial ANI entries for ANI ID ${outdialANI} due to: ${error}`,
|
|
1616
|
+
{
|
|
1617
|
+
module: CC_FILE,
|
|
1618
|
+
method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
|
|
1619
|
+
trackingId: failure.trackingId,
|
|
1620
|
+
}
|
|
1621
|
+
);
|
|
1622
|
+
|
|
1623
|
+
const {error: detailedError} = getErrorDetails(
|
|
1624
|
+
error,
|
|
1625
|
+
METHODS.GET_OUTDIAL_ANI_ENTRIES,
|
|
1626
|
+
CC_FILE
|
|
1627
|
+
);
|
|
1628
|
+
throw detailedError;
|
|
1629
|
+
}
|
|
1472
1630
|
}
|
|
1473
1631
|
|
|
1474
1632
|
/**
|
|
@@ -1615,4 +1773,26 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
|
|
|
1615
1773
|
throw error;
|
|
1616
1774
|
}
|
|
1617
1775
|
}
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* Returns paginated entry points for the organization.
|
|
1779
|
+
* Thin wrapper around internal EntryPoint instance.
|
|
1780
|
+
* @public
|
|
1781
|
+
*/
|
|
1782
|
+
public async getEntryPoints(
|
|
1783
|
+
params: EntryPointSearchParams = {}
|
|
1784
|
+
): Promise<EntryPointListResponse> {
|
|
1785
|
+
return this.entryPoint.getEntryPoints(params);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns paginated contact service queues for the organization.
|
|
1790
|
+
* Thin wrapper around internal Queue instance.
|
|
1791
|
+
* @public
|
|
1792
|
+
*/
|
|
1793
|
+
public async getQueues(
|
|
1794
|
+
params: ContactServiceQueueSearchParams = {}
|
|
1795
|
+
): Promise<ContactServiceQueuesResponse> {
|
|
1796
|
+
return this.queue.getQueues(params);
|
|
1797
|
+
}
|
|
1618
1798
|
}
|
package/src/constants.ts
CHANGED
|
@@ -42,6 +42,7 @@ export const METHODS = {
|
|
|
42
42
|
HANDLE_DEVICE_TYPE: 'handleDeviceType',
|
|
43
43
|
START_OUTDIAL: 'startOutdial',
|
|
44
44
|
GET_QUEUES: 'getQueues',
|
|
45
|
+
GET_OUTDIAL_ANI_ENTRIES: 'getOutdialAniEntries',
|
|
45
46
|
UPLOAD_LOGS: 'uploadLogs',
|
|
46
47
|
UPDATE_AGENT_PROFILE: 'updateAgentProfile',
|
|
47
48
|
GET_DEVICE_ID: 'getDeviceId',
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,22 @@ export {default as Task} from './services/task';
|
|
|
26
26
|
*/
|
|
27
27
|
export {default as routingAgent} from './services/agent';
|
|
28
28
|
|
|
29
|
+
// API exports (AddressBook is public, EntryPoint and Queue are accessed via cc wrappers)
|
|
30
|
+
export {default as AddressBook} from './services/AddressBook';
|
|
31
|
+
|
|
32
|
+
/** EntryPoint API types */
|
|
33
|
+
export type {
|
|
34
|
+
EntryPointRecord,
|
|
35
|
+
EntryPointListResponse,
|
|
36
|
+
EntryPointSearchParams,
|
|
37
|
+
AddressBookEntry,
|
|
38
|
+
AddressBookEntriesResponse,
|
|
39
|
+
AddressBookEntrySearchParams,
|
|
40
|
+
ContactServiceQueuesResponse,
|
|
41
|
+
ContactServiceQueueSearchParams,
|
|
42
|
+
ContactServiceQueue,
|
|
43
|
+
} from './types';
|
|
44
|
+
|
|
29
45
|
// Enums
|
|
30
46
|
/**
|
|
31
47
|
* Task Events for Contact Center operations
|
|
@@ -110,6 +126,7 @@ export type {
|
|
|
110
126
|
AgentContact,
|
|
111
127
|
/** Task interface */
|
|
112
128
|
ITask,
|
|
129
|
+
Interaction,
|
|
113
130
|
TaskData,
|
|
114
131
|
/** Task response */
|
|
115
132
|
TaskResponse,
|
|
@@ -157,8 +174,6 @@ export type {
|
|
|
157
174
|
export type {
|
|
158
175
|
/** Profile interface */
|
|
159
176
|
Profile,
|
|
160
|
-
/** Contact service queue interface */
|
|
161
|
-
ContactServiceQueue,
|
|
162
177
|
/** Response type from getUserUsingCI method */
|
|
163
178
|
AgentResponse,
|
|
164
179
|
/** Response from getDesktopProfileById */
|
package/src/logger-proxy.ts
CHANGED
|
@@ -105,6 +105,29 @@ export default class LoggerProxy {
|
|
|
105
105
|
const interactionId = context.interactionId ? ` - interactionId:${context.interactionId}` : '';
|
|
106
106
|
const trackingId = context.trackingId ? ` - trackingId:${context.trackingId}` : '';
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
// Format additional data if provided
|
|
109
|
+
let dataString = '';
|
|
110
|
+
if (context.data) {
|
|
111
|
+
try {
|
|
112
|
+
dataString = ` - data:${JSON.stringify(context.data)}`;
|
|
113
|
+
} catch (e) {
|
|
114
|
+
dataString = ` - data:[object]`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Format error if provided
|
|
119
|
+
let errorString = '';
|
|
120
|
+
if (context.error) {
|
|
121
|
+
if (context.error instanceof Error) {
|
|
122
|
+
errorString = ` - error:${context.error.name}:${context.error.message}`;
|
|
123
|
+
if (context.error.stack && level === LOGGING_LEVEL.error) {
|
|
124
|
+
errorString += ` - stack:${context.error.stack}`;
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
errorString = ` - error:${String(context.error)}`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return `${timestamp} ${LOG_PREFIX} - [${level}]: module:${moduleName} - method:${methodName}${interactionId}${trackingId}${dataString}${errorString} - ${message}`;
|
|
109
132
|
}
|
|
110
133
|
}
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from '@webex/internal-plugin-metrics/src/metrics.types';
|
|
7
7
|
|
|
8
8
|
import {WebexSDK} from '../types';
|
|
9
|
-
import {BehavioralEventTaxonomy, getEventTaxonomy} from './behavioral-events';
|
|
10
9
|
import LoggerProxy from '../logger-proxy';
|
|
10
|
+
import {BehavioralEventTaxonomy, getEventTaxonomy} from './behavioral-events';
|
|
11
11
|
import {METRIC_EVENT_NAMES} from './constants';
|
|
12
12
|
import {Failure} from '../services/core/GlobalTypes';
|
|
13
13
|
import {PRODUCT_NAME} from '../constants';
|
|
@@ -302,6 +302,44 @@ const eventTaxonomyMap: Record<string, BehavioralEventTaxonomy> = {
|
|
|
302
302
|
verb: 'fail',
|
|
303
303
|
},
|
|
304
304
|
|
|
305
|
+
// Conference Tasks
|
|
306
|
+
[METRIC_EVENT_NAMES.TASK_CONFERENCE_START_SUCCESS]: {
|
|
307
|
+
product,
|
|
308
|
+
agent: 'user',
|
|
309
|
+
target: 'task_conference_start',
|
|
310
|
+
verb: 'complete',
|
|
311
|
+
},
|
|
312
|
+
[METRIC_EVENT_NAMES.TASK_CONFERENCE_START_FAILED]: {
|
|
313
|
+
product,
|
|
314
|
+
agent: 'user',
|
|
315
|
+
target: 'task_conference_start',
|
|
316
|
+
verb: 'fail',
|
|
317
|
+
},
|
|
318
|
+
[METRIC_EVENT_NAMES.TASK_CONFERENCE_END_SUCCESS]: {
|
|
319
|
+
product,
|
|
320
|
+
agent: 'user',
|
|
321
|
+
target: 'task_conference_end',
|
|
322
|
+
verb: 'complete',
|
|
323
|
+
},
|
|
324
|
+
[METRIC_EVENT_NAMES.TASK_CONFERENCE_END_FAILED]: {
|
|
325
|
+
product,
|
|
326
|
+
agent: 'user',
|
|
327
|
+
target: 'task_conference_end',
|
|
328
|
+
verb: 'fail',
|
|
329
|
+
},
|
|
330
|
+
[METRIC_EVENT_NAMES.TASK_CONFERENCE_TRANSFER_SUCCESS]: {
|
|
331
|
+
product,
|
|
332
|
+
agent: 'user',
|
|
333
|
+
target: 'task_conference_transfer',
|
|
334
|
+
verb: 'complete',
|
|
335
|
+
},
|
|
336
|
+
[METRIC_EVENT_NAMES.TASK_CONFERENCE_TRANSFER_FAILED]: {
|
|
337
|
+
product,
|
|
338
|
+
agent: 'user',
|
|
339
|
+
target: 'task_conference_transfer',
|
|
340
|
+
verb: 'fail',
|
|
341
|
+
},
|
|
342
|
+
|
|
305
343
|
// upload logs
|
|
306
344
|
[METRIC_EVENT_NAMES.UPLOAD_LOGS_SUCCESS]: {
|
|
307
345
|
product,
|
|
@@ -329,6 +367,62 @@ const eventTaxonomyMap: Record<string, BehavioralEventTaxonomy> = {
|
|
|
329
367
|
target: 'agent_device_type_update',
|
|
330
368
|
verb: 'fail',
|
|
331
369
|
},
|
|
370
|
+
|
|
371
|
+
// EntryPoint API Events
|
|
372
|
+
[METRIC_EVENT_NAMES.ENTRYPOINT_FETCH_SUCCESS]: {
|
|
373
|
+
product,
|
|
374
|
+
agent: 'user',
|
|
375
|
+
target: 'entrypoint_fetch',
|
|
376
|
+
verb: 'complete',
|
|
377
|
+
},
|
|
378
|
+
[METRIC_EVENT_NAMES.ENTRYPOINT_FETCH_FAILED]: {
|
|
379
|
+
product,
|
|
380
|
+
agent: 'user',
|
|
381
|
+
target: 'entrypoint_fetch',
|
|
382
|
+
verb: 'fail',
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
// AddressBook API Events
|
|
386
|
+
[METRIC_EVENT_NAMES.ADDRESSBOOK_FETCH_SUCCESS]: {
|
|
387
|
+
product,
|
|
388
|
+
agent: 'user',
|
|
389
|
+
target: 'addressbook_fetch',
|
|
390
|
+
verb: 'complete',
|
|
391
|
+
},
|
|
392
|
+
[METRIC_EVENT_NAMES.ADDRESSBOOK_FETCH_FAILED]: {
|
|
393
|
+
product,
|
|
394
|
+
agent: 'user',
|
|
395
|
+
target: 'addressbook_fetch',
|
|
396
|
+
verb: 'fail',
|
|
397
|
+
},
|
|
398
|
+
|
|
399
|
+
// Queue API Events
|
|
400
|
+
[METRIC_EVENT_NAMES.QUEUE_FETCH_SUCCESS]: {
|
|
401
|
+
product,
|
|
402
|
+
agent: 'user',
|
|
403
|
+
target: 'queue_fetch',
|
|
404
|
+
verb: 'complete',
|
|
405
|
+
},
|
|
406
|
+
[METRIC_EVENT_NAMES.QUEUE_FETCH_FAILED]: {
|
|
407
|
+
product,
|
|
408
|
+
agent: 'user',
|
|
409
|
+
target: 'queue_fetch',
|
|
410
|
+
verb: 'fail',
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
// Outdial ANI API Events
|
|
414
|
+
[METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_SUCCESS]: {
|
|
415
|
+
product,
|
|
416
|
+
agent: 'user',
|
|
417
|
+
target: 'outdial_ani_ep_fetch',
|
|
418
|
+
verb: 'complete',
|
|
419
|
+
},
|
|
420
|
+
[METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_FAILED]: {
|
|
421
|
+
product,
|
|
422
|
+
agent: 'user',
|
|
423
|
+
target: 'outdial_ani_ep_fetch',
|
|
424
|
+
verb: 'fail',
|
|
425
|
+
},
|
|
332
426
|
};
|
|
333
427
|
|
|
334
428
|
/**
|