webitel-sdk 0.1.88 → 0.1.89

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 (34) hide show
  1. package/bundles/index.esm.js +41 -7
  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 +71 -11
  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/sip/webrtc/index.js +1 -0
  12. package/esm2015/sip/webrtc/index.js.map +1 -1
  13. package/esm2015/socket/client.js +26 -0
  14. package/esm2015/socket/client.js.map +1 -1
  15. package/esm5/api/call-service-api.js +14 -7
  16. package/esm5/api/call-service-api.js.map +1 -1
  17. package/esm5/sip/webrtc/index.js +1 -0
  18. package/esm5/sip/webrtc/index.js.map +1 -1
  19. package/esm5/socket/client.js +56 -4
  20. package/esm5/socket/client.js.map +1 -1
  21. package/package.json +1 -1
  22. package/types/api/call-service-api.d.ts +8 -4
  23. package/types/api/call-service-api.d.ts.map +1 -1
  24. package/types/api/engine-attempt-callback-request.d.ts +6 -0
  25. package/types/api/engine-attempt-callback-request.d.ts.map +1 -1
  26. package/types/api/engine-attempt-result-request.d.ts +6 -0
  27. package/types/api/engine-attempt-result-request.d.ts.map +1 -1
  28. package/types/api/engine-member-communication-create-request.d.ts +6 -0
  29. package/types/api/engine-member-communication-create-request.d.ts.map +1 -1
  30. package/types/api/engine-member-communication.d.ts +6 -0
  31. package/types/api/engine-member-communication.d.ts.map +1 -1
  32. package/types/sip/webrtc/index.d.ts.map +1 -1
  33. package/types/socket/client.d.ts +4 -0
  34. package/types/socket/client.d.ts.map +1 -1
@@ -7767,10 +7767,11 @@
7767
7767
  * @param {Array<string>} [transferTo]
7768
7768
  * @param {Array<string>} [dependencyId]
7769
7769
  * @param {Array<string>} [tags]
7770
+ * @param {Array<string>} [amdResult]
7770
7771
  * @param {*} [options] Override http request option.
7771
7772
  * @throws {RequiredError}
7772
7773
  */
7773
- searchHistoryCall: function (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) {
7774
+ searchHistoryCall: function (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) {
7774
7775
  if (options === void 0) { options = {}; }
7775
7776
  return tslib.__awaiter(_this, void 0, void 0, function () {
7776
7777
  var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions;
@@ -7896,6 +7897,9 @@
7896
7897
  if (tags) {
7897
7898
  localVarQueryParameter['tags'] = tags;
7898
7899
  }
7900
+ if (amdResult) {
7901
+ localVarQueryParameter['amd_result'] = amdResult;
7902
+ }
7899
7903
  localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
7900
7904
  // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
7901
7905
  delete localVarUrlObj.search;
@@ -8389,15 +8393,16 @@
8389
8393
  * @param {Array<string>} [transferTo]
8390
8394
  * @param {Array<string>} [dependencyId]
8391
8395
  * @param {Array<string>} [tags]
8396
+ * @param {Array<string>} [amdResult]
8392
8397
  * @param {*} [options] Override http request option.
8393
8398
  * @throws {RequiredError}
8394
8399
  */
8395
- searchHistoryCall: function (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) {
8400
+ searchHistoryCall: function (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) {
8396
8401
  return tslib.__awaiter(this, void 0, void 0, function () {
8397
8402
  var localVarAxiosArgs;
8398
8403
  return tslib.__generator(this, function (_a) {
8399
8404
  switch (_a.label) {
8400
- case 0: return [4 /*yield*/, 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)];
8405
+ case 0: return [4 /*yield*/, 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)];
8401
8406
  case 1:
8402
8407
  localVarAxiosArgs = _a.sent();
8403
8408
  return [2 /*return*/, function (axios, basePath) {
@@ -8663,12 +8668,13 @@
8663
8668
  * @param {Array<string>} [transferTo]
8664
8669
  * @param {Array<string>} [dependencyId]
8665
8670
  * @param {Array<string>} [tags]
8671
+ * @param {Array<string>} [amdResult]
8666
8672
  * @param {*} [options] Override http request option.
8667
8673
  * @throws {RequiredError}
8668
8674
  */
8669
- searchHistoryCall: function (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) {
8675
+ searchHistoryCall: function (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) {
8670
8676
  return CallServiceApiFp(configuration)
8671
- .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)
8677
+ .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)
8672
8678
  .then(function (request) { return request(axios, basePath); });
8673
8679
  },
8674
8680
  /**
@@ -8925,14 +8931,15 @@
8925
8931
  * @param {Array<string>} [transferTo]
8926
8932
  * @param {Array<string>} [dependencyId]
8927
8933
  * @param {Array<string>} [tags]
8934
+ * @param {Array<string>} [amdResult]
8928
8935
  * @param {*} [options] Override http request option.
8929
8936
  * @throws {RequiredError}
8930
8937
  * @memberof CallServiceApi
8931
8938
  */
8932
- CallServiceApi.prototype.searchHistoryCall = function (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) {
8939
+ CallServiceApi.prototype.searchHistoryCall = function (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) {
8933
8940
  var _this = this;
8934
8941
  return CallServiceApiFp(this.configuration)
8935
- .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)
8942
+ .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)
8936
8943
  .then(function (request) { return request(_this.axios, _this.basePath); });
8937
8944
  };
8938
8945
  /**
@@ -24826,6 +24833,7 @@
24826
24833
  switch (_a.label) {
24827
24834
  case 0:
24828
24835
  if (!this.ua) return [3 /*break*/, 2];
24836
+ this.ua.ua.terminateSessions();
24829
24837
  this.ua.removeAllListeners();
24830
24838
  return [4 /*yield*/, this.ua.stop()];
24831
24839
  case 1:
@@ -26512,6 +26520,7 @@
26512
26520
  var WEBSOCKET_AUTHENTICATION_CHALLENGE = 'authentication_challenge';
26513
26521
  var WEBSOCKET_DEFAULT_DEVICE_CONFIG = 'user_default_device';
26514
26522
  var WEBSOCKET_AGENT_SESSION = 'cc_agent_session';
26523
+ var WEBSOCKET_PING = 'ping';
26515
26524
  // const WEBSOCKET_CALL_BY_USER = 'call_by_user'
26516
26525
  var WEBSOCKET_MAKE_OUTBOUND_CALL = 'call_invite';
26517
26526
  var WEBSOCKET_MAKE_USER_CALL = 'call_user';
@@ -26538,6 +26547,7 @@
26538
26547
  _this.eventHandler = new eeTs.EventEmitter();
26539
26548
  _this.callStore = new Map();
26540
26549
  _this.conversationStore = new Map();
26550
+ _this.pingTimer = null;
26541
26551
  _this.basePath = "" + formatBaseUri(_config.storageEndpoint || _config.endpoint);
26542
26552
  return _this;
26543
26553
  }
@@ -26787,6 +26797,15 @@
26787
26797
  });
26788
26798
  });
26789
26799
  };
26800
+ Client.prototype.ping = function () {
26801
+ return tslib.__awaiter(this, void 0, void 0, function () {
26802
+ return tslib.__generator(this, function (_a) {
26803
+ return [2 /*return*/, this.request(WEBSOCKET_PING, {
26804
+ ping: 1,
26805
+ })];
26806
+ });
26807
+ });
26808
+ };
26790
26809
  Client.prototype.sessionInfo = function () {
26791
26810
  return this.connectionInfo.session;
26792
26811
  };
@@ -27147,14 +27166,52 @@
27147
27166
  this.eventHandler.emit(TASK_EVENT, e.status, task);
27148
27167
  }
27149
27168
  };
27169
+ Client.prototype.pingServer = function () {
27170
+ return tslib.__awaiter(this, void 0, void 0, function () {
27171
+ var t;
27172
+ var _this = this;
27173
+ return tslib.__generator(this, function (_a) {
27174
+ switch (_a.label) {
27175
+ case 0:
27176
+ if (!(this.pingTimer && this.connectionInfo.ping_interval)) return [3 /*break*/, 2];
27177
+ t = setTimeout(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
27178
+ return tslib.__generator(this, function (_a) {
27179
+ this.socket.close(3005);
27180
+ return [2 /*return*/];
27181
+ });
27182
+ }); }, +this.connectionInfo.ping_interval / 2);
27183
+ return [4 /*yield*/, this.ping()];
27184
+ case 1:
27185
+ _a.sent();
27186
+ clearTimeout(t);
27187
+ _a.label = 2;
27188
+ case 2:
27189
+ if (this.connectionInfo.ping_interval) {
27190
+ // @ts-ignore
27191
+ this.pingTimer = setTimeout(this.pingServer.bind(this), +this.connectionInfo.ping_interval);
27192
+ }
27193
+ return [2 /*return*/];
27194
+ }
27195
+ });
27196
+ });
27197
+ };
27150
27198
  Client.prototype.connected = function (info) {
27151
27199
  return tslib.__awaiter(this, void 0, void 0, function () {
27152
27200
  return tslib.__generator(this, function (_a) {
27153
- this.connectionInfo = info;
27154
- if (!this.useWebPhone()) {
27155
- return [2 /*return*/];
27201
+ switch (_a.label) {
27202
+ case 0:
27203
+ this.connectionInfo = info;
27204
+ if (!info.ping_interval) return [3 /*break*/, 2];
27205
+ return [4 /*yield*/, this.pingServer()];
27206
+ case 1:
27207
+ _a.sent();
27208
+ _a.label = 2;
27209
+ case 2:
27210
+ if (!this.useWebPhone()) {
27211
+ return [2 /*return*/];
27212
+ }
27213
+ return [2 /*return*/, this.registerCallClient(new SipPhone(this.instanceId, this._config.debug))];
27156
27214
  }
27157
- return [2 /*return*/, this.registerCallClient(new SipPhone(this.instanceId, this._config.debug))];
27158
27215
  });
27159
27216
  });
27160
27217
  };
@@ -27206,6 +27263,9 @@
27206
27263
  }
27207
27264
  _this.socket.on('message', _this.onMessage.bind(_this));
27208
27265
  _this.socket.on('close', function (code) {
27266
+ if (_this.pingTimer) {
27267
+ clearTimeout(_this.pingTimer);
27268
+ }
27209
27269
  _this.log.error('socket close code: ', code);
27210
27270
  _this.eventHandler.off('*');
27211
27271
  if (code !== 1000) {