webitel-sdk 0.1.88 → 0.1.92

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 (68) hide show
  1. package/bundles/index.esm.js +200 -37
  2. package/bundles/index.esm.js.map +1 -1
  3. package/bundles/index.esm.min.js +1 -1
  4. package/bundles/index.esm.min.js.map +1 -1
  5. package/bundles/index.umd.js +248 -41
  6. package/bundles/index.umd.js.map +1 -1
  7. package/bundles/index.umd.min.js +1 -1
  8. package/bundles/index.umd.min.js.map +1 -1
  9. package/esm2015/api/call-service-api.js +14 -7
  10. package/esm2015/api/call-service-api.js.map +1 -1
  11. package/esm2015/api/engine-patch-queue-bucket-request.js +13 -0
  12. package/esm2015/api/engine-patch-queue-bucket-request.js.map +1 -0
  13. package/esm2015/api/index.js.map +1 -1
  14. package/esm2015/api/queue-bucket-service-api.js +125 -27
  15. package/esm2015/api/queue-bucket-service-api.js.map +1 -1
  16. package/esm2015/sip/webrtc/index.js +1 -0
  17. package/esm2015/sip/webrtc/index.js.map +1 -1
  18. package/esm2015/socket/client.js +55 -1
  19. package/esm2015/socket/client.js.map +1 -1
  20. package/esm2015/socket/conversation.js.map +1 -1
  21. package/esm2015/socket/task.js +5 -2
  22. package/esm2015/socket/task.js.map +1 -1
  23. package/esm5/api/call-service-api.js +14 -7
  24. package/esm5/api/call-service-api.js.map +1 -1
  25. package/esm5/api/engine-patch-queue-bucket-request.js +13 -0
  26. package/esm5/api/engine-patch-queue-bucket-request.js.map +1 -0
  27. package/esm5/api/index.js.map +1 -1
  28. package/esm5/api/queue-bucket-service-api.js +138 -27
  29. package/esm5/api/queue-bucket-service-api.js.map +1 -1
  30. package/esm5/sip/webrtc/index.js +1 -0
  31. package/esm5/sip/webrtc/index.js.map +1 -1
  32. package/esm5/socket/client.js +85 -5
  33. package/esm5/socket/client.js.map +1 -1
  34. package/esm5/socket/conversation.js.map +1 -1
  35. package/esm5/socket/task.js +10 -2
  36. package/esm5/socket/task.js.map +1 -1
  37. package/package.json +1 -1
  38. package/types/api/call-service-api.d.ts +8 -4
  39. package/types/api/call-service-api.d.ts.map +1 -1
  40. package/types/api/engine-attempt-callback-request.d.ts +6 -0
  41. package/types/api/engine-attempt-callback-request.d.ts.map +1 -1
  42. package/types/api/engine-attempt-result-request.d.ts +6 -0
  43. package/types/api/engine-attempt-result-request.d.ts.map +1 -1
  44. package/types/api/engine-create-queue-bucket-request.d.ts +8 -2
  45. package/types/api/engine-create-queue-bucket-request.d.ts.map +1 -1
  46. package/types/api/engine-member-communication-create-request.d.ts +6 -0
  47. package/types/api/engine-member-communication-create-request.d.ts.map +1 -1
  48. package/types/api/engine-member-communication.d.ts +6 -0
  49. package/types/api/engine-member-communication.d.ts.map +1 -1
  50. package/types/api/engine-patch-queue-bucket-request.d.ts +62 -0
  51. package/types/api/engine-patch-queue-bucket-request.d.ts.map +1 -0
  52. package/types/api/engine-queue-bucket.d.ts +12 -0
  53. package/types/api/engine-queue-bucket.d.ts.map +1 -1
  54. package/types/api/engine-update-queue-bucket-request.d.ts +8 -2
  55. package/types/api/engine-update-queue-bucket-request.d.ts.map +1 -1
  56. package/types/api/index.d.ts +1 -0
  57. package/types/api/index.d.ts.map +1 -1
  58. package/types/api/queue-bucket-service-api.d.ts +46 -16
  59. package/types/api/queue-bucket-service-api.d.ts.map +1 -1
  60. package/types/sip/webrtc/index.d.ts.map +1 -1
  61. package/types/socket/call.d.ts +2 -2
  62. package/types/socket/call.d.ts.map +1 -1
  63. package/types/socket/client.d.ts +4 -0
  64. package/types/socket/client.d.ts.map +1 -1
  65. package/types/socket/conversation.d.ts +3 -1
  66. package/types/socket/conversation.d.ts.map +1 -1
  67. package/types/socket/task.d.ts +3 -0
  68. package/types/socket/task.d.ts.map +1 -1
@@ -6982,10 +6982,11 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
6982
6982
  * @param {Array<string>} [transferTo]
6983
6983
  * @param {Array<string>} [dependencyId]
6984
6984
  * @param {Array<string>} [tags]
6985
+ * @param {Array<string>} [amdResult]
6985
6986
  * @param {*} [options] Override http request option.
6986
6987
  * @throws {RequiredError}
6987
6988
  */
6988
- searchHistoryCall: async (page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, options = {}) => {
6989
+ searchHistoryCall: async (page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, options = {}) => {
6989
6990
  const localVarPath = `/calls/history`;
6990
6991
  const localVarUrlObj = parse(localVarPath, true);
6991
6992
  let baseOptions;
@@ -7102,6 +7103,9 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
7102
7103
  if (tags) {
7103
7104
  localVarQueryParameter['tags'] = tags;
7104
7105
  }
7106
+ if (amdResult) {
7107
+ localVarQueryParameter['amd_result'] = amdResult;
7108
+ }
7105
7109
  localVarUrlObj.query = {
7106
7110
  ...localVarUrlObj.query,
7107
7111
  ...localVarQueryParameter,
@@ -7504,11 +7508,12 @@ const CallServiceApiFp = function (configuration) {
7504
7508
  * @param {Array<string>} [transferTo]
7505
7509
  * @param {Array<string>} [dependencyId]
7506
7510
  * @param {Array<string>} [tags]
7511
+ * @param {Array<string>} [amdResult]
7507
7512
  * @param {*} [options] Override http request option.
7508
7513
  * @throws {RequiredError}
7509
7514
  */
7510
- async searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, options) {
7511
- const localVarAxiosArgs = await CallServiceApiAxiosParamCreator(configuration).searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, options);
7515
+ async searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, options) {
7516
+ const localVarAxiosArgs = await CallServiceApiAxiosParamCreator(configuration).searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, options);
7512
7517
  return (axios = globalAxios, basePath = BASE_PATH) => {
7513
7518
  const axiosRequestArgs = {
7514
7519
  ...localVarAxiosArgs.options,
@@ -7754,12 +7759,13 @@ const CallServiceApiFactory = function (configuration, basePath, axios) {
7754
7759
  * @param {Array<string>} [transferTo]
7755
7760
  * @param {Array<string>} [dependencyId]
7756
7761
  * @param {Array<string>} [tags]
7762
+ * @param {Array<string>} [amdResult]
7757
7763
  * @param {*} [options] Override http request option.
7758
7764
  * @throws {RequiredError}
7759
7765
  */
7760
- searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, options) {
7766
+ searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, options) {
7761
7767
  return CallServiceApiFp(configuration)
7762
- .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, options)
7768
+ .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, options)
7763
7769
  .then((request) => request(axios, basePath));
7764
7770
  },
7765
7771
  /**
@@ -8001,13 +8007,14 @@ class CallServiceApi extends BaseAPI {
8001
8007
  * @param {Array<string>} [transferTo]
8002
8008
  * @param {Array<string>} [dependencyId]
8003
8009
  * @param {Array<string>} [tags]
8010
+ * @param {Array<string>} [amdResult]
8004
8011
  * @param {*} [options] Override http request option.
8005
8012
  * @throws {RequiredError}
8006
8013
  * @memberof CallServiceApi
8007
8014
  */
8008
- searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, options) {
8015
+ searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, options) {
8009
8016
  return CallServiceApiFp(this.configuration)
8010
- .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, options)
8017
+ .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, options)
8011
8018
  .then((request) => request(this.axios, this.basePath));
8012
8019
  }
8013
8020
  /**
@@ -15162,11 +15169,10 @@ const QueueBucketServiceApiAxiosParamCreator = function (configuration) {
15162
15169
  * @summary DeleteQueueRouting
15163
15170
  * @param {string} queueId
15164
15171
  * @param {string} id
15165
- * @param {string} [domainId]
15166
15172
  * @param {*} [options] Override http request option.
15167
15173
  * @throws {RequiredError}
15168
15174
  */
15169
- deleteQueueBucket: async (queueId, id, domainId, options = {}) => {
15175
+ deleteQueueBucket: async (queueId, id, options = {}) => {
15170
15176
  // verify required parameter 'queueId' is not null or undefined
15171
15177
  if (queueId === null || queueId === undefined) {
15172
15178
  throw new RequiredError('queueId', 'Required parameter queueId was null or undefined when calling deleteQueueBucket.');
@@ -15197,9 +15203,68 @@ const QueueBucketServiceApiAxiosParamCreator = function (configuration) {
15197
15203
  : await configuration.apiKey;
15198
15204
  localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
15199
15205
  }
15200
- if (domainId !== undefined) {
15201
- localVarQueryParameter['domain_id'] = domainId;
15206
+ localVarUrlObj.query = {
15207
+ ...localVarUrlObj.query,
15208
+ ...localVarQueryParameter,
15209
+ ...options.query,
15210
+ };
15211
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
15212
+ delete localVarUrlObj.search;
15213
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
15214
+ localVarRequestOptions.headers = {
15215
+ ...localVarHeaderParameter,
15216
+ ...headersFromBaseOptions,
15217
+ ...options.headers,
15218
+ };
15219
+ return {
15220
+ url: format(localVarUrlObj),
15221
+ options: localVarRequestOptions,
15222
+ };
15223
+ },
15224
+ /**
15225
+ *
15226
+ * @param {string} queueId
15227
+ * @param {string} id
15228
+ * @param {EnginePatchQueueBucketRequest} body
15229
+ * @param {*} [options] Override http request option.
15230
+ * @throws {RequiredError}
15231
+ */
15232
+ patchQueueBucket: async (queueId, id, body, options = {}) => {
15233
+ // verify required parameter 'queueId' is not null or undefined
15234
+ if (queueId === null || queueId === undefined) {
15235
+ throw new RequiredError('queueId', 'Required parameter queueId was null or undefined when calling patchQueueBucket.');
15202
15236
  }
15237
+ // verify required parameter 'id' is not null or undefined
15238
+ if (id === null || id === undefined) {
15239
+ throw new RequiredError('id', 'Required parameter id was null or undefined when calling patchQueueBucket.');
15240
+ }
15241
+ // verify required parameter 'body' is not null or undefined
15242
+ if (body === null || body === undefined) {
15243
+ throw new RequiredError('body', 'Required parameter body was null or undefined when calling patchQueueBucket.');
15244
+ }
15245
+ const localVarPath = `/call_center/queues/{queue_id}/buckets/{id}`
15246
+ .replace(`{${'queue_id'}}`, encodeURIComponent(String(queueId)))
15247
+ .replace(`{${'id'}}`, encodeURIComponent(String(id)));
15248
+ const localVarUrlObj = parse(localVarPath, true);
15249
+ let baseOptions;
15250
+ if (configuration) {
15251
+ baseOptions = configuration.baseOptions;
15252
+ }
15253
+ const localVarRequestOptions = {
15254
+ method: 'PATCH',
15255
+ ...baseOptions,
15256
+ ...options,
15257
+ };
15258
+ const localVarHeaderParameter = {};
15259
+ const localVarQueryParameter = {};
15260
+ // authentication AccessToken required
15261
+ if (configuration && configuration.apiKey) {
15262
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
15263
+ ? await configuration.apiKey('X-Webitel-Access')
15264
+ : await configuration.apiKey;
15265
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
15266
+ }
15267
+ localVarHeaderParameter['Content-Type'] = 'application/json';
15203
15268
  localVarUrlObj.query = {
15204
15269
  ...localVarUrlObj.query,
15205
15270
  ...localVarQueryParameter,
@@ -15213,6 +15278,11 @@ const QueueBucketServiceApiAxiosParamCreator = function (configuration) {
15213
15278
  ...headersFromBaseOptions,
15214
15279
  ...options.headers,
15215
15280
  };
15281
+ const needsSerialization = typeof body !== 'string' ||
15282
+ localVarRequestOptions.headers['Content-Type'] === 'application/json';
15283
+ localVarRequestOptions.data = needsSerialization
15284
+ ? JSON.stringify(body !== undefined ? body : {})
15285
+ : body || '';
15216
15286
  return {
15217
15287
  url: format(localVarUrlObj),
15218
15288
  options: localVarRequestOptions,
@@ -15223,11 +15293,10 @@ const QueueBucketServiceApiAxiosParamCreator = function (configuration) {
15223
15293
  * @summary ReadQueueRouting
15224
15294
  * @param {string} queueId
15225
15295
  * @param {string} id
15226
- * @param {string} [domainId]
15227
15296
  * @param {*} [options] Override http request option.
15228
15297
  * @throws {RequiredError}
15229
15298
  */
15230
- readQueueBucket: async (queueId, id, domainId, options = {}) => {
15299
+ readQueueBucket: async (queueId, id, options = {}) => {
15231
15300
  // verify required parameter 'queueId' is not null or undefined
15232
15301
  if (queueId === null || queueId === undefined) {
15233
15302
  throw new RequiredError('queueId', 'Required parameter queueId was null or undefined when calling readQueueBucket.');
@@ -15258,9 +15327,6 @@ const QueueBucketServiceApiAxiosParamCreator = function (configuration) {
15258
15327
  : await configuration.apiKey;
15259
15328
  localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
15260
15329
  }
15261
- if (domainId !== undefined) {
15262
- localVarQueryParameter['domain_id'] = domainId;
15263
- }
15264
15330
  localVarUrlObj.query = {
15265
15331
  ...localVarUrlObj.query,
15266
15332
  ...localVarQueryParameter,
@@ -15452,12 +15518,29 @@ const QueueBucketServiceApiFp = function (configuration) {
15452
15518
  * @summary DeleteQueueRouting
15453
15519
  * @param {string} queueId
15454
15520
  * @param {string} id
15455
- * @param {string} [domainId]
15456
15521
  * @param {*} [options] Override http request option.
15457
15522
  * @throws {RequiredError}
15458
15523
  */
15459
- async deleteQueueBucket(queueId, id, domainId, options) {
15460
- const localVarAxiosArgs = await QueueBucketServiceApiAxiosParamCreator(configuration).deleteQueueBucket(queueId, id, domainId, options);
15524
+ async deleteQueueBucket(queueId, id, options) {
15525
+ const localVarAxiosArgs = await QueueBucketServiceApiAxiosParamCreator(configuration).deleteQueueBucket(queueId, id, options);
15526
+ return (axios = globalAxios, basePath = BASE_PATH) => {
15527
+ const axiosRequestArgs = {
15528
+ ...localVarAxiosArgs.options,
15529
+ url: basePath + localVarAxiosArgs.url,
15530
+ };
15531
+ return axios.request(axiosRequestArgs);
15532
+ };
15533
+ },
15534
+ /**
15535
+ *
15536
+ * @param {string} queueId
15537
+ * @param {string} id
15538
+ * @param {EnginePatchQueueBucketRequest} body
15539
+ * @param {*} [options] Override http request option.
15540
+ * @throws {RequiredError}
15541
+ */
15542
+ async patchQueueBucket(queueId, id, body, options) {
15543
+ const localVarAxiosArgs = await QueueBucketServiceApiAxiosParamCreator(configuration).patchQueueBucket(queueId, id, body, options);
15461
15544
  return (axios = globalAxios, basePath = BASE_PATH) => {
15462
15545
  const axiosRequestArgs = {
15463
15546
  ...localVarAxiosArgs.options,
@@ -15471,12 +15554,11 @@ const QueueBucketServiceApiFp = function (configuration) {
15471
15554
  * @summary ReadQueueRouting
15472
15555
  * @param {string} queueId
15473
15556
  * @param {string} id
15474
- * @param {string} [domainId]
15475
15557
  * @param {*} [options] Override http request option.
15476
15558
  * @throws {RequiredError}
15477
15559
  */
15478
- async readQueueBucket(queueId, id, domainId, options) {
15479
- const localVarAxiosArgs = await QueueBucketServiceApiAxiosParamCreator(configuration).readQueueBucket(queueId, id, domainId, options);
15560
+ async readQueueBucket(queueId, id, options) {
15561
+ const localVarAxiosArgs = await QueueBucketServiceApiAxiosParamCreator(configuration).readQueueBucket(queueId, id, options);
15480
15562
  return (axios = globalAxios, basePath = BASE_PATH) => {
15481
15563
  const axiosRequestArgs = {
15482
15564
  ...localVarAxiosArgs.options,
@@ -15553,13 +15635,25 @@ const QueueBucketServiceApiFactory = function (configuration, basePath, axios) {
15553
15635
  * @summary DeleteQueueRouting
15554
15636
  * @param {string} queueId
15555
15637
  * @param {string} id
15556
- * @param {string} [domainId]
15557
15638
  * @param {*} [options] Override http request option.
15558
15639
  * @throws {RequiredError}
15559
15640
  */
15560
- deleteQueueBucket(queueId, id, domainId, options) {
15641
+ deleteQueueBucket(queueId, id, options) {
15561
15642
  return QueueBucketServiceApiFp(configuration)
15562
- .deleteQueueBucket(queueId, id, domainId, options)
15643
+ .deleteQueueBucket(queueId, id, options)
15644
+ .then((request) => request(axios, basePath));
15645
+ },
15646
+ /**
15647
+ *
15648
+ * @param {string} queueId
15649
+ * @param {string} id
15650
+ * @param {EnginePatchQueueBucketRequest} body
15651
+ * @param {*} [options] Override http request option.
15652
+ * @throws {RequiredError}
15653
+ */
15654
+ patchQueueBucket(queueId, id, body, options) {
15655
+ return QueueBucketServiceApiFp(configuration)
15656
+ .patchQueueBucket(queueId, id, body, options)
15563
15657
  .then((request) => request(axios, basePath));
15564
15658
  },
15565
15659
  /**
@@ -15567,13 +15661,12 @@ const QueueBucketServiceApiFactory = function (configuration, basePath, axios) {
15567
15661
  * @summary ReadQueueRouting
15568
15662
  * @param {string} queueId
15569
15663
  * @param {string} id
15570
- * @param {string} [domainId]
15571
15664
  * @param {*} [options] Override http request option.
15572
15665
  * @throws {RequiredError}
15573
15666
  */
15574
- readQueueBucket(queueId, id, domainId, options) {
15667
+ readQueueBucket(queueId, id, options) {
15575
15668
  return QueueBucketServiceApiFp(configuration)
15576
- .readQueueBucket(queueId, id, domainId, options)
15669
+ .readQueueBucket(queueId, id, options)
15577
15670
  .then((request) => request(axios, basePath));
15578
15671
  },
15579
15672
  /**
@@ -15636,14 +15729,27 @@ class QueueBucketServiceApi extends BaseAPI {
15636
15729
  * @summary DeleteQueueRouting
15637
15730
  * @param {string} queueId
15638
15731
  * @param {string} id
15639
- * @param {string} [domainId]
15640
15732
  * @param {*} [options] Override http request option.
15641
15733
  * @throws {RequiredError}
15642
15734
  * @memberof QueueBucketServiceApi
15643
15735
  */
15644
- deleteQueueBucket(queueId, id, domainId, options) {
15736
+ deleteQueueBucket(queueId, id, options) {
15737
+ return QueueBucketServiceApiFp(this.configuration)
15738
+ .deleteQueueBucket(queueId, id, options)
15739
+ .then((request) => request(this.axios, this.basePath));
15740
+ }
15741
+ /**
15742
+ *
15743
+ * @param {string} queueId
15744
+ * @param {string} id
15745
+ * @param {EnginePatchQueueBucketRequest} body
15746
+ * @param {*} [options] Override http request option.
15747
+ * @throws {RequiredError}
15748
+ * @memberof QueueBucketServiceApi
15749
+ */
15750
+ patchQueueBucket(queueId, id, body, options) {
15645
15751
  return QueueBucketServiceApiFp(this.configuration)
15646
- .deleteQueueBucket(queueId, id, domainId, options)
15752
+ .patchQueueBucket(queueId, id, body, options)
15647
15753
  .then((request) => request(this.axios, this.basePath));
15648
15754
  }
15649
15755
  /**
@@ -15651,14 +15757,13 @@ class QueueBucketServiceApi extends BaseAPI {
15651
15757
  * @summary ReadQueueRouting
15652
15758
  * @param {string} queueId
15653
15759
  * @param {string} id
15654
- * @param {string} [domainId]
15655
15760
  * @param {*} [options] Override http request option.
15656
15761
  * @throws {RequiredError}
15657
15762
  * @memberof QueueBucketServiceApi
15658
15763
  */
15659
- readQueueBucket(queueId, id, domainId, options) {
15764
+ readQueueBucket(queueId, id, options) {
15660
15765
  return QueueBucketServiceApiFp(this.configuration)
15661
- .readQueueBucket(queueId, id, domainId, options)
15766
+ .readQueueBucket(queueId, id, options)
15662
15767
  .then((request) => request(this.axios, this.basePath));
15663
15768
  }
15664
15769
  /**
@@ -22158,6 +22263,7 @@ class SipPhone extends EventEmitter {
22158
22263
  }
22159
22264
  async unregister() {
22160
22265
  if (this.ua) {
22266
+ this.ua.terminateSessions();
22161
22267
  this.ua.removeAllListeners();
22162
22268
  await this.ua.stop();
22163
22269
  delete this.ua;
@@ -22324,6 +22430,7 @@ class Task {
22324
22430
  this.offeringAt = 0;
22325
22431
  this.answeredAt = 0;
22326
22432
  this.bridgedAt = 0;
22433
+ this.reportedAt = 0;
22327
22434
  this.startProcessingAt = 0;
22328
22435
  this.stopAt = 0;
22329
22436
  this.closedAt = 0;
@@ -22382,7 +22489,7 @@ class Task {
22382
22489
  this.startProcessingAt = Date.now();
22383
22490
  }
22384
22491
  if (p.sec) {
22385
- p.timeout = Date.now() + p.sec * 1000; // bug
22492
+ p.timeout = this.startProcessingAt + p.sec * 1000; // bug
22386
22493
  }
22387
22494
  this._processing = p;
22388
22495
  }
@@ -22434,10 +22541,12 @@ class Task {
22434
22541
  });
22435
22542
  }
22436
22543
  async reporting(reporting) {
22437
- return this.client.request('cc_reporting', {
22544
+ const res = await this.client.request('cc_reporting', {
22438
22545
  attempt_id: this.id,
22439
22546
  ...reporting,
22440
22547
  });
22548
+ this.reportedAt = Date.now();
22549
+ return res;
22441
22550
  }
22442
22551
  async renew(sec) {
22443
22552
  return this.client.request('cc_renewal', {
@@ -23387,6 +23496,7 @@ const API_HEADER_TOKEN = 'X-Webitel-Access';
23387
23496
  const WEBSOCKET_AUTHENTICATION_CHALLENGE = 'authentication_challenge';
23388
23497
  const WEBSOCKET_DEFAULT_DEVICE_CONFIG = 'user_default_device';
23389
23498
  const WEBSOCKET_AGENT_SESSION = 'cc_agent_session';
23499
+ const WEBSOCKET_PING = 'ping';
23390
23500
  // const WEBSOCKET_CALL_BY_USER = 'call_by_user'
23391
23501
  const WEBSOCKET_MAKE_OUTBOUND_CALL = 'call_invite';
23392
23502
  const WEBSOCKET_MAKE_USER_CALL = 'call_user';
@@ -23413,6 +23523,7 @@ class Client extends EventEmitter {
23413
23523
  this.eventHandler = new EventEmitter();
23414
23524
  this.callStore = new Map();
23415
23525
  this.conversationStore = new Map();
23526
+ this.pingTimer = null;
23416
23527
  this.basePath = `${formatBaseUri(_config.storageEndpoint || _config.endpoint)}`;
23417
23528
  }
23418
23529
  async connect() {
@@ -23456,7 +23567,7 @@ class Client extends EventEmitter {
23456
23567
  call.answeredAt = c.answered_at || 0;
23457
23568
  call.bridgedAt = c.bridged_at || 0;
23458
23569
  call.hangupAt = c.hangup_at || 0;
23459
- call.reportingAt = c.reporting_at || 0;
23570
+ // call.reportingAt = c.reporting_at || 0
23460
23571
  if (c.task) {
23461
23572
  call.task = new Task(this, {
23462
23573
  attempt_id: c.task.attempt_id,
@@ -23466,6 +23577,14 @@ class Client extends EventEmitter {
23466
23577
  }, c.task // todo add app_id
23467
23578
  );
23468
23579
  call.queue.reporting = 'true';
23580
+ if (c.leaving_at && c.task.processing_sec) {
23581
+ call.task.startProcessingAt = c.leaving_at;
23582
+ call.task.setProcessing({
23583
+ sec: c.task.processing_sec || 0,
23584
+ timeout: Date.now() - c.leaving_at + (c.task.processing_sec || 0) * 1000,
23585
+ renewal_sec: c.task.processing_renewal_sec || 0,
23586
+ });
23587
+ }
23469
23588
  }
23470
23589
  this.callStore.set(call.id, call);
23471
23590
  }
@@ -23481,6 +23600,26 @@ class Client extends EventEmitter {
23481
23600
  const messages = conv.messages.reverse();
23482
23601
  const c = new Conversation(this, conv.id, conv.title, conv.members, messages, conv.variables);
23483
23602
  c.createdAt = conv.created_at;
23603
+ c.closedAt = conv.closed_at;
23604
+ if (conv.task) {
23605
+ c.task = new Task(this, {
23606
+ attempt_id: conv.task.attempt_id,
23607
+ channel: conv.task.channel,
23608
+ status: conv.task.status,
23609
+ timestamp: Date.now(),
23610
+ }, conv.task // todo add app_id
23611
+ );
23612
+ if (conv.leaving_at && conv.task.processing_sec) {
23613
+ c.task.startProcessingAt = conv.leaving_at;
23614
+ c.task.setProcessing({
23615
+ sec: conv.task.processing_sec || 0,
23616
+ timeout: Date.now() -
23617
+ conv.leaving_at +
23618
+ (conv.task.processing_sec || 0) * 1000,
23619
+ renewal_sec: conv.task.processing_renewal_sec || 0,
23620
+ });
23621
+ }
23622
+ }
23484
23623
  if (conv.invite_id) {
23485
23624
  c.setInvite(conv.invite_id, conv.created_at);
23486
23625
  }
@@ -23575,6 +23714,11 @@ class Client extends EventEmitter {
23575
23714
  token: this._config.token,
23576
23715
  });
23577
23716
  }
23717
+ async ping() {
23718
+ return this.request(WEBSOCKET_PING, {
23719
+ ping: 1,
23720
+ });
23721
+ }
23578
23722
  sessionInfo() {
23579
23723
  return this.connectionInfo.session;
23580
23724
  }
@@ -23813,8 +23957,24 @@ class Client extends EventEmitter {
23813
23957
  this.eventHandler.emit(TASK_EVENT, e.status, task);
23814
23958
  }
23815
23959
  }
23960
+ async pingServer() {
23961
+ if (this.pingTimer && this.connectionInfo.ping_interval) {
23962
+ const t = setTimeout(async () => {
23963
+ this.socket.close(3005);
23964
+ }, +this.connectionInfo.ping_interval / 2);
23965
+ await this.ping();
23966
+ clearTimeout(t);
23967
+ }
23968
+ if (this.connectionInfo.ping_interval) {
23969
+ // @ts-ignore
23970
+ this.pingTimer = setTimeout(this.pingServer.bind(this), +this.connectionInfo.ping_interval);
23971
+ }
23972
+ }
23816
23973
  async connected(info) {
23817
23974
  this.connectionInfo = info;
23975
+ if (info.ping_interval) {
23976
+ await this.pingServer();
23977
+ }
23818
23978
  if (!this.useWebPhone()) {
23819
23979
  return;
23820
23980
  }
@@ -23861,6 +24021,9 @@ class Client extends EventEmitter {
23861
24021
  }
23862
24022
  this.socket.on('message', this.onMessage.bind(this));
23863
24023
  this.socket.on('close', (code) => {
24024
+ if (this.pingTimer) {
24025
+ clearTimeout(this.pingTimer);
24026
+ }
23864
24027
  this.log.error('socket close code: ', code);
23865
24028
  this.eventHandler.off('*');
23866
24029
  if (code !== 1000) {