sip-connector 28.10.0 → 28.10.1

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.
@@ -725,8 +725,27 @@ class ss {
725
725
  );
726
726
  }
727
727
  }
728
- const F = I("AutoConnectorManager: AutoConnectorRuntime"), rs = 3e3, is = 15e3;
729
- class as {
728
+ const K = {
729
+ START: "start",
730
+ MANUAL_RESTART: "manual-restart",
731
+ REGISTRATION_FAILED_OUT_OF_CALL: "registration-failed-out-of-call",
732
+ TELEPHONY_DISCONNECTED: "telephony-disconnected",
733
+ TELEPHONY_CHECK_FAILED: "telephony-check-failed",
734
+ /** Порог неуспешных периодических SIP OPTIONS (`PingServerRequester`) в `connectedMonitoring`. */
735
+ PERIODIC_PING_FAILED: "periodic-ping-failed",
736
+ NETWORK_ONLINE: "network-online",
737
+ NETWORK_CHANGE: "network-change"
738
+ }, rs = {
739
+ [K.START]: 0,
740
+ [K.TELEPHONY_DISCONNECTED]: 1,
741
+ [K.TELEPHONY_CHECK_FAILED]: 1,
742
+ [K.PERIODIC_PING_FAILED]: 2,
743
+ [K.REGISTRATION_FAILED_OUT_OF_CALL]: 3,
744
+ [K.MANUAL_RESTART]: 4,
745
+ [K.NETWORK_ONLINE]: 4,
746
+ [K.NETWORK_CHANGE]: 4
747
+ }, et = (t) => rs[t], F = I("AutoConnectorManager: AutoConnectorRuntime"), is = 3e3, as = 15e3;
748
+ class os {
730
749
  connectionManager;
731
750
  connectionQueueManager;
732
751
  checkTelephonyRequester;
@@ -740,14 +759,14 @@ class as {
740
759
  constructor(e) {
741
760
  this.connectionManager = e.connectionManager, this.connectionQueueManager = e.connectionQueueManager, this.emitters = e.emitters, this.reconnectActions = e.reconnectActions, this.checkTelephonyRequester = new Jn({
742
761
  connectionManager: this.connectionManager,
743
- interval: e.options?.checkTelephonyRequestInterval ?? is
762
+ interval: e.options?.checkTelephonyRequestInterval ?? as
744
763
  }), this.pingServerRequester = new Zn({
745
764
  connectionManager: this.connectionManager
746
765
  }), this.registrationFailedOutOfCallSubscriber = new ts({
747
766
  connectionManager: this.connectionManager,
748
767
  callManager: e.callManager
749
768
  }), this.delayBetweenAttempts = new Ot(
750
- e.options?.timeoutBetweenAttempts ?? rs
769
+ e.options?.timeoutBetweenAttempts ?? is
751
770
  ), this.telephonyFailPolicy = new ss(e.options?.telephonyFailPolicy), this.attemptsState = new zn({
752
771
  onStatusChange: this.emitters.emitStatusChange
753
772
  });
@@ -837,7 +856,7 @@ class as {
837
856
  subscribeToConnectTriggers(e) {
838
857
  this.pingServerRequester.start({
839
858
  onFailRequest: () => {
840
- F("pingRequester: onFailRequest");
859
+ F("pingRequester: onFailRequest"), this.reconnectActions.requestReconnect(e, K.PERIODIC_PING_FAILED);
841
860
  }
842
861
  }), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
843
862
  F("registrationFailedOutOfCallListener callback"), this.reconnectActions.requestReconnect(e, "registration-failed-out-of-call");
@@ -895,14 +914,14 @@ class te {
895
914
  return this.subscriptions.push(n), n;
896
915
  }
897
916
  }
898
- const Gt = "Not ready for connection", os = (t) => t instanceof Error && t.message === Gt, cs = () => new Error(Gt), ls = async (t) => typeof t == "function" ? t() : t, ds = 3;
899
- class hs {
900
- resolveParametersRequester = new me(ls);
917
+ const Gt = "Not ready for connection", cs = (t) => t instanceof Error && t.message === Gt, ls = () => new Error(Gt), ds = async (t) => typeof t == "function" ? t() : t, hs = 3;
918
+ class us {
919
+ resolveParametersRequester = new me(ds);
901
920
  cancelableConnectWithRepeatedCalls;
902
921
  numberOfConnectionAttempts;
903
922
  dependencies;
904
923
  constructor(e, {
905
- numberOfConnectionAttempts: n = ds
924
+ numberOfConnectionAttempts: n = hs
906
925
  } = {}) {
907
926
  this.dependencies = e, this.numberOfConnectionAttempts = n, this.proxyEvents();
908
927
  }
@@ -967,7 +986,7 @@ class hs {
967
986
  extraHeaders: q = []
968
987
  }) => {
969
988
  this.dependencies.getUa() && await this.disconnect({ cancelRequests: !1 });
970
- const { ua: K, helpers: ne } = this.dependencies.uaFactory.createUAWithConfiguration(
989
+ const { ua: X, helpers: ne } = this.dependencies.uaFactory.createUAWithConfiguration(
971
990
  {
972
991
  user: e,
973
992
  password: n,
@@ -985,9 +1004,9 @@ class hs {
985
1004
  },
986
1005
  this.dependencies.events
987
1006
  );
988
- this.dependencies.setUa(K), this.dependencies.setGetUri(ne.getUri), this.dependencies.setSocket(ne.socket);
989
- const Me = K.configuration.uri.user;
990
- return { ua: K, configuration: {
1007
+ this.dependencies.setUa(X), this.dependencies.setGetUri(ne.getUri), this.dependencies.setSocket(ne.socket);
1008
+ const Me = X.configuration.uri.user;
1009
+ return { ua: X, configuration: {
991
1010
  sipServerIp: s,
992
1011
  sipServerUrl: r,
993
1012
  remoteAddress: i,
@@ -1036,7 +1055,7 @@ class hs {
1036
1055
  var l = /* @__PURE__ */ ((t) => (t.IDLE = "connection:idle", t.PREPARING = "connection:preparing", t.CONNECTING = "connection:connecting", t.CONNECTED = "connection:connected", t.REGISTERED = "connection:registered", t.ESTABLISHED = "connection:established", t.DISCONNECTING = "connection:disconnecting", t.DISCONNECTED = "connection:disconnected", t))(l || {}), N = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.SET_CONNECTION_CONFIGURATION = "setConnectionConfiguration", t.CLEAR_CONNECTION_CONFIGURATION = "clearConnectionConfiguration", t))(N || {}), m = /* @__PURE__ */ ((t) => (t.START_CONNECT = "START_CONNECT", t.START_UA = "START_UA", t.START_DISCONNECT = "START_DISCONNECT", t.UA_CONNECTED = "UA_CONNECTED", t.UA_CONNECTING = "UA_CONNECTING", t.UA_REGISTERED = "UA_REGISTERED", t.UA_UNREGISTERED = "UA_UNREGISTERED", t.UA_DISCONNECTED = "UA_DISCONNECTED", t.RESET = "RESET", t))(m || {});
1037
1056
  const kt = {
1038
1057
  connectionConfiguration: void 0
1039
- }, et = I("ConnectionManager: createConnectionMachineSetup"), us = () => ee({
1058
+ }, tt = I("ConnectionManager: createConnectionMachineSetup"), gs = () => ee({
1040
1059
  types: {
1041
1060
  context: kt,
1042
1061
  events: {}
@@ -1052,13 +1071,13 @@ const kt = {
1052
1071
  connectionConfiguration: void 0
1053
1072
  })),
1054
1073
  [N.LOG_TRANSITION]: (t, e) => {
1055
- et(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1074
+ tt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1056
1075
  },
1057
1076
  [N.LOG_STATE_CHANGE]: (t, e) => {
1058
- et("ConnectionStateMachine state changed", e.state);
1077
+ tt("ConnectionStateMachine state changed", e.state);
1059
1078
  }
1060
1079
  }
1061
- }), gs = () => us().createMachine({
1080
+ }), Es = () => gs().createMachine({
1062
1081
  id: "connection",
1063
1082
  initial: l.IDLE,
1064
1083
  context: kt,
@@ -1381,12 +1400,12 @@ const kt = {
1381
1400
  }
1382
1401
  }
1383
1402
  }
1384
- }), Es = gs(), ms = I("ConnectionManager: ConnectionStateMachine");
1385
- class Ts extends te {
1403
+ }), ms = Es(), Ts = I("ConnectionManager: ConnectionStateMachine");
1404
+ class ps extends te {
1386
1405
  events;
1387
1406
  unsubscribeFromEvents;
1388
1407
  constructor(e) {
1389
- super(Es), this.events = e, this.subscribeToEvents();
1408
+ super(ms), this.events = e, this.subscribeToEvents();
1390
1409
  }
1391
1410
  get isIdle() {
1392
1411
  return this.hasState(l.IDLE);
@@ -1448,7 +1467,7 @@ class Ts extends te {
1448
1467
  }
1449
1468
  sendEvent(e) {
1450
1469
  if (!this.actor.getSnapshot().can(e)) {
1451
- ms(
1470
+ Ts(
1452
1471
  `Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
1453
1472
  );
1454
1473
  return;
@@ -1492,7 +1511,7 @@ const Ft = [
1492
1511
  "registrationFailed",
1493
1512
  "newMessage",
1494
1513
  "sipEvent"
1495
- ], ps = [
1514
+ ], Ss = [
1496
1515
  "disconnecting",
1497
1516
  "connect-started",
1498
1517
  "connect-succeeded",
@@ -1500,8 +1519,8 @@ const Ft = [
1500
1519
  "connect-parameters-resolve-success",
1501
1520
  "connect-parameters-resolve-failed",
1502
1521
  "connected-with-configuration"
1503
- ], Ut = [...Ft, ...ps], Ss = () => new G(Ut), Cs = I("ConnectionManager: RegistrationManager");
1504
- class Rs {
1522
+ ], Ut = [...Ft, ...Ss], Cs = () => new G(Ut), Rs = I("ConnectionManager: RegistrationManager");
1523
+ class Ns {
1505
1524
  events;
1506
1525
  getUaProtected;
1507
1526
  constructor(e) {
@@ -1523,7 +1542,7 @@ class Rs {
1523
1542
  try {
1524
1543
  await this.unregister();
1525
1544
  } catch (e) {
1526
- Cs("tryRegister", e);
1545
+ Rs("tryRegister", e);
1527
1546
  }
1528
1547
  return this.register();
1529
1548
  }
@@ -1538,8 +1557,8 @@ class Rs {
1538
1557
  };
1539
1558
  }
1540
1559
  }
1541
- const Ns = 1e4;
1542
- class As {
1560
+ const As = 1e4;
1561
+ class Is {
1543
1562
  uaFactory;
1544
1563
  getUaProtected;
1545
1564
  constructor(e) {
@@ -1573,7 +1592,7 @@ class As {
1573
1592
  */
1574
1593
  async ping(e, n) {
1575
1594
  const r = this.getUaProtected().configuration.uri;
1576
- return this.sendOptions(r, e, n, Ns);
1595
+ return this.sendOptions(r, e, n, As);
1577
1596
  }
1578
1597
  /**
1579
1598
  * Проверяет доступность телефонии, создавая временное соединение
@@ -1606,10 +1625,10 @@ class As {
1606
1625
  });
1607
1626
  }
1608
1627
  }
1609
- function Is(t) {
1628
+ function fs(t) {
1610
1629
  return (e) => `sip:${e}@${t}`;
1611
1630
  }
1612
- const fs = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, vs = (t) => t.trim().replaceAll(" ", "_"), Ms = fs(1e5, 99999999), Os = (t) => {
1631
+ const vs = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, Ms = (t) => t.trim().replaceAll(" ", "_"), Os = vs(1e5, 99999999), _s = (t) => {
1613
1632
  const e = [];
1614
1633
  return t !== void 0 && t !== "" && e.push(`X-Vinteo-Remote: ${t}`), e;
1615
1634
  };
@@ -1638,10 +1657,10 @@ class oe {
1638
1657
  throw new Error("user is required for authorized connection");
1639
1658
  }
1640
1659
  static resolveAuthorizationUser(e, n) {
1641
- return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${Ms()}`;
1660
+ return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${Os()}`;
1642
1661
  }
1643
1662
  static buildExtraHeaders(e, n) {
1644
- const s = e !== void 0 && e !== "" ? Os(e) : [];
1663
+ const s = e !== void 0 && e !== "" ? _s(e) : [];
1645
1664
  return n === void 0 ? s : [...s, ...n];
1646
1665
  }
1647
1666
  createConfiguration({
@@ -1665,13 +1684,13 @@ class oe {
1665
1684
  sipServerIp: i,
1666
1685
  sipServerUrl: s
1667
1686
  });
1668
- const y = oe.resolveAuthorizationUser(a, e), _ = Is(i), q = _(y), B = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
1687
+ const y = oe.resolveAuthorizationUser(a, e), _ = fs(i), q = _(y), B = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
1669
1688
  return {
1670
1689
  configuration: {
1671
1690
  password: n,
1672
1691
  register: a,
1673
1692
  uri: q,
1674
- display_name: vs(r),
1693
+ display_name: Ms(r),
1675
1694
  user_agent: f,
1676
1695
  sockets: [B],
1677
1696
  session_timers: o,
@@ -1704,8 +1723,8 @@ class oe {
1704
1723
  }), { ua: i, helpers: r };
1705
1724
  }
1706
1725
  }
1707
- const _s = I("ConnectionManager");
1708
- class bs extends w {
1726
+ const bs = I("ConnectionManager");
1727
+ class ys extends w {
1709
1728
  stateMachine;
1710
1729
  ua;
1711
1730
  socket;
@@ -1716,13 +1735,13 @@ class bs extends w {
1716
1735
  constructor({ JsSIP: e }, {
1717
1736
  numberOfConnectionAttempts: n
1718
1737
  } = {}) {
1719
- super(Ss()), this.uaFactory = new oe(e), this.registrationManager = new Rs({
1738
+ super(Cs()), this.uaFactory = new oe(e), this.registrationManager = new Ns({
1720
1739
  events: this.events,
1721
1740
  getUaProtected: this.getUaProtected
1722
- }), this.stateMachine = new Ts(this.events), this.sipOperations = new As({
1741
+ }), this.stateMachine = new ps(this.events), this.sipOperations = new Is({
1723
1742
  uaFactory: this.uaFactory,
1724
1743
  getUaProtected: this.getUaProtected
1725
- }), this.connectionFlow = new hs(
1744
+ }), this.connectionFlow = new us(
1726
1745
  {
1727
1746
  events: this.events,
1728
1747
  uaFactory: this.uaFactory,
@@ -1770,7 +1789,7 @@ class bs extends w {
1770
1789
  return this.stateMachine.isRegisterEnabled();
1771
1790
  }
1772
1791
  connect = async (e, n) => this.disconnect().catch((s) => {
1773
- _s("connect: disconnect error", s);
1792
+ bs("connect: disconnect error", s);
1774
1793
  }).then(async () => this.connectWithProcessError(e, n));
1775
1794
  disconnect = async () => {
1776
1795
  if (this.isConfigured() || this.requested)
@@ -1810,7 +1829,7 @@ class bs extends w {
1810
1829
  getUa = () => this.ua;
1811
1830
  connectWithProcessError = async (e, n) => {
1812
1831
  if (!(n?.hasReadyForConnection?.() ?? !0))
1813
- throw cs();
1832
+ throw ls();
1814
1833
  return this.connectionFlow.connect(e, n).catch(async (r) => {
1815
1834
  const i = r;
1816
1835
  return this.disconnect().then(() => {
@@ -1821,7 +1840,7 @@ class bs extends w {
1821
1840
  });
1822
1841
  };
1823
1842
  }
1824
- class ys {
1843
+ class Ds {
1825
1844
  connectionManager;
1826
1845
  stackPromises = yt({
1827
1846
  noRunIsNotActual: !0
@@ -1838,7 +1857,7 @@ class ys {
1838
1857
  const z = (t) => {
1839
1858
  if (t !== null && typeof t == "object" && "error" in t)
1840
1859
  return t.error;
1841
- }, b = I("AutoConnectorManager: createAutoConnectorMachineSetup"), tt = (t) => t.parameters, Ds = (t) => ee({
1860
+ }, b = I("AutoConnectorManager: createAutoConnectorMachineSetup"), nt = (t) => t.parameters, Ps = (t) => ee({
1842
1861
  types: {
1843
1862
  context: {},
1844
1863
  events: {}
@@ -1884,7 +1903,7 @@ const z = (t) => {
1884
1903
  },
1885
1904
  /** Ошибка «ещё не готовы к подключению» — без ретрая. */
1886
1905
  isNotReadyForConnection: ({ event: e }) => {
1887
- const n = os(z(e));
1906
+ const n = cs(z(e));
1888
1907
  return b("isNotReadyForConnection:", n), n;
1889
1908
  },
1890
1909
  /** Политика опций запрещает повтор для этой ошибки. */
@@ -1934,11 +1953,11 @@ const z = (t) => {
1934
1953
  },
1935
1954
  /** Лимит: завершить попытку, событие лимита, запуск опроса телефонии. */
1936
1955
  onLimitReachedTransition: ({ context: e }) => {
1937
- b("onLimitReachedTransition"), t.onLimitReached(tt(e));
1956
+ b("onLimitReachedTransition"), t.onLimitReached(nt(e));
1938
1957
  },
1939
1958
  /** Успешный invoke `connect`. */
1940
1959
  onConnectDone: ({ context: e }) => {
1941
- b("onConnectDone"), t.onConnectSucceeded(tt(e));
1960
+ b("onConnectDone"), t.onConnectSucceeded(nt(e));
1942
1961
  },
1943
1962
  assignHaltedError: A({
1944
1963
  stopReason: () => "halted",
@@ -1989,7 +2008,7 @@ const z = (t) => {
1989
2008
  }
1990
2009
  });
1991
2010
  var O = /* @__PURE__ */ ((t) => (t.IDLE = "idle", t.DISCONNECTING = "disconnecting", t.ATTEMPTING_GATE = "attemptingGate", t.ATTEMPTING_CONNECT = "attemptingConnect", t.WAITING_BEFORE_RETRY = "waitingBeforeRetry", t.CONNECTED_MONITORING = "connectedMonitoring", t.TELEPHONY_CHECKING = "telephonyChecking", t.ERROR_TERMINAL = "errorTerminal", t))(O || {});
1992
- const Ps = () => ({
2011
+ const Ls = () => ({
1993
2012
  parameters: void 0,
1994
2013
  afterDisconnect: "idle",
1995
2014
  stopReason: void 0,
@@ -2003,10 +2022,10 @@ const Ps = () => ({
2003
2022
  target: O.DISCONNECTING,
2004
2023
  actions: "assignRestart"
2005
2024
  }
2006
- }), Ls = (t) => Ds(t).createMachine({
2025
+ }), ws = (t) => Ps(t).createMachine({
2007
2026
  id: "autoConnector",
2008
2027
  initial: O.IDLE,
2009
- context: Ps,
2028
+ context: Ls,
2010
2029
  states: {
2011
2030
  /** Ожидание: допустимы рестарт флоу или внешний стоп без побочных эффектов. */
2012
2031
  [O.IDLE]: {
@@ -2208,14 +2227,14 @@ const Ps = () => ({
2208
2227
  on: ce()
2209
2228
  }
2210
2229
  }
2211
- }), ws = I("AutoConnectorManager: AutoConnectorStateMachine");
2212
- class Gs extends te {
2230
+ }), Gs = I("AutoConnectorManager: AutoConnectorStateMachine");
2231
+ class ks extends te {
2213
2232
  constructor(e) {
2214
2233
  super(e);
2215
2234
  }
2216
2235
  send(e) {
2217
2236
  if (!this.actor.getSnapshot().can(e)) {
2218
- ws(
2237
+ Gs(
2219
2238
  `[AutoConnectorStateMachine] Invalid transition: ${e.type} from ${String(this.state)}. Event cannot be processed in current state.`
2220
2239
  );
2221
2240
  return;
@@ -2241,19 +2260,19 @@ class Gs extends te {
2241
2260
  return this.state === O.WAITING_BEFORE_RETRY;
2242
2261
  }
2243
2262
  }
2244
- const ks = (t) => new Gs(Ls(t)), Fs = /* @__PURE__ */ new Set([401, 403]), Us = (t) => typeof t == "object" && t !== null && "response" in t, Bs = (t) => {
2245
- if (!Us(t))
2263
+ const Fs = (t) => new ks(ws(t)), Us = /* @__PURE__ */ new Set([401, 403]), Bs = (t) => typeof t == "object" && t !== null && "response" in t, $s = (t) => {
2264
+ if (!Bs(t))
2246
2265
  return !1;
2247
2266
  const e = t.response?.status_code;
2248
- return typeof e == "number" && Fs.has(e);
2249
- }, $s = (t) => !Bs(t), xs = (t) => {
2267
+ return typeof e == "number" && Us.has(e);
2268
+ }, xs = (t) => !$s(t), qs = (t) => {
2250
2269
  if (!(typeof window > "u"))
2251
2270
  return window;
2252
- }, qs = (t) => {
2271
+ }, Vs = (t) => {
2253
2272
  if (!(typeof navigator > "u"))
2254
2273
  return navigator;
2255
- }, Vs = (t) => {
2256
- const e = xs(), n = qs();
2274
+ }, Hs = (t) => {
2275
+ const e = qs(), n = Vs();
2257
2276
  if (!e)
2258
2277
  return;
2259
2278
  let s = [];
@@ -2288,11 +2307,11 @@ const ks = (t) => new Gs(Ls(t)), Fs = /* @__PURE__ */ new Set([401, 403]), Us =
2288
2307
  },
2289
2308
  unsubscribe: r
2290
2309
  };
2291
- }, Hs = "Failed to reconnect", nt = (t) => t instanceof Error ? t : new Error(Hs), Ws = (t) => {
2310
+ }, Ws = "Failed to reconnect", st = (t) => t instanceof Error ? t : new Error(Ws), Qs = (t) => {
2292
2311
  const e = (s) => t.baseCanRetryOnError(s) ? t.canRetryOnError?.(s) ?? !0 : !1, n = ({
2293
2312
  stopReason: s,
2294
2313
  lastError: r
2295
- }) => s === "cancelled" && !Dt(r) || s === "failed" ? nt(r) : r;
2314
+ }) => s === "cancelled" && !Dt(r) || s === "failed" ? st(r) : r;
2296
2315
  return {
2297
2316
  canRetryOnError: e,
2298
2317
  shouldDisconnectBeforeAttempt: () => t.runtime.shouldDisconnectBeforeAttempt(),
@@ -2339,8 +2358,8 @@ const ks = (t) => new Gs(Ls(t)), Fs = /* @__PURE__ */ new Set([401, 403]), Us =
2339
2358
  "limit-reached-attempts",
2340
2359
  "telephony-check-failure",
2341
2360
  "telephony-check-escalated"
2342
- ], Qs = () => new G(Bt), J = I("AutoConnectorManager: NetworkEventsReconnector"), Ys = 2e3, st = "probe", js = "network-online", zs = "network-change";
2343
- class Js {
2361
+ ], Ys = () => new G(Bt), J = I("AutoConnectorManager: NetworkEventsReconnector"), js = 2e3, rt = "probe", zs = "network-online", Js = "network-change";
2362
+ class Ks {
2344
2363
  subscriber;
2345
2364
  offlineGraceMs;
2346
2365
  onChangePolicy;
@@ -2363,7 +2382,7 @@ class Js {
2363
2382
  requestReconnect: a,
2364
2383
  stopConnection: o
2365
2384
  }) {
2366
- this.subscriber = e, this.offlineGraceMs = n ?? Ys, this.onChangePolicy = s ?? st, this.onOnlinePolicy = r ?? st, this.probe = i, this.requestReconnect = a, this.stopConnection = o;
2385
+ this.subscriber = e, this.offlineGraceMs = n ?? js, this.onChangePolicy = s ?? rt, this.onOnlinePolicy = r ?? rt, this.probe = i, this.requestReconnect = a, this.stopConnection = o;
2367
2386
  }
2368
2387
  start(e) {
2369
2388
  this.parameters = e, !this.isSubscribed && (this.subscriber.subscribe({
@@ -2379,10 +2398,10 @@ class Js {
2379
2398
  this.cancelOfflineTimer(), this.isSubscribed && (this.subscriber.unsubscribe(), this.isSubscribed = !1, this.parameters = void 0);
2380
2399
  }
2381
2400
  handleOnline = () => {
2382
- J("network online", { policy: this.onOnlinePolicy }), this.cancelOfflineTimer(), this.applyPolicy(this.onOnlinePolicy, js);
2401
+ J("network online", { policy: this.onOnlinePolicy }), this.cancelOfflineTimer(), this.applyPolicy(this.onOnlinePolicy, zs);
2383
2402
  };
2384
2403
  handleChange = () => {
2385
- J("network change", { policy: this.onChangePolicy }), this.applyPolicy(this.onChangePolicy, zs);
2404
+ J("network change", { policy: this.onChangePolicy }), this.applyPolicy(this.onChangePolicy, Js);
2386
2405
  };
2387
2406
  handleOffline = () => {
2388
2407
  J("network offline, scheduling disconnect", { graceMs: this.offlineGraceMs }), this.cancelOfflineTimer(), this.offlineTimer = setTimeout(() => {
@@ -2421,23 +2440,6 @@ class Js {
2421
2440
  this.offlineTimer !== void 0 && (clearTimeout(this.offlineTimer), this.offlineTimer = void 0);
2422
2441
  }
2423
2442
  }
2424
- const X = {
2425
- START: "start",
2426
- MANUAL_RESTART: "manual-restart",
2427
- REGISTRATION_FAILED_OUT_OF_CALL: "registration-failed-out-of-call",
2428
- TELEPHONY_DISCONNECTED: "telephony-disconnected",
2429
- TELEPHONY_CHECK_FAILED: "telephony-check-failed",
2430
- NETWORK_ONLINE: "network-online",
2431
- NETWORK_CHANGE: "network-change"
2432
- }, Ks = {
2433
- [X.START]: 0,
2434
- [X.TELEPHONY_DISCONNECTED]: 1,
2435
- [X.TELEPHONY_CHECK_FAILED]: 1,
2436
- [X.REGISTRATION_FAILED_OUT_OF_CALL]: 3,
2437
- [X.MANUAL_RESTART]: 4,
2438
- [X.NETWORK_ONLINE]: 4,
2439
- [X.NETWORK_CHANGE]: 4
2440
- }, rt = (t) => Ks[t];
2441
2443
  class Xs {
2442
2444
  generation = 0;
2443
2445
  lastRequest;
@@ -2446,9 +2448,9 @@ class Xs {
2446
2448
  this.coalesceWindowMs = e;
2447
2449
  }
2448
2450
  register(e) {
2449
- const n = Date.now(), s = rt(e), { lastRequest: r } = this;
2451
+ const n = Date.now(), s = et(e), { lastRequest: r } = this;
2450
2452
  if (r !== void 0 && n - r.timestamp < this.coalesceWindowMs) {
2451
- const a = rt(r.reason);
2453
+ const a = et(r.reason);
2452
2454
  if (s <= a)
2453
2455
  return {
2454
2456
  shouldRequest: !1,
@@ -2487,7 +2489,7 @@ class sr extends w {
2487
2489
  connectionManager: n,
2488
2490
  callManager: s
2489
2491
  }, r) {
2490
- super(Qs()), this.connectionManager = n, this.runtime = new as({
2492
+ super(Ys()), this.connectionManager = n, this.runtime = new os({
2491
2493
  connectionManager: n,
2492
2494
  connectionQueueManager: e,
2493
2495
  callManager: s,
@@ -2527,15 +2529,15 @@ class sr extends w {
2527
2529
  this.stateMachine.toTelephonyResultStillConnected();
2528
2530
  }
2529
2531
  }
2530
- }), this.stateMachine = ks(
2531
- Ws({
2532
- baseCanRetryOnError: $s,
2532
+ }), this.stateMachine = Fs(
2533
+ Qs({
2534
+ baseCanRetryOnError: xs,
2533
2535
  runtime: this.runtime,
2534
2536
  canRetryOnError: r?.canRetryOnError
2535
2537
  })
2536
2538
  );
2537
- const i = r?.networkEventsSubscriber ?? Vs();
2538
- i && (this.networkEventsReconnector = new Js({
2539
+ const i = r?.networkEventsSubscriber ?? Hs();
2540
+ i && (this.networkEventsReconnector = new Ks({
2539
2541
  subscriber: i,
2540
2542
  offlineGraceMs: r?.offlineGraceMs,
2541
2543
  onChangePolicy: r?.onNetworkChangePolicy,
@@ -5351,9 +5353,9 @@ class Ro {
5351
5353
  degradationPreference: y,
5352
5354
  sendEncodings: _,
5353
5355
  onAddedTransceiver: q
5354
- }) => new Promise((B, K) => {
5356
+ }) => new Promise((B, X) => {
5355
5357
  this.handleCall().then(B).catch((ne) => {
5356
- K(ne);
5358
+ X(ne);
5357
5359
  }), this.pcConfig = { iceServers: a }, this.rtcSession = e.call(n(s), {
5358
5360
  mediaStream: Re(r, {
5359
5361
  directionVideo: o,
@@ -7730,7 +7732,7 @@ const En = ["collected", "stopped"], Tc = () => new G(En), Nt = () => "performan
7730
7732
  const [
7731
7733
  q,
7732
7734
  B,
7733
- K,
7735
+ X,
7734
7736
  ne,
7735
7737
  Me,
7736
7738
  je
@@ -7739,7 +7741,7 @@ const En = ["collected", "stopped"], Tc = () => new G(En), Nt = () => "performan
7739
7741
  synchronizationSources: y,
7740
7742
  audioSenderStats: q,
7741
7743
  videoSenderFirstStats: B,
7742
- videoSenderSecondStats: K,
7744
+ videoSenderSecondStats: X,
7743
7745
  audioReceiverStats: ne,
7744
7746
  videoReceiverFirstStats: Me,
7745
7747
  videoReceiverSecondStats: je
@@ -8228,7 +8230,7 @@ class _l extends w {
8228
8230
  minConsecutiveProblemSamplesCount: c,
8229
8231
  throttleRecoveryTimeout: g
8230
8232
  } = {}) {
8231
- super(al()), this.preferredMimeTypesVideoCodecs = n ?? Wc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new Yn(), this.connectionManager = new bs({ JsSIP: e }, { numberOfConnectionAttempts: o }), this.connectionQueueManager = new ys({
8233
+ super(al()), this.preferredMimeTypesVideoCodecs = n ?? Wc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new Yn(), this.connectionManager = new ys({ JsSIP: e }, { numberOfConnectionAttempts: o }), this.connectionQueueManager = new Ds({
8232
8234
  connectionManager: this.connectionManager
8233
8235
  }), this.contentedStreamManager = new nc(), this.callSessionState = new da(), this.callManager = new Bo(
8234
8236
  { contentedStreamManager: this.contentedStreamManager },
@@ -8534,11 +8536,11 @@ export {
8534
8536
  _l as G,
8535
8537
  fc as H,
8536
8538
  cc as I,
8537
- ks as J,
8539
+ Fs as J,
8538
8540
  zi as K,
8539
8541
  Ar as L,
8540
8542
  za as M,
8541
- Ss as N,
8543
+ Cs as N,
8542
8544
  sc as O,
8543
8545
  Sa as P,
8544
8546
  Rl as Q,
@@ -8568,10 +8570,10 @@ export {
8568
8570
  l as k,
8569
8571
  O as l,
8570
8572
  I as m,
8571
- os as n,
8573
+ cs as n,
8572
8574
  $t as o,
8573
8575
  Re as p,
8574
- Ts as q,
8576
+ ps as q,
8575
8577
  Il as r,
8576
8578
  Al as s,
8577
8579
  v as t,