@webex/contact-center 3.9.0-next.15 → 3.9.0-next.16
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 +114 -8
- package/dist/cc.js.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/metrics/constants.js +7 -2
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/config/constants.js +13 -1
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +50 -0
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +15 -0
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/task/types.js.map +1 -1
- package/dist/types/cc.d.ts +49 -3
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/metrics/constants.d.ts +5 -1
- package/dist/types/services/config/constants.d.ts +12 -0
- package/dist/types/services/config/index.d.ts +11 -1
- package/dist/types/services/config/types.d.ts +41 -0
- package/dist/types/services/task/types.d.ts +2 -0
- package/dist/webex.js +1 -1
- package/package.json +1 -1
- package/src/cc.ts +132 -4
- package/src/constants.ts +1 -0
- package/src/metrics/constants.ts +7 -1
- package/src/services/config/constants.ts +16 -0
- package/src/services/config/index.ts +56 -2
- package/src/services/config/types.ts +44 -0
- package/src/services/task/types.ts +2 -0
- package/test/unit/spec/cc.ts +46 -2
- package/test/unit/spec/services/config/index.ts +314 -29
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
package/dist/cc.js
CHANGED
|
@@ -9,14 +9,14 @@ var _events = _interopRequireDefault(require("events"));
|
|
|
9
9
|
var _uuid = require("uuid");
|
|
10
10
|
var _types = require("./types");
|
|
11
11
|
var _constants = require("./constants");
|
|
12
|
-
var _constants2 = require("./services/constants");
|
|
12
|
+
var _constants2 = require("./services/config/constants");
|
|
13
|
+
var _constants3 = require("./services/constants");
|
|
13
14
|
var _services = _interopRequireDefault(require("./services"));
|
|
14
15
|
var _WebexRequest = _interopRequireDefault(require("./services/core/WebexRequest"));
|
|
15
16
|
var _loggerProxy = _interopRequireDefault(require("./logger-proxy"));
|
|
16
17
|
var _types2 = require("./services/agent/types");
|
|
17
18
|
var _Utils = require("./services/core/Utils");
|
|
18
19
|
var _types3 = require("./services/config/types");
|
|
19
|
-
var _constants3 = require("./services/config/constants");
|
|
20
20
|
var _TaskManager = _interopRequireDefault(require("./services/task/TaskManager"));
|
|
21
21
|
var _WebCallingService = _interopRequireDefault(require("./services/WebCallingService"));
|
|
22
22
|
var _types4 = require("./services/task/types");
|
|
@@ -678,7 +678,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
678
678
|
deviceType: data.loginOption,
|
|
679
679
|
isExtension: data.loginOption === _types.LoginOption.EXTENSION,
|
|
680
680
|
deviceId: this.getDeviceId(data.loginOption, data.dialNumber),
|
|
681
|
-
roles: [
|
|
681
|
+
roles: [_constants3.AGENT],
|
|
682
682
|
teamName: _constants.EMPTY_STRING,
|
|
683
683
|
siteId: _constants.EMPTY_STRING,
|
|
684
684
|
usesOtherDN: false,
|
|
@@ -801,7 +801,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
801
801
|
if (loginOption === _types.LoginOption.EXTENSION || loginOption === _types.LoginOption.AGENT_DN) {
|
|
802
802
|
return dialNumber;
|
|
803
803
|
}
|
|
804
|
-
return
|
|
804
|
+
return _constants3.WEB_RTC_PREFIX + this.agentConfig.agentId;
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
/**
|
|
@@ -1088,9 +1088,9 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1088
1088
|
module: _constants.CC_FILE,
|
|
1089
1089
|
method: _constants.METHODS.SILENT_RELOGIN
|
|
1090
1090
|
});
|
|
1091
|
-
auxCodeId =
|
|
1091
|
+
auxCodeId = _constants2.AGENT_STATE_AVAILABLE_ID;
|
|
1092
1092
|
const stateChangeData = {
|
|
1093
|
-
state:
|
|
1093
|
+
state: _constants2.AGENT_STATE_AVAILABLE,
|
|
1094
1094
|
auxCodeId,
|
|
1095
1095
|
lastStateChangeReason,
|
|
1096
1096
|
agentId
|
|
@@ -1172,6 +1172,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1172
1172
|
* Makes an outbound call to a specified phone number.
|
|
1173
1173
|
*
|
|
1174
1174
|
* @param {string} destination - The phone number to dial (e.g., '+1234567890').
|
|
1175
|
+
* @param {string} origin - The contact center number that will be used while making a call to the customer.
|
|
1175
1176
|
* Should include country code and be in E.164 format.
|
|
1176
1177
|
* @returns {Promise<TaskResponse>} Resolves with the task response containing:
|
|
1177
1178
|
* - interactionId: Unique identifier for the outbound call
|
|
@@ -1207,7 +1208,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1207
1208
|
*
|
|
1208
1209
|
* // Start the outbound call
|
|
1209
1210
|
* const destination = '+1234567890';
|
|
1210
|
-
* const task = await cc.startOutdial(destination);
|
|
1211
|
+
* const task = await cc.startOutdial(destination, origin);
|
|
1211
1212
|
*
|
|
1212
1213
|
* // Listen for all relevant task events
|
|
1213
1214
|
* task.on('task:ringing', () => {
|
|
@@ -1275,7 +1276,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1275
1276
|
* }
|
|
1276
1277
|
* ```
|
|
1277
1278
|
*/
|
|
1278
|
-
async startOutdial(destination) {
|
|
1279
|
+
async startOutdial(destination, origin) {
|
|
1279
1280
|
_loggerProxy.default.info('Starting outbound dial', {
|
|
1280
1281
|
module: _constants.CC_FILE,
|
|
1281
1282
|
method: _constants.METHODS.START_OUTDIAL
|
|
@@ -1286,6 +1287,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1286
1287
|
// Construct the outdial payload.
|
|
1287
1288
|
const outDialPayload = {
|
|
1288
1289
|
destination,
|
|
1290
|
+
origin,
|
|
1289
1291
|
entryPointId: this.agentConfig.outDialEp,
|
|
1290
1292
|
direction: _constants.OUTDIAL_DIRECTION,
|
|
1291
1293
|
attributes: _constants.ATTRIBUTES,
|
|
@@ -1298,6 +1300,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1298
1300
|
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.TASK_OUTDIAL_SUCCESS, {
|
|
1299
1301
|
..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(result),
|
|
1300
1302
|
destination,
|
|
1303
|
+
origin,
|
|
1301
1304
|
mediaType: _constants.OUTDIAL_MEDIA_TYPE
|
|
1302
1305
|
}, ['behavioral', 'business', 'operational']);
|
|
1303
1306
|
_loggerProxy.default.log(`Outbound dial completed successfully`, {
|
|
@@ -1312,6 +1315,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1312
1315
|
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.TASK_OUTDIAL_FAILED, {
|
|
1313
1316
|
..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1314
1317
|
destination,
|
|
1318
|
+
origin,
|
|
1315
1319
|
mediaType: _constants.OUTDIAL_MEDIA_TYPE
|
|
1316
1320
|
}, ['behavioral', 'business', 'operational']);
|
|
1317
1321
|
const {
|
|
@@ -1321,6 +1325,108 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1321
1325
|
}
|
|
1322
1326
|
}
|
|
1323
1327
|
|
|
1328
|
+
/**
|
|
1329
|
+
* Fetches outdial ANI (Automatic Number Identification) entries for an outdial ANI ID.
|
|
1330
|
+
*
|
|
1331
|
+
* This method retrieves the list of phone numbers that can be used as caller ID when making
|
|
1332
|
+
* outbound calls. The ANI data is associated with an outdial ANI ID and can be filtered
|
|
1333
|
+
* and paginated as needed.
|
|
1334
|
+
*
|
|
1335
|
+
* @param {string} outdialANI - The outdial ANI ID to fetch ANI data for
|
|
1336
|
+
* @param {number} [page] - Optional page number for pagination (0-based)
|
|
1337
|
+
* @param {number} [pageSize] - Optional number of items per page
|
|
1338
|
+
* @param {string} [search] - Optional search term to filter results by name or number
|
|
1339
|
+
* @param {string} [filter] - Optional filter string
|
|
1340
|
+
* @param {string} [attributes] - Optional attributes to include in response
|
|
1341
|
+
* @returns {Promise<OutdialAniEntriesResponse>} Promise resolving to outdial ANI response containing:
|
|
1342
|
+
* - data: Array of ANI entries with number and name
|
|
1343
|
+
* - meta: Pagination metadata
|
|
1344
|
+
* @throws {Error} If the operation fails or agent is not registered
|
|
1345
|
+
* @public
|
|
1346
|
+
* @example
|
|
1347
|
+
* ```typescript
|
|
1348
|
+
* const cc = webex.cc;
|
|
1349
|
+
* await cc.register();
|
|
1350
|
+
*
|
|
1351
|
+
* // Get agent profile to obtain outdial ANI ID
|
|
1352
|
+
* const agentProfile = cc.agentConfig;
|
|
1353
|
+
* const outdialANI = agentProfile.outdialANIId;
|
|
1354
|
+
*
|
|
1355
|
+
* // Basic usage - get all ANI data for an outdial ANI ID
|
|
1356
|
+
* const aniData = await cc.getOutdialAniEntries({ outdialANI });
|
|
1357
|
+
*
|
|
1358
|
+
* // With pagination and search
|
|
1359
|
+
* const paginatedAni = await cc.getOutdialAniEntries({
|
|
1360
|
+
* outdialANI,
|
|
1361
|
+
* page: 0,
|
|
1362
|
+
* pageSize: 50,
|
|
1363
|
+
* search: '555' // search for numbers containing '555'
|
|
1364
|
+
* });
|
|
1365
|
+
*
|
|
1366
|
+
* // Process the results
|
|
1367
|
+
* paginatedAni.forEach(ani => {
|
|
1368
|
+
* console.log(`ANI: ${ani.number} - ${ani.name}`);
|
|
1369
|
+
* });
|
|
1370
|
+
* ```
|
|
1371
|
+
*/
|
|
1372
|
+
async getOutdialAniEntries(params) {
|
|
1373
|
+
const {
|
|
1374
|
+
outdialANI,
|
|
1375
|
+
page,
|
|
1376
|
+
pageSize,
|
|
1377
|
+
search,
|
|
1378
|
+
filter,
|
|
1379
|
+
attributes
|
|
1380
|
+
} = params;
|
|
1381
|
+
_loggerProxy.default.info('Fetching outdial ANI entries', {
|
|
1382
|
+
module: _constants.CC_FILE,
|
|
1383
|
+
method: _constants.METHODS.GET_OUTDIAL_ANI_ENTRIES
|
|
1384
|
+
});
|
|
1385
|
+
const orgId = this.$webex.credentials.getOrgId();
|
|
1386
|
+
if (!orgId) {
|
|
1387
|
+
_loggerProxy.default.error('Org ID not found.', {
|
|
1388
|
+
module: _constants.CC_FILE,
|
|
1389
|
+
method: _constants.METHODS.GET_OUTDIAL_ANI_ENTRIES
|
|
1390
|
+
});
|
|
1391
|
+
throw new Error('Org ID not found.');
|
|
1392
|
+
}
|
|
1393
|
+
try {
|
|
1394
|
+
const result = await this.services.config.getOutdialAniEntries(orgId, {
|
|
1395
|
+
outdialANI,
|
|
1396
|
+
page,
|
|
1397
|
+
pageSize,
|
|
1398
|
+
search,
|
|
1399
|
+
filter,
|
|
1400
|
+
attributes
|
|
1401
|
+
});
|
|
1402
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_SUCCESS, {
|
|
1403
|
+
outdialANI,
|
|
1404
|
+
resultCount: result?.length || 0
|
|
1405
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1406
|
+
_loggerProxy.default.log(`Successfully retrieved outdial ANI entries for ANI ID ${outdialANI}`, {
|
|
1407
|
+
module: _constants.CC_FILE,
|
|
1408
|
+
method: _constants.METHODS.GET_OUTDIAL_ANI_ENTRIES
|
|
1409
|
+
});
|
|
1410
|
+
return result;
|
|
1411
|
+
} catch (error) {
|
|
1412
|
+
const failure = error.details;
|
|
1413
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.OUTDIAL_ANI_EP_FETCH_FAILED, {
|
|
1414
|
+
..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1415
|
+
outdialANI,
|
|
1416
|
+
error
|
|
1417
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1418
|
+
_loggerProxy.default.error(`Failed to fetch outdial ANI entries for ANI ID ${outdialANI} due to: ${error}`, {
|
|
1419
|
+
module: _constants.CC_FILE,
|
|
1420
|
+
method: _constants.METHODS.GET_OUTDIAL_ANI_ENTRIES,
|
|
1421
|
+
trackingId: failure.trackingId
|
|
1422
|
+
});
|
|
1423
|
+
const {
|
|
1424
|
+
error: detailedError
|
|
1425
|
+
} = (0, _Utils.getErrorDetails)(error, _constants.METHODS.GET_OUTDIAL_ANI_ENTRIES, _constants.CC_FILE);
|
|
1426
|
+
throw detailedError;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1324
1430
|
/**
|
|
1325
1431
|
* Uploads logs to help troubleshoot SDK issues.
|
|
1326
1432
|
*
|