@signalwire/js 4.0.0-dev-20260427214255 → 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.
@@ -15662,7 +15662,7 @@ var RTCPeerConnectionController = class extends Destroyable {
15662
15662
  const track = localStream.getTracks().find((track$1) => track$1.kind === kind);
15663
15663
  if (track) {
15664
15664
  this.transceiverController?.stopTrackSender(kind);
15665
- this.localStream?.removeTrack(track);
15665
+ this.localStreamController.removeTrack(track.id);
15666
15666
  logger$16.debug(`[RTCPeerConnectionController] Stopped existing ${kind} track: ${track.id}`, localStream.getTracks());
15667
15667
  if (!deviceInfo) {
15668
15668
  logger$16.debug(`[RTCPeerConnectionController] ${kind} input device selected: none`);
@@ -15674,7 +15674,7 @@ var RTCPeerConnectionController = class extends Destroyable {
15674
15674
  } })).getTracks().find((t) => t.kind === kind);
15675
15675
  if (streamTrack) {
15676
15676
  logger$16.debug(`[RTCPeerConnectionController] Adding new ${kind} track: ${streamTrack.id}`);
15677
- this.localStream?.addTrack(streamTrack);
15677
+ this.localStreamController.addTrack(streamTrack);
15678
15678
  await this.transceiverController?.replaceSenderTrack(kind, streamTrack);
15679
15679
  logger$16.debug(`[RTCPeerConnectionController] Added new ${kind} track: ${streamTrack.id}`, this.localStream?.getTracks());
15680
15680
  }
@@ -16476,6 +16476,23 @@ function isVertoPingInnerParams(value) {
16476
16476
  //#region src/managers/VertoManager.ts
16477
16477
  var import_cjs$15 = require_cjs();
16478
16478
  const logger$15 = getLogger();
16479
+ /**
16480
+ * Decide what value goes on the `node_id` field of a `webrtc.verto` envelope.
16481
+ *
16482
+ * - **Reattach invite:** must carry the persisted nodeId so the server routes
16483
+ * the new connection to the FreeSWITCH instance that holds the existing call.
16484
+ * - **Fresh invite, caller-supplied `CallOptions.nodeId`:** carry the explicit
16485
+ * value as a steering hint (dev/staging traffic pinning). Server may honour
16486
+ * or ignore for placement reasons.
16487
+ * - **Fresh invite, no caller nodeId:** strip to `''` = "server picks".
16488
+ * - **Non-invite frames** (verto.modify, verto.bye, etc.): always carry the
16489
+ * current `_nodeId$.value` so the frame targets the node hosting the call.
16490
+ *
16491
+ * Pure function — exported for unit testing.
16492
+ */
16493
+ function resolveInviteNodeId(args) {
16494
+ return args.isInvite && !args.reattach && !args.explicitNodeId ? "" : args.currentNodeId ?? "";
16495
+ }
16479
16496
  var VertoManager = class extends Destroyable {
16480
16497
  constructor(callSession) {
16481
16498
  super();
@@ -17015,11 +17032,14 @@ var WebRTCVertoManager = class extends VertoManager {
17015
17032
  else if (rtcPeerConnController.isAdditionalDevice) subscribe.push(...PreferencesContainer.instance.inviteSubscribeAdditionalDevice);
17016
17033
  else if (rtcPeerConnController.isScreenShare) subscribe.push(...PreferencesContainer.instance.inviteSubscribeScreenshare);
17017
17034
  }
17018
- const isInvite = isVertoInviteMessage(vertoMessage);
17019
- const isReattach = isInvite && this.webRtcCallSession.options.reattach;
17020
17035
  return {
17021
17036
  callID: rtcPeerConnController.id,
17022
- node_id: isInvite && !isReattach ? "" : this._nodeId$.value ?? "",
17037
+ node_id: resolveInviteNodeId({
17038
+ isInvite: isVertoInviteMessage(vertoMessage),
17039
+ reattach: this.webRtcCallSession.options.reattach === true,
17040
+ explicitNodeId: this.webRtcCallSession.options.nodeId,
17041
+ currentNodeId: this._nodeId$.value
17042
+ }),
17023
17043
  subscribe
17024
17044
  };
17025
17045
  }