webitel-sdk 26.4.30 → 26.4.32

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/index.cjs CHANGED
@@ -66185,6 +66185,11 @@ var Session$2 = class {
66185
66185
  }, 500);
66186
66186
  }
66187
66187
  };
66188
+ const DEFAULT_USER_AGENT = `webitel-web-phone-sdk/0.0.1`;
66189
+ const resolveUserAgent = (ua) => {
66190
+ var _ua$trim;
66191
+ return (_ua$trim = ua === null || ua === void 0 ? void 0 : ua.trim()) !== null && _ua$trim !== void 0 ? _ua$trim : DEFAULT_USER_AGENT;
66192
+ };
66188
66193
  //#endregion
66189
66194
  //#region src/sip/webrtc/index.ts
66190
66195
  const { debug, version: version$2, UA, WebSocketInterface } = jssip_lib_JsSIP_js.default;
@@ -66193,14 +66198,16 @@ function patchRemoteSdp(sdp) {
66193
66198
  sdp = sdp.replace(/(a=fmtp:\d+ [^\r\n]*packetization-mode[^\r\n]*)/g, "$1;x-google-start-bitrate=1500;x-google-min-bitrate=800;x-google-max-bitrate=3000");
66194
66199
  return sdp;
66195
66200
  }
66196
- var SipPhone = class SipPhone extends ee_ts.EventEmitter {
66197
- constructor(_instanceId, d, audioProcessing = {}) {
66201
+ var SipPhone = class extends ee_ts.EventEmitter {
66202
+ constructor(_instanceId, d, audioProcessing = {}, sipPhoneOptions = {}) {
66198
66203
  super();
66199
66204
  this.audioProcessing = audioProcessing;
66205
+ _defineProperty(this, "userAgent", void 0);
66200
66206
  _defineProperty(this, "type", "webrtc");
66201
66207
  _defineProperty(this, "ua", void 0);
66202
66208
  _defineProperty(this, "sessionCache", /* @__PURE__ */ new Map());
66203
66209
  _defineProperty(this, "log", void 0);
66210
+ this.userAgent = resolveUserAgent(sipPhoneOptions.userAgent);
66204
66211
  this.log = new Log();
66205
66212
  if (d) {
66206
66213
  this.log.info(`JsSip version: ${version$2}`);
@@ -66283,7 +66290,7 @@ var SipPhone = class SipPhone extends ee_ts.EventEmitter {
66283
66290
  uri: sipConf.uri,
66284
66291
  authorization_user: sipConf.authorization_user,
66285
66292
  ha1: sipConf.ha1,
66286
- user_agent: SipPhone.userAgent,
66293
+ user_agent: this.userAgent,
66287
66294
  sockets: [socket],
66288
66295
  session_timers: true,
66289
66296
  display_name: sipConf.display_name,
@@ -66441,7 +66448,6 @@ var SipPhone = class SipPhone extends ee_ts.EventEmitter {
66441
66448
  });
66442
66449
  }
66443
66450
  };
66444
- _defineProperty(SipPhone, "userAgent", `Webitel-Phone/${version$2}`);
66445
66451
  _defineProperty(SipPhone, "sipVersion", version$2);
66446
66452
  async function getMediaStream(constraints) {
66447
66453
  return new Promise((resolve, reject) => {
@@ -66728,7 +66734,7 @@ _defineProperty(SipPhone$1, "userAgent", `Webitel-Phone/${version$1}`);
66728
66734
  _defineProperty(SipPhone$1, "sipVersion", version$1);
66729
66735
  //#endregion
66730
66736
  //#region src/version.ts
66731
- const version = "26.4.30";
66737
+ const version = "26.4.32";
66732
66738
  //#endregion
66733
66739
  //#region src/socket/errors.ts
66734
66740
  /**
@@ -67276,6 +67282,12 @@ var Task = class {
67276
67282
  get hasReporting() {
67277
67283
  return this.distribute.has_reporting;
67278
67284
  }
67285
+ get memberJoinedAt() {
67286
+ return this.distribute.member_joined_at;
67287
+ }
67288
+ get queueMaxWaitTime() {
67289
+ return this.distribute.queue_max_wait_time;
67290
+ }
67279
67291
  /**
67280
67292
  * Чи дозволено звітування.
67281
67293
  * @returns {boolean}
@@ -70042,6 +70054,11 @@ var Socket = class extends ee_ts.EventEmitter {
70042
70054
  * @param code Код закриття з'єднання (необов'язково).
70043
70055
  */
70044
70056
  close(code) {
70057
+ if (!this.socket) {
70058
+ const stackTrace = (/* @__PURE__ */ new Error("Socket is not open")).stack;
70059
+ console.warn(`Socket is not open\n`, stackTrace);
70060
+ return;
70061
+ }
70045
70062
  this.socket.close(code || 1e3);
70046
70063
  delete this.socket;
70047
70064
  this.onClose(code || 1e3);
@@ -70343,6 +70360,7 @@ var Client = class extends ee_ts.EventEmitter {
70343
70360
  _defineProperty(this, "pingTimer", void 0);
70344
70361
  _defineProperty(this, "toneTimer", void 0);
70345
70362
  _defineProperty(this, "screenResolver", void 0);
70363
+ _defineProperty(this, "userAgent", void 0);
70346
70364
  this.log = new Log(_config.logLvl);
70347
70365
  this.eventHandler = new ee_ts.EventEmitter();
70348
70366
  this.callStore = /* @__PURE__ */ new Map();
@@ -70355,6 +70373,7 @@ var Client = class extends ee_ts.EventEmitter {
70355
70373
  this.lastError = null;
70356
70374
  this.lastLatency = null;
70357
70375
  this.screenResolver = _config.screenResolver || null;
70376
+ this.userAgent = _config.userAgent || `webitel-web-phone-sdk.${this.buildVersion}`;
70358
70377
  }
70359
70378
  async connect() {
70360
70379
  await this.connectToSocket();
@@ -71055,7 +71074,8 @@ var Client = class extends ee_ts.EventEmitter {
71055
71074
  noiseSuppression: this._config.noiseSuppression,
71056
71075
  autoGainControl: this._config.autoGainControl
71057
71076
  };
71058
- return this.registerCallClient(this.connectionInfo.b2bua ? new SipPhone$1(this, audioProcessing) : new SipPhone(this.instanceId, this._config.debug, audioProcessing));
71077
+ const sipOptions = { userAgent: this.userAgent };
71078
+ return this.registerCallClient(this.connectionInfo.b2bua ? new SipPhone$1(this, audioProcessing) : new SipPhone(this.instanceId, this._config.debug, audioProcessing, sipOptions));
71059
71079
  }
71060
71080
  async latency() {
71061
71081
  const ack = {