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.mjs CHANGED
@@ -66160,6 +66160,11 @@ var Session$2 = class {
66160
66160
  }, 500);
66161
66161
  }
66162
66162
  };
66163
+ const DEFAULT_USER_AGENT = `webitel-web-phone-sdk/0.0.1`;
66164
+ const resolveUserAgent = (ua) => {
66165
+ var _ua$trim;
66166
+ return (_ua$trim = ua === null || ua === void 0 ? void 0 : ua.trim()) !== null && _ua$trim !== void 0 ? _ua$trim : DEFAULT_USER_AGENT;
66167
+ };
66163
66168
  //#endregion
66164
66169
  //#region src/sip/webrtc/index.ts
66165
66170
  const { debug, version: version$2, UA, WebSocketInterface } = JsSIP;
@@ -66168,14 +66173,16 @@ function patchRemoteSdp(sdp) {
66168
66173
  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");
66169
66174
  return sdp;
66170
66175
  }
66171
- var SipPhone = class SipPhone extends EventEmitter {
66172
- constructor(_instanceId, d, audioProcessing = {}) {
66176
+ var SipPhone = class extends EventEmitter {
66177
+ constructor(_instanceId, d, audioProcessing = {}, sipPhoneOptions = {}) {
66173
66178
  super();
66174
66179
  this.audioProcessing = audioProcessing;
66180
+ _defineProperty(this, "userAgent", void 0);
66175
66181
  _defineProperty(this, "type", "webrtc");
66176
66182
  _defineProperty(this, "ua", void 0);
66177
66183
  _defineProperty(this, "sessionCache", /* @__PURE__ */ new Map());
66178
66184
  _defineProperty(this, "log", void 0);
66185
+ this.userAgent = resolveUserAgent(sipPhoneOptions.userAgent);
66179
66186
  this.log = new Log();
66180
66187
  if (d) {
66181
66188
  this.log.info(`JsSip version: ${version$2}`);
@@ -66258,7 +66265,7 @@ var SipPhone = class SipPhone extends EventEmitter {
66258
66265
  uri: sipConf.uri,
66259
66266
  authorization_user: sipConf.authorization_user,
66260
66267
  ha1: sipConf.ha1,
66261
- user_agent: SipPhone.userAgent,
66268
+ user_agent: this.userAgent,
66262
66269
  sockets: [socket],
66263
66270
  session_timers: true,
66264
66271
  display_name: sipConf.display_name,
@@ -66416,7 +66423,6 @@ var SipPhone = class SipPhone extends EventEmitter {
66416
66423
  });
66417
66424
  }
66418
66425
  };
66419
- _defineProperty(SipPhone, "userAgent", `Webitel-Phone/${version$2}`);
66420
66426
  _defineProperty(SipPhone, "sipVersion", version$2);
66421
66427
  async function getMediaStream(constraints) {
66422
66428
  return new Promise((resolve, reject) => {
@@ -66703,7 +66709,7 @@ _defineProperty(SipPhone$1, "userAgent", `Webitel-Phone/${version$1}`);
66703
66709
  _defineProperty(SipPhone$1, "sipVersion", version$1);
66704
66710
  //#endregion
66705
66711
  //#region src/version.ts
66706
- const version = "26.4.30";
66712
+ const version = "26.4.32";
66707
66713
  //#endregion
66708
66714
  //#region src/socket/errors.ts
66709
66715
  /**
@@ -67251,6 +67257,12 @@ var Task = class {
67251
67257
  get hasReporting() {
67252
67258
  return this.distribute.has_reporting;
67253
67259
  }
67260
+ get memberJoinedAt() {
67261
+ return this.distribute.member_joined_at;
67262
+ }
67263
+ get queueMaxWaitTime() {
67264
+ return this.distribute.queue_max_wait_time;
67265
+ }
67254
67266
  /**
67255
67267
  * Чи дозволено звітування.
67256
67268
  * @returns {boolean}
@@ -70017,6 +70029,11 @@ var Socket = class extends EventEmitter {
70017
70029
  * @param code Код закриття з'єднання (необов'язково).
70018
70030
  */
70019
70031
  close(code) {
70032
+ if (!this.socket) {
70033
+ const stackTrace = (/* @__PURE__ */ new Error("Socket is not open")).stack;
70034
+ console.warn(`Socket is not open\n`, stackTrace);
70035
+ return;
70036
+ }
70020
70037
  this.socket.close(code || 1e3);
70021
70038
  delete this.socket;
70022
70039
  this.onClose(code || 1e3);
@@ -70318,6 +70335,7 @@ var Client = class extends EventEmitter {
70318
70335
  _defineProperty(this, "pingTimer", void 0);
70319
70336
  _defineProperty(this, "toneTimer", void 0);
70320
70337
  _defineProperty(this, "screenResolver", void 0);
70338
+ _defineProperty(this, "userAgent", void 0);
70321
70339
  this.log = new Log(_config.logLvl);
70322
70340
  this.eventHandler = new EventEmitter();
70323
70341
  this.callStore = /* @__PURE__ */ new Map();
@@ -70330,6 +70348,7 @@ var Client = class extends EventEmitter {
70330
70348
  this.lastError = null;
70331
70349
  this.lastLatency = null;
70332
70350
  this.screenResolver = _config.screenResolver || null;
70351
+ this.userAgent = _config.userAgent || `webitel-web-phone-sdk.${this.buildVersion}`;
70333
70352
  }
70334
70353
  async connect() {
70335
70354
  await this.connectToSocket();
@@ -71030,7 +71049,8 @@ var Client = class extends EventEmitter {
71030
71049
  noiseSuppression: this._config.noiseSuppression,
71031
71050
  autoGainControl: this._config.autoGainControl
71032
71051
  };
71033
- return this.registerCallClient(this.connectionInfo.b2bua ? new SipPhone$1(this, audioProcessing) : new SipPhone(this.instanceId, this._config.debug, audioProcessing));
71052
+ const sipOptions = { userAgent: this.userAgent };
71053
+ return this.registerCallClient(this.connectionInfo.b2bua ? new SipPhone$1(this, audioProcessing) : new SipPhone(this.instanceId, this._config.debug, audioProcessing, sipOptions));
71034
71054
  }
71035
71055
  async latency() {
71036
71056
  const ack = {