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

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/index.cjs CHANGED
@@ -5958,6 +5958,23 @@ function isVertoPingInnerParams(value) {
5958
5958
  //#endregion
5959
5959
  //#region src/managers/VertoManager.ts
5960
5960
  const logger$15 = require_operators.getLogger();
5961
+ /**
5962
+ * Decide what value goes on the `node_id` field of a `webrtc.verto` envelope.
5963
+ *
5964
+ * - **Reattach invite:** must carry the persisted nodeId so the server routes
5965
+ * the new connection to the FreeSWITCH instance that holds the existing call.
5966
+ * - **Fresh invite, caller-supplied `CallOptions.nodeId`:** carry the explicit
5967
+ * value as a steering hint (dev/staging traffic pinning). Server may honour
5968
+ * or ignore for placement reasons.
5969
+ * - **Fresh invite, no caller nodeId:** strip to `''` = "server picks".
5970
+ * - **Non-invite frames** (verto.modify, verto.bye, etc.): always carry the
5971
+ * current `_nodeId$.value` so the frame targets the node hosting the call.
5972
+ *
5973
+ * Pure function — exported for unit testing.
5974
+ */
5975
+ function resolveInviteNodeId(args) {
5976
+ return args.isInvite && !args.reattach && !args.explicitNodeId ? "" : args.currentNodeId ?? "";
5977
+ }
5961
5978
  var VertoManager = class extends Destroyable {
5962
5979
  constructor(callSession) {
5963
5980
  super();
@@ -6497,11 +6514,14 @@ var WebRTCVertoManager = class extends VertoManager {
6497
6514
  else if (rtcPeerConnController.isAdditionalDevice) subscribe.push(...PreferencesContainer.instance.inviteSubscribeAdditionalDevice);
6498
6515
  else if (rtcPeerConnController.isScreenShare) subscribe.push(...PreferencesContainer.instance.inviteSubscribeScreenshare);
6499
6516
  }
6500
- const isInvite = isVertoInviteMessage(vertoMessage);
6501
- const isReattach = isInvite && this.webRtcCallSession.options.reattach;
6502
6517
  return {
6503
6518
  callID: rtcPeerConnController.id,
6504
- node_id: isInvite && !isReattach ? "" : this._nodeId$.value ?? "",
6519
+ node_id: resolveInviteNodeId({
6520
+ isInvite: isVertoInviteMessage(vertoMessage),
6521
+ reattach: this.webRtcCallSession.options.reattach === true,
6522
+ explicitNodeId: this.webRtcCallSession.options.nodeId,
6523
+ currentNodeId: this._nodeId$.value
6524
+ }),
6505
6525
  subscribe
6506
6526
  };
6507
6527
  }