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
@@ -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
  /**
@@ -22158,6 +22165,7 @@ class SipPhone extends EventEmitter {
22158
22165
  }
22159
22166
  async unregister() {
22160
22167
  if (this.ua) {
22168
+ this.ua.ua.terminateSessions();
22161
22169
  this.ua.removeAllListeners();
22162
22170
  await this.ua.stop();
22163
22171
  delete this.ua;
@@ -23387,6 +23395,7 @@ const API_HEADER_TOKEN = 'X-Webitel-Access';
23387
23395
  const WEBSOCKET_AUTHENTICATION_CHALLENGE = 'authentication_challenge';
23388
23396
  const WEBSOCKET_DEFAULT_DEVICE_CONFIG = 'user_default_device';
23389
23397
  const WEBSOCKET_AGENT_SESSION = 'cc_agent_session';
23398
+ const WEBSOCKET_PING = 'ping';
23390
23399
  // const WEBSOCKET_CALL_BY_USER = 'call_by_user'
23391
23400
  const WEBSOCKET_MAKE_OUTBOUND_CALL = 'call_invite';
23392
23401
  const WEBSOCKET_MAKE_USER_CALL = 'call_user';
@@ -23413,6 +23422,7 @@ class Client extends EventEmitter {
23413
23422
  this.eventHandler = new EventEmitter();
23414
23423
  this.callStore = new Map();
23415
23424
  this.conversationStore = new Map();
23425
+ this.pingTimer = null;
23416
23426
  this.basePath = `${formatBaseUri(_config.storageEndpoint || _config.endpoint)}`;
23417
23427
  }
23418
23428
  async connect() {
@@ -23575,6 +23585,11 @@ class Client extends EventEmitter {
23575
23585
  token: this._config.token,
23576
23586
  });
23577
23587
  }
23588
+ async ping() {
23589
+ return this.request(WEBSOCKET_PING, {
23590
+ ping: 1,
23591
+ });
23592
+ }
23578
23593
  sessionInfo() {
23579
23594
  return this.connectionInfo.session;
23580
23595
  }
@@ -23813,8 +23828,24 @@ class Client extends EventEmitter {
23813
23828
  this.eventHandler.emit(TASK_EVENT, e.status, task);
23814
23829
  }
23815
23830
  }
23831
+ async pingServer() {
23832
+ if (this.pingTimer && this.connectionInfo.ping_interval) {
23833
+ const t = setTimeout(async () => {
23834
+ this.socket.close(3005);
23835
+ }, +this.connectionInfo.ping_interval / 2);
23836
+ await this.ping();
23837
+ clearTimeout(t);
23838
+ }
23839
+ if (this.connectionInfo.ping_interval) {
23840
+ // @ts-ignore
23841
+ this.pingTimer = setTimeout(this.pingServer.bind(this), +this.connectionInfo.ping_interval);
23842
+ }
23843
+ }
23816
23844
  async connected(info) {
23817
23845
  this.connectionInfo = info;
23846
+ if (info.ping_interval) {
23847
+ await this.pingServer();
23848
+ }
23818
23849
  if (!this.useWebPhone()) {
23819
23850
  return;
23820
23851
  }
@@ -23861,6 +23892,9 @@ class Client extends EventEmitter {
23861
23892
  }
23862
23893
  this.socket.on('message', this.onMessage.bind(this));
23863
23894
  this.socket.on('close', (code) => {
23895
+ if (this.pingTimer) {
23896
+ clearTimeout(this.pingTimer);
23897
+ }
23864
23898
  this.log.error('socket close code: ', code);
23865
23899
  this.eventHandler.off('*');
23866
23900
  if (code !== 1000) {