@webex/contact-center 3.8.1 → 3.9.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.
Files changed (106) hide show
  1. package/dist/cc.js +196 -47
  2. package/dist/cc.js.map +1 -1
  3. package/dist/constants.js +1 -0
  4. package/dist/constants.js.map +1 -1
  5. package/dist/index.js +13 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/logger-proxy.js +24 -1
  8. package/dist/logger-proxy.js.map +1 -1
  9. package/dist/metrics/MetricsManager.js +1 -1
  10. package/dist/metrics/MetricsManager.js.map +1 -1
  11. package/dist/metrics/behavioral-events.js +88 -0
  12. package/dist/metrics/behavioral-events.js.map +1 -1
  13. package/dist/metrics/constants.js +32 -2
  14. package/dist/metrics/constants.js.map +1 -1
  15. package/dist/services/AddressBook.js +271 -0
  16. package/dist/services/AddressBook.js.map +1 -0
  17. package/dist/services/EntryPoint.js +227 -0
  18. package/dist/services/EntryPoint.js.map +1 -0
  19. package/dist/services/Queue.js +261 -0
  20. package/dist/services/Queue.js.map +1 -0
  21. package/dist/services/config/constants.js +36 -2
  22. package/dist/services/config/constants.js.map +1 -1
  23. package/dist/services/config/index.js +29 -21
  24. package/dist/services/config/index.js.map +1 -1
  25. package/dist/services/config/types.js +33 -1
  26. package/dist/services/config/types.js.map +1 -1
  27. package/dist/services/core/GlobalTypes.js.map +1 -1
  28. package/dist/services/core/Utils.js +162 -2
  29. package/dist/services/core/Utils.js.map +1 -1
  30. package/dist/services/core/aqm-reqs.js +0 -4
  31. package/dist/services/core/aqm-reqs.js.map +1 -1
  32. package/dist/services/core/websocket/WebSocketManager.js +0 -4
  33. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  34. package/dist/services/task/TaskManager.js +74 -2
  35. package/dist/services/task/TaskManager.js.map +1 -1
  36. package/dist/services/task/constants.js +7 -1
  37. package/dist/services/task/constants.js.map +1 -1
  38. package/dist/services/task/contact.js +86 -0
  39. package/dist/services/task/contact.js.map +1 -1
  40. package/dist/services/task/index.js +384 -72
  41. package/dist/services/task/index.js.map +1 -1
  42. package/dist/services/task/types.js +14 -0
  43. package/dist/services/task/types.js.map +1 -1
  44. package/dist/types/cc.d.ts +115 -35
  45. package/dist/types/constants.d.ts +1 -0
  46. package/dist/types/index.d.ts +8 -3
  47. package/dist/types/metrics/constants.d.ts +25 -1
  48. package/dist/types/services/AddressBook.d.ts +74 -0
  49. package/dist/types/services/EntryPoint.d.ts +67 -0
  50. package/dist/types/services/Queue.d.ts +76 -0
  51. package/dist/types/services/config/constants.d.ts +35 -1
  52. package/dist/types/services/config/index.d.ts +6 -9
  53. package/dist/types/services/config/types.d.ts +79 -58
  54. package/dist/types/services/core/GlobalTypes.d.ts +25 -0
  55. package/dist/types/services/core/Utils.d.ts +40 -1
  56. package/dist/types/services/task/constants.d.ts +6 -0
  57. package/dist/types/services/task/contact.d.ts +10 -0
  58. package/dist/types/services/task/index.d.ts +44 -2
  59. package/dist/types/services/task/types.d.ts +125 -1
  60. package/dist/types/types.d.ts +162 -0
  61. package/dist/types/utils/PageCache.d.ts +173 -0
  62. package/dist/types.js +17 -0
  63. package/dist/types.js.map +1 -1
  64. package/dist/utils/PageCache.js +192 -0
  65. package/dist/utils/PageCache.js.map +1 -0
  66. package/dist/webex.js +1 -1
  67. package/package.json +11 -10
  68. package/src/cc.ts +221 -52
  69. package/src/constants.ts +1 -0
  70. package/src/index.ts +19 -3
  71. package/src/logger-proxy.ts +24 -1
  72. package/src/metrics/MetricsManager.ts +1 -1
  73. package/src/metrics/behavioral-events.ts +92 -0
  74. package/src/metrics/constants.ts +37 -1
  75. package/src/services/AddressBook.ts +291 -0
  76. package/src/services/EntryPoint.ts +241 -0
  77. package/src/services/Queue.ts +277 -0
  78. package/src/services/config/constants.ts +42 -2
  79. package/src/services/config/index.ts +30 -30
  80. package/src/services/config/types.ts +59 -58
  81. package/src/services/core/GlobalTypes.ts +27 -0
  82. package/src/services/core/Utils.ts +199 -1
  83. package/src/services/core/aqm-reqs.ts +0 -5
  84. package/src/services/core/websocket/WebSocketManager.ts +0 -4
  85. package/src/services/task/TaskManager.ts +79 -3
  86. package/src/services/task/constants.ts +6 -0
  87. package/src/services/task/contact.ts +80 -0
  88. package/src/services/task/index.ts +457 -57
  89. package/src/services/task/types.ts +135 -0
  90. package/src/types.ts +180 -0
  91. package/src/utils/PageCache.ts +252 -0
  92. package/test/unit/spec/cc.ts +77 -84
  93. package/test/unit/spec/metrics/MetricsManager.ts +0 -1
  94. package/test/unit/spec/metrics/behavioral-events.ts +56 -0
  95. package/test/unit/spec/services/AddressBook.ts +332 -0
  96. package/test/unit/spec/services/EntryPoint.ts +259 -0
  97. package/test/unit/spec/services/Queue.ts +323 -0
  98. package/test/unit/spec/services/config/index.ts +279 -65
  99. package/test/unit/spec/services/core/Utils.ts +50 -0
  100. package/test/unit/spec/services/core/aqm-reqs.ts +1 -3
  101. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +0 -4
  102. package/test/unit/spec/services/task/TaskManager.ts +145 -1
  103. package/test/unit/spec/services/task/contact.ts +31 -1
  104. package/test/unit/spec/services/task/index.ts +410 -123
  105. package/umd/contact-center.min.js +2 -2
  106. package/umd/contact-center.min.js.map +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_loggerProxy","_interopRequireDefault","require","obj","__esModule","default","PAGINATION_DEFAULTS","exports","PAGE","PAGE_SIZE","DEFAULT_CACHE_TTL_MINUTES","PageCache","cache","Map","constructor","apiName","canUseCache","params","search","filter","attributes","sortBy","buildCacheKey","orgId","page","pageSize","getCachedPage","cacheKey","cachedEntry","get","now","Date","cacheAge","timestamp","LoggerProxy","log","module","method","delete","cachePage","data","meta","cacheEntry","totalMeta","totalPages","totalRecords","totalItems","undefined","set","length","clearCache","cacheSize","size","clear","getCacheSize","_default"],"sources":["PageCache.ts"],"sourcesContent":["import LoggerProxy from '../logger-proxy';\n\n/**\n * Common pagination metadata interface used across all APIs.\n * @public\n * @template T - Additional metadata properties specific to the API\n */\nexport interface PaginationMeta {\n /** Organization ID */\n orgid?: string;\n /** Current page number */\n page?: number;\n /** Page size for current data set */\n pageSize?: number;\n /** Number of pages */\n totalPages?: number;\n /** Total number of items */\n totalRecords?: number;\n /** Total number of items (alias for compatibility) */\n totalItems?: number;\n /** Current page number (alias for compatibility) */\n currentPage?: number;\n /** Map of pagination links */\n links?: Record<string, string>;\n}\n\n/**\n * Common paginated response interface used across all APIs.\n * @public\n * @template T - The type of data items in the response\n */\nexport interface PaginatedResponse<T> {\n /** Array of data items */\n data: T[];\n /** Pagination metadata */\n meta: PaginationMeta;\n}\n\n/**\n * Common search and pagination parameters interface.\n * @public\n */\nexport interface BaseSearchParams {\n /** Search keyword */\n search?: string;\n /** Filter criteria using RSQL syntax */\n filter?: string;\n /** Attributes to be returned */\n attributes?: string;\n /** Page number (starts from 0) */\n page?: number;\n /** Number of items per page */\n pageSize?: number;\n /** Sort field */\n sortBy?: string;\n /** Sort direction */\n sortOrder?: 'asc' | 'desc';\n}\n\n/**\n * Default pagination constants used across all APIs.\n * @public\n */\nexport const PAGINATION_DEFAULTS = {\n /** Default page number */\n PAGE: 0,\n /** Default page size */\n PAGE_SIZE: 100,\n} as const;\n\n/**\n * Interface for cached page entry with metadata\n * @public\n */\nexport interface PageCacheEntry<T> {\n /** Cached data items for this page */\n data: T[];\n /** Timestamp when this page was cached */\n timestamp: number;\n /** Total metadata if available */\n totalMeta?: {\n totalPages?: number;\n totalRecords?: number;\n };\n}\n\n/**\n * Interface for cache validation parameters\n * @public\n */\nexport interface CacheValidationParams {\n /** Search query parameter */\n search?: string;\n /** Filter parameter */\n filter?: string;\n /** Attributes parameter */\n attributes?: string;\n /** Sort by parameter */\n sortBy?: string;\n}\n\n/**\n * Default cache TTL in minutes\n */\nconst DEFAULT_CACHE_TTL_MINUTES = 5;\n\n/**\n * Page cache utility class for managing paginated API response caching.\n * Provides consistent caching behavior across all Contact Center APIs.\n *\n * @class PageCache\n * @public\n * @template T - The type of data items being cached\n * @example\n * ```typescript\n * // Create a cache instance for a specific data type\n * const cache = new PageCache<AddressBookEntry>('AddressBook');\n *\n * // Check if we can use cache (no search/filter parameters)\n * if (cache.canUseCache({ search, filter })) {\n * const cacheKey = cache.buildCacheKey(orgId, page, pageSize);\n * const cachedPage = cache.getCachedPage(cacheKey);\n *\n * if (cachedPage) {\n * return cachedPage.data;\n * }\n * }\n *\n * // Cache API response\n * cache.cachePage(cacheKey, responseData, responseMeta);\n * ```\n */\nexport class PageCache<T> {\n private cache: Map<string, PageCacheEntry<T>> = new Map();\n private apiName: string;\n\n /**\n * Creates an instance of PageCache\n * @param {string} apiName - Name of the API using this cache (for logging)\n * @public\n */\n constructor(apiName: string) {\n this.apiName = apiName;\n }\n\n /**\n * Checks if cache can be used for the given parameters.\n * Cache is only used for simple pagination without search/filter/attributes/sort.\n * @param {CacheValidationParams} params - Parameters to validate\n * @returns {boolean} True if cache can be used\n * @public\n */\n public canUseCache(params: CacheValidationParams): boolean {\n const {search, filter, attributes, sortBy} = params;\n\n return !search && !filter && !attributes && !sortBy;\n }\n\n /**\n * Builds a cache key for the given parameters\n * @param {string} orgId - Organization ID\n * @param {number} page - Page number\n * @param {number} pageSize - Page size\n * @returns {string} Cache key\n * @public\n */\n public buildCacheKey(orgId: string, page: number, pageSize: number): string {\n return `${orgId}:${page}:${pageSize}`;\n }\n\n /**\n * Gets a cached page if it exists and is valid\n * @param {string} cacheKey - Cache key to look up\n * @returns {PageCacheEntry<T> | null} Cached page entry or null if not found/expired\n * @public\n */\n public getCachedPage(cacheKey: string): PageCacheEntry<T> | null {\n const cachedEntry = this.cache.get(cacheKey);\n\n if (!cachedEntry) {\n return null;\n }\n\n // Check if cache entry is expired\n const now = Date.now();\n const cacheAge = (now - cachedEntry.timestamp) / (1000 * 60); // in minutes\n\n if (cacheAge >= DEFAULT_CACHE_TTL_MINUTES) {\n LoggerProxy.log(`Cache entry expired for key: ${cacheKey}`, {\n module: this.apiName,\n method: 'getCachedPage',\n });\n this.cache.delete(cacheKey);\n\n return null;\n }\n\n return cachedEntry;\n }\n\n /**\n * Caches a page of data with metadata\n * @param {string} cacheKey - Cache key\n * @param {T[]} data - Data items to cache\n * @param {any} meta - Metadata from API response\n * @public\n */\n public cachePage(cacheKey: string, data: T[], meta?: any): void {\n const cacheEntry: PageCacheEntry<T> = {\n data,\n timestamp: Date.now(),\n totalMeta: meta\n ? {\n totalPages: meta.totalPages,\n totalRecords: meta.totalRecords || meta.totalItems,\n }\n : undefined,\n };\n\n this.cache.set(cacheKey, cacheEntry);\n\n LoggerProxy.log(`Cached page with ${data.length} items for key: ${cacheKey}`, {\n module: this.apiName,\n method: 'cachePage',\n });\n }\n\n /**\n * Clears all cached entries\n * @public\n */\n public clearCache(): void {\n const cacheSize = this.cache.size;\n this.cache.clear();\n\n LoggerProxy.log(`Cleared ${cacheSize} cache entries`, {\n module: this.apiName,\n method: 'clearCache',\n });\n }\n\n /**\n * Gets the current number of cached entries\n * @returns {number} Number of cached entries\n * @public\n */\n public getCacheSize(): number {\n return this.cache.size;\n }\n}\n\nexport default PageCache;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE1C;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACO,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EACjC;EACAE,IAAI,EAAE,CAAC;EACP;EACAC,SAAS,EAAE;AACb,CAAU;;AAEV;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA,MAAMC,yBAAyB,GAAG,CAAC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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_webexCore.default.extend({
31
31
  webex: true,
32
- version: `0.0.0`
32
+ version: `3.9.0-multi-llms.1`
33
33
  });
34
34
 
35
35
  /**
package/package.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "@webex/contact-center",
3
- "version": "3.8.1",
4
3
  "description": "This package provides a set of APIs to perform various operations for the Agent flow within Webex Contact Center",
5
4
  "license": "Cisco's General Terms (https://www.cisco.com/site/us/en/about/legal/contract-experience/index.html)",
6
5
  "contributors": [
@@ -46,17 +45,18 @@
46
45
  },
47
46
  "dependencies": {
48
47
  "@types/platform": "1.3.4",
49
- "@webex/calling": "0.0.0",
50
- "@webex/internal-plugin-mercury": "0.0.0",
51
- "@webex/internal-plugin-metrics": "0.0.0",
52
- "@webex/internal-plugin-support": "0.0.0",
53
- "@webex/plugin-authorization": "0.0.0",
54
- "@webex/plugin-logger": "0.0.0",
55
- "@webex/webex-core": "0.0.0",
48
+ "@webex/calling": "3.9.0-multi-llms.1",
49
+ "@webex/internal-plugin-mercury": "3.9.0-multi-llms.1",
50
+ "@webex/internal-plugin-metrics": "3.9.0-multi-llms.1",
51
+ "@webex/internal-plugin-support": "3.9.0-multi-llms.1",
52
+ "@webex/plugin-authorization": "3.9.0-multi-llms.1",
53
+ "@webex/plugin-logger": "3.9.0-multi-llms.1",
54
+ "@webex/webex-core": "3.9.0-multi-llms.1",
56
55
  "jest-html-reporters": "3.0.11",
57
56
  "lodash": "^4.17.21"
58
57
  },
59
58
  "devDependencies": {
59
+ "@babel/core": "^7.22.11",
60
60
  "@babel/preset-typescript": "7.22.11",
61
61
  "@types/jest": "27.4.1",
62
62
  "@typescript-eslint/eslint-plugin": "5.38.1",
@@ -65,7 +65,7 @@
65
65
  "@webex/eslint-config-legacy": "0.0.0",
66
66
  "@webex/jest-config-legacy": "0.0.0",
67
67
  "@webex/legacy-tools": "0.0.0",
68
- "@webex/test-helper-mock-webex": "0.0.0",
68
+ "@webex/test-helper-mock-webex": "3.9.0-multi-llms.0",
69
69
  "eslint": "^8.24.0",
70
70
  "eslint-config-airbnb-base": "15.0.0",
71
71
  "eslint-config-prettier": "8.3.0",
@@ -79,5 +79,6 @@
79
79
  "prettier": "2.5.1",
80
80
  "typedoc": "^0.25.0",
81
81
  "typescript": "4.9.5"
82
- }
82
+ },
83
+ "version": "3.9.0-multi-llms.1"
83
84
  }
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
- AGENT_STATE_AVAILABLE,
50
- AGENT_STATE_AVAILABLE_ID,
51
- DEFAULT_PAGE,
52
- DEFAULT_PAGE_SIZE,
53
- } from './services/config/constants';
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
  }
@@ -614,6 +697,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
614
697
  });
615
698
  // TODO: Make profile a singleton to make it available throughout app/sdk so we dont need to inject info everywhere
616
699
  this.taskManager.setWrapupData(this.agentConfig.wrapUpData);
700
+ this.taskManager.setAgentId(this.agentConfig.agentId);
617
701
 
618
702
  if (
619
703
  this.agentConfig.webRtcEnabled &&
@@ -979,11 +1063,25 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
979
1063
  return;
980
1064
  }
981
1065
 
982
- LoggerProxy.log(`Received event: ${eventData.type}`, {
1066
+ LoggerProxy.log(`Received event: ${eventData?.data?.type ?? eventData.type}`, {
983
1067
  module: CC_FILE,
984
1068
  method: METHODS.HANDLE_WEBSOCKET_MESSAGE,
985
1069
  });
986
1070
 
1071
+ // Emit metrics for all websocket events except keepalive and welcome
1072
+ const topLevelType = eventData.type;
1073
+ const nestedType = eventData?.data?.type;
1074
+ if (topLevelType !== CC_EVENTS.WELCOME && eventData.keepalive !== 'true') {
1075
+ const metricsPayload: Record<string, any> = {
1076
+ ws_event_type: nestedType || topLevelType,
1077
+ top_level_type: topLevelType,
1078
+ has_data: Boolean(eventData.data),
1079
+ };
1080
+ this.metricsManager.trackEvent(METRIC_EVENT_NAMES.WEBSOCKET_EVENT_RECEIVED, metricsPayload, [
1081
+ 'operational',
1082
+ ]);
1083
+ }
1084
+
987
1085
  switch (eventData.type) {
988
1086
  case CC_EVENTS.AGENT_MULTI_LOGIN:
989
1087
  // @ts-ignore
@@ -1238,6 +1336,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1238
1336
  * Makes an outbound call to a specified phone number.
1239
1337
  *
1240
1338
  * @param {string} destination - The phone number to dial (e.g., '+1234567890').
1339
+ * @param {string} origin - The contact center number that will be used while making a call to the customer.
1241
1340
  * Should include country code and be in E.164 format.
1242
1341
  * @returns {Promise<TaskResponse>} Resolves with the task response containing:
1243
1342
  * - interactionId: Unique identifier for the outbound call
@@ -1273,7 +1372,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1273
1372
  *
1274
1373
  * // Start the outbound call
1275
1374
  * const destination = '+1234567890';
1276
- * const task = await cc.startOutdial(destination);
1375
+ * const task = await cc.startOutdial(destination, origin);
1277
1376
  *
1278
1377
  * // Listen for all relevant task events
1279
1378
  * task.on('task:ringing', () => {
@@ -1341,7 +1440,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1341
1440
  * }
1342
1441
  * ```
1343
1442
  */
1344
- public async startOutdial(destination: string): Promise<TaskResponse> {
1443
+ public async startOutdial(destination: string, origin: string): Promise<TaskResponse> {
1345
1444
  LoggerProxy.info('Starting outbound dial', {
1346
1445
  module: CC_FILE,
1347
1446
  method: METHODS.START_OUTDIAL,
@@ -1355,6 +1454,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1355
1454
  // Construct the outdial payload.
1356
1455
  const outDialPayload: DialerPayload = {
1357
1456
  destination,
1457
+ origin,
1358
1458
  entryPointId: this.agentConfig.outDialEp,
1359
1459
  direction: OUTDIAL_DIRECTION,
1360
1460
  attributes: ATTRIBUTES,
@@ -1369,6 +1469,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1369
1469
  {
1370
1470
  ...MetricsManager.getCommonTrackingFieldForAQMResponse(result),
1371
1471
  destination,
1472
+ origin,
1372
1473
  mediaType: OUTDIAL_MEDIA_TYPE,
1373
1474
  },
1374
1475
  ['behavioral', 'business', 'operational']
@@ -1389,6 +1490,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1389
1490
  {
1390
1491
  ...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(failure),
1391
1492
  destination,
1493
+ origin,
1392
1494
  mediaType: OUTDIAL_MEDIA_TYPE,
1393
1495
  },
1394
1496
  ['behavioral', 'business', 'operational']
@@ -1399,55 +1501,55 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1399
1501
  }
1400
1502
 
1401
1503
  /**
1402
- * This is used for getting the list of queues to which a task can be consulted or transferred.
1403
- * @param {string} [search] - Optional search string to filter queues by name
1404
- * @param {string} [filter] - Optional OData filter expression (e.g., 'teamId eq "team123"')
1405
- * @param {number} [page=0] - Page number for paginated results, starting at 0
1406
- * @param {number} [pageSize=100] - Number of queues to return per page
1407
- * @returns Promise<ContactServiceQueue[]> Resolves with the list of queues
1408
- * @throws Error If the operation fails
1504
+ * Fetches outdial ANI (Automatic Number Identification) entries for an outdial ANI ID.
1505
+ *
1506
+ * This method retrieves the list of phone numbers that can be used as caller ID when making
1507
+ * outbound calls. The ANI data is associated with an outdial ANI ID and can be filtered
1508
+ * and paginated as needed.
1509
+ *
1510
+ * @param {string} outdialANI - The outdial ANI ID to fetch ANI data for
1511
+ * @param {number} [page] - Optional page number for pagination (0-based)
1512
+ * @param {number} [pageSize] - Optional number of items per page
1513
+ * @param {string} [search] - Optional search term to filter results by name or number
1514
+ * @param {string} [filter] - Optional filter string
1515
+ * @param {string} [attributes] - Optional attributes to include in response
1516
+ * @returns {Promise<OutdialAniEntriesResponse>} Promise resolving to outdial ANI response containing:
1517
+ * - data: Array of ANI entries with number and name
1518
+ * - meta: Pagination metadata
1519
+ * @throws {Error} If the operation fails or agent is not registered
1409
1520
  * @public
1410
1521
  * @example
1411
1522
  * ```typescript
1412
1523
  * const cc = webex.cc;
1413
1524
  * await cc.register();
1414
- * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
1415
1525
  *
1416
- * // Basic usage - get all queues
1417
- * const allQueues = await cc.getQueues();
1526
+ * // Get agent profile to obtain outdial ANI ID
1527
+ * const agentProfile = cc.agentConfig;
1528
+ * const outdialANI = agentProfile.outdialANIId;
1418
1529
  *
1419
- * // Search for specific queues
1420
- * const salesQueues = await cc.getQueues('sales'); // Search for 'sales' in queue names
1530
+ * // Basic usage - get all ANI data for an outdial ANI ID
1531
+ * const aniData = await cc.getOutdialAniEntries({ outdialANI });
1421
1532
  *
1422
- * // Use filtering and pagination
1423
- * const filteredQueues = await cc.getQueues(
1424
- * '', // No search term
1425
- * 'teamId eq "team123"', // Filter by team
1426
- * 0, // First page
1427
- * 50 // 50 items per page
1428
- * );
1533
+ * // With pagination and search
1534
+ * const paginatedAni = await cc.getOutdialAniEntries({
1535
+ * outdialANI,
1536
+ * page: 0,
1537
+ * pageSize: 50,
1538
+ * search: '555' // search for numbers containing '555'
1539
+ * });
1429
1540
  *
1430
- * // Process queue results
1431
- * queues.forEach(queue => {
1432
- * console.log('Queue:', {
1433
- * id: queue.queueId,
1434
- * name: queue.queueName,
1435
- * channelType: queue.channelType,
1436
- * isActive: queue.isActive,
1437
- * description: queue.description
1438
- * });
1541
+ * // Process the results
1542
+ * paginatedAni.forEach(ani => {
1543
+ * console.log(`ANI: ${ani.number} - ${ani.name}`);
1439
1544
  * });
1440
1545
  * ```
1441
1546
  */
1442
- public async getQueues(
1443
- search?: string,
1444
- filter?: string,
1445
- page = DEFAULT_PAGE,
1446
- pageSize = DEFAULT_PAGE_SIZE
1447
- ): Promise<ContactServiceQueue[]> {
1448
- LoggerProxy.info('Fetching queues', {
1547
+ public async getOutdialAniEntries(params: OutdialAniParams): Promise<OutdialAniEntriesResponse> {
1548
+ const {outdialANI, page, pageSize, search, filter, attributes} = params;
1549
+
1550
+ LoggerProxy.info('Fetching outdial ANI entries', {
1449
1551
  module: CC_FILE,
1450
- method: METHODS.GET_QUEUES,
1552
+ method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
1451
1553
  });
1452
1554
 
1453
1555
  const orgId = this.$webex.credentials.getOrgId();
@@ -1455,20 +1557,65 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1455
1557
  if (!orgId) {
1456
1558
  LoggerProxy.error('Org ID not found.', {
1457
1559
  module: CC_FILE,
1458
- method: METHODS.GET_QUEUES,
1560
+ method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
1459
1561
  });
1460
1562
 
1461
1563
  throw new Error('Org ID not found.');
1462
1564
  }
1463
1565
 
1464
- const result = await this.services.config.getQueues(orgId, page, pageSize, search, filter);
1566
+ try {
1567
+ const result = await this.services.config.getOutdialAniEntries(orgId, {
1568
+ outdialANI,
1569
+ page,
1570
+ pageSize,
1571
+ search,
1572
+ filter,
1573
+ attributes,
1574
+ });
1465
1575
 
1466
- LoggerProxy.log(`Successfully retrieved ${result?.length} queues`, {
1467
- module: CC_FILE,
1468
- method: METHODS.GET_QUEUES,
1469
- });
1576
+ this.metricsManager.trackEvent(
1577
+ METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_SUCCESS,
1578
+ {
1579
+ outdialANI,
1580
+ resultCount: result?.length || 0,
1581
+ },
1582
+ ['behavioral', 'business', 'operational']
1583
+ );
1584
+
1585
+ LoggerProxy.log(`Successfully retrieved outdial ANI entries for ANI ID ${outdialANI}`, {
1586
+ module: CC_FILE,
1587
+ method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
1588
+ });
1589
+
1590
+ return result;
1591
+ } catch (error) {
1592
+ const failure = error.details as Failure;
1593
+ this.metricsManager.trackEvent(
1594
+ METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_FAILED,
1595
+ {
1596
+ ...MetricsManager.getCommonTrackingFieldForAQMResponseFailed(failure),
1597
+ outdialANI,
1598
+ error,
1599
+ },
1600
+ ['behavioral', 'business', 'operational']
1601
+ );
1602
+
1603
+ LoggerProxy.error(
1604
+ `Failed to fetch outdial ANI entries for ANI ID ${outdialANI} due to: ${error}`,
1605
+ {
1606
+ module: CC_FILE,
1607
+ method: METHODS.GET_OUTDIAL_ANI_ENTRIES,
1608
+ trackingId: failure.trackingId,
1609
+ }
1610
+ );
1470
1611
 
1471
- return result;
1612
+ const {error: detailedError} = getErrorDetails(
1613
+ error,
1614
+ METHODS.GET_OUTDIAL_ANI_ENTRIES,
1615
+ CC_FILE
1616
+ );
1617
+ throw detailedError;
1618
+ }
1472
1619
  }
1473
1620
 
1474
1621
  /**
@@ -1615,4 +1762,26 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
1615
1762
  throw error;
1616
1763
  }
1617
1764
  }
1765
+
1766
+ /**
1767
+ * Returns paginated entry points for the organization.
1768
+ * Thin wrapper around internal EntryPoint instance.
1769
+ * @public
1770
+ */
1771
+ public async getEntryPoints(
1772
+ params: EntryPointSearchParams = {}
1773
+ ): Promise<EntryPointListResponse> {
1774
+ return this.entryPoint.getEntryPoints(params);
1775
+ }
1776
+
1777
+ /**
1778
+ * Returns paginated contact service queues for the organization.
1779
+ * Thin wrapper around internal Queue instance.
1780
+ * @public
1781
+ */
1782
+ public async getQueues(
1783
+ params: ContactServiceQueueSearchParams = {}
1784
+ ): Promise<ContactServiceQueuesResponse> {
1785
+ return this.queue.getQueues(params);
1786
+ }
1618
1787
  }
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
@@ -2,7 +2,9 @@ import {registerPlugin} from '@webex/webex-core';
2
2
  import config from './config';
3
3
  import ContactCenter from './cc';
4
4
 
5
- /** @module ContactCenterModule */
5
+ /**
6
+ * @module ContactCenterModule
7
+ * /
6
8
 
7
9
  // Core exports
8
10
  /**
@@ -24,6 +26,22 @@ export {default as Task} from './services/task';
24
26
  */
25
27
  export {default as routingAgent} from './services/agent';
26
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
+
27
45
  // Enums
28
46
  /**
29
47
  * Task Events for Contact Center operations
@@ -155,8 +173,6 @@ export type {
155
173
  export type {
156
174
  /** Profile interface */
157
175
  Profile,
158
- /** Contact service queue interface */
159
- ContactServiceQueue,
160
176
  /** Response type from getUserUsingCI method */
161
177
  AgentResponse,
162
178
  /** Response from getDesktopProfileById */
@@ -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
- return `${timestamp} ${LOG_PREFIX} - [${level}]: module:${moduleName} - method:${methodName}${interactionId}${trackingId} - ${message}`;
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';