@signalwire/js 4.0.0-dev-20260911173516 → 4.0.0-dev-20260911182554

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
@@ -16083,6 +16083,7 @@ var RTCPeerConnectionController = class extends Destroyable {
16083
16083
  };
16084
16084
  this._isNegotiating$ = this.createBehaviorSubject(false);
16085
16085
  this._memberId = null;
16086
+ this._nodeId = null;
16086
16087
  this._iceConnectionState$ = this.createReplaySubject(1);
16087
16088
  this._connectionState$ = this.createReplaySubject(1);
16088
16089
  this._signalingState$ = this.createReplaySubject(1);
@@ -16148,6 +16149,13 @@ var RTCPeerConnectionController = class extends Destroyable {
16148
16149
  get memberId() {
16149
16150
  return this._memberId;
16150
16151
  }
16152
+ /** The node this leg's invite landed on — auxiliary legs are placed independently. */
16153
+ setNodeId(nodeId) {
16154
+ this._nodeId = nodeId;
16155
+ }
16156
+ get nodeId() {
16157
+ return this._nodeId;
16158
+ }
16151
16159
  stopTrackSender(kind, options = { updateTransceiverDirection: false }) {
16152
16160
  const audioCovered = kind === "audio" || kind === "both";
16153
16161
  if (audioCovered && this._localAudioPipeline) this.stopRawAudioInputForPipeline();
@@ -17299,8 +17307,8 @@ var WebRTCVertoManager = class extends VertoManager {
17299
17307
  * these identifiers before the `verto.invite` RPC response (`CALL CREATED`)
17300
17308
  * arrives. These methods let early events populate them eagerly so that
17301
17309
  * downstream RPC calls (e.g. `call.layout.list`) don't fail with empty
17302
- * identifiers. `processInviteResponse()` remains the authoritative source
17303
- * and always overwrites unconditionally.
17310
+ * identifiers. `processInviteResponse()` remains the authoritative source and
17311
+ * overwrites unconditionally — for selfId, on the main leg only.
17304
17312
  */
17305
17313
  setNodeIdIfNull(nodeId) {
17306
17314
  if (!this._nodeId$.value && nodeId) {
@@ -17338,9 +17346,9 @@ var WebRTCVertoManager = class extends VertoManager {
17338
17346
  return this._selfId$.value;
17339
17347
  }
17340
17348
  /** Build an AttachableCall from the current call state. */
17341
- buildAttachableCall(idOverride) {
17349
+ buildAttachableCall(idOverride, nodeIdOverride) {
17342
17350
  return {
17343
- nodeId: this.nodeId ?? void 0,
17351
+ nodeId: nodeIdOverride ?? this.nodeId ?? void 0,
17344
17352
  id: idOverride ?? this.webRtcCallSession.id,
17345
17353
  to: this.webRtcCallSession.to,
17346
17354
  mediaDirections: this.webRtcCallSession.mediaDirections
@@ -17573,7 +17581,7 @@ var WebRTCVertoManager = class extends VertoManager {
17573
17581
  processInviteResponse(response, rtcPeerConnController) {
17574
17582
  if (!response.error && getValueFrom(response, "result.result.result.message") === "CALL CREATED") {
17575
17583
  this.emitMainSignalingStatus(rtcPeerConnController.id, "trying");
17576
- this._nodeId$.next(getValueFrom(response, "result.node_id") ?? null);
17584
+ const nodeId = getValueFrom(response, "result.node_id") ?? null;
17577
17585
  const memberId = getValueFrom(response, "result.result.result.memberID") ?? null;
17578
17586
  const callId = getValueFrom(response, "result.result.result.callID") ?? null;
17579
17587
  logger$16.debug("[WebRTCManager] Verto invite response:", {
@@ -17581,11 +17589,15 @@ var WebRTCVertoManager = class extends VertoManager {
17581
17589
  memberId,
17582
17590
  response
17583
17591
  });
17584
- this._selfId$.next(memberId);
17585
17592
  rtcPeerConnController.setMemberId(memberId);
17593
+ rtcPeerConnController.setNodeId(nodeId);
17594
+ if (rtcPeerConnController.isMainDevice) {
17595
+ this._selfId$.next(memberId);
17596
+ this._nodeId$.next(nodeId);
17597
+ }
17586
17598
  if (callId) {
17587
17599
  this.webRtcCallSession.addCallId(callId);
17588
- this.attachManager.attach(this.buildAttachableCall(callId));
17600
+ this.attachManager.attach(this.buildAttachableCall(callId, nodeId ?? void 0));
17589
17601
  } else logger$16.warn("[WebRTCManager] Cannot attach call, missing callId:", {
17590
17602
  nodeId: this.nodeId,
17591
17603
  callId
@@ -17735,7 +17747,7 @@ var WebRTCVertoManager = class extends VertoManager {
17735
17747
  isInvite: isVertoInviteMessage(vertoMessage),
17736
17748
  reattach: this.webRtcCallSession.options.reattach === true,
17737
17749
  explicitNodeId: this.webRtcCallSession.options.nodeId,
17738
- currentNodeId: this._nodeId$.value
17750
+ currentNodeId: rtcPeerConnController.nodeId ?? this._nodeId$.value
17739
17751
  }),
17740
17752
  subscribe
17741
17753
  };
@@ -17947,7 +17959,10 @@ var WebRTCVertoManager = class extends VertoManager {
17947
17959
  await this.executeVerto(VertoBye({
17948
17960
  ...causeParams,
17949
17961
  dialogParams: this.dialogParams(rtcPeerConnController)
17950
- }), { callID: rtcPeerConnController.id });
17962
+ }), {
17963
+ callID: rtcPeerConnController.id,
17964
+ node_id: rtcPeerConnController.nodeId ?? void 0
17965
+ });
17951
17966
  } catch (error) {
17952
17967
  logger$16.warn("[WebRTCManager] Call might already be disconnected, error sending Verto bye:", error);
17953
17968
  throw error;