@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.
package/dist/browser.mjs CHANGED
@@ -15658,7 +15658,7 @@ var RTCPeerConnectionController = class extends Destroyable {
15658
15658
  const track = localStream.getTracks().find((track$1) => track$1.kind === kind);
15659
15659
  if (track) {
15660
15660
  this.transceiverController?.stopTrackSender(kind);
15661
- this.localStream?.removeTrack(track);
15661
+ this.localStreamController.removeTrack(track.id);
15662
15662
  logger$16.debug(`[RTCPeerConnectionController] Stopped existing ${kind} track: ${track.id}`, localStream.getTracks());
15663
15663
  if (!deviceInfo) {
15664
15664
  logger$16.debug(`[RTCPeerConnectionController] ${kind} input device selected: none`);
@@ -15670,7 +15670,7 @@ var RTCPeerConnectionController = class extends Destroyable {
15670
15670
  } })).getTracks().find((t) => t.kind === kind);
15671
15671
  if (streamTrack) {
15672
15672
  logger$16.debug(`[RTCPeerConnectionController] Adding new ${kind} track: ${streamTrack.id}`);
15673
- this.localStream?.addTrack(streamTrack);
15673
+ this.localStreamController.addTrack(streamTrack);
15674
15674
  await this.transceiverController?.replaceSenderTrack(kind, streamTrack);
15675
15675
  logger$16.debug(`[RTCPeerConnectionController] Added new ${kind} track: ${streamTrack.id}`, this.localStream?.getTracks());
15676
15676
  }
@@ -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
  }