@signalwire/js 4.0.0-dev-20260427214957 → 4.0.0-dev-20260428062741

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/dist/browser.mjs CHANGED
@@ -16472,6 +16472,23 @@ function isVertoPingInnerParams(value) {
16472
16472
  //#region src/managers/VertoManager.ts
16473
16473
  var import_cjs$15 = require_cjs();
16474
16474
  const logger$15 = getLogger();
16475
+ /**
16476
+ * Decide what value goes on the `node_id` field of a `webrtc.verto` envelope.
16477
+ *
16478
+ * - **Reattach invite:** must carry the persisted nodeId so the server routes
16479
+ * the new connection to the FreeSWITCH instance that holds the existing call.
16480
+ * - **Fresh invite, caller-supplied `CallOptions.nodeId`:** carry the explicit
16481
+ * value as a steering hint (dev/staging traffic pinning). Server may honour
16482
+ * or ignore for placement reasons.
16483
+ * - **Fresh invite, no caller nodeId:** strip to `''` = "server picks".
16484
+ * - **Non-invite frames** (verto.modify, verto.bye, etc.): always carry the
16485
+ * current `_nodeId$.value` so the frame targets the node hosting the call.
16486
+ *
16487
+ * Pure function — exported for unit testing.
16488
+ */
16489
+ function resolveInviteNodeId(args) {
16490
+ return args.isInvite && !args.reattach && !args.explicitNodeId ? "" : args.currentNodeId ?? "";
16491
+ }
16475
16492
  var VertoManager = class extends Destroyable {
16476
16493
  constructor(callSession) {
16477
16494
  super();
@@ -17011,11 +17028,14 @@ var WebRTCVertoManager = class extends VertoManager {
17011
17028
  else if (rtcPeerConnController.isAdditionalDevice) subscribe.push(...PreferencesContainer.instance.inviteSubscribeAdditionalDevice);
17012
17029
  else if (rtcPeerConnController.isScreenShare) subscribe.push(...PreferencesContainer.instance.inviteSubscribeScreenshare);
17013
17030
  }
17014
- const isInvite = isVertoInviteMessage(vertoMessage);
17015
- const isReattach = isInvite && this.webRtcCallSession.options.reattach;
17016
17031
  return {
17017
17032
  callID: rtcPeerConnController.id,
17018
- node_id: isInvite && !isReattach ? "" : this._nodeId$.value ?? "",
17033
+ node_id: resolveInviteNodeId({
17034
+ isInvite: isVertoInviteMessage(vertoMessage),
17035
+ reattach: this.webRtcCallSession.options.reattach === true,
17036
+ explicitNodeId: this.webRtcCallSession.options.nodeId,
17037
+ currentNodeId: this._nodeId$.value
17038
+ }),
17019
17039
  subscribe
17020
17040
  };
17021
17041
  }