@signalwire/js 4.0.0-dev-20260303135011 → 4.0.0-dev-20260303152249

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
@@ -14236,8 +14236,7 @@ var WebRTCVertoManager = class extends VertoManager {
14236
14236
  userVariables: {
14237
14237
  memberCallId: this.webRtcCallSession.id,
14238
14238
  memberId,
14239
- ...this.webRtcCallSession.options.userVariables,
14240
- ...PreferencesContainer.instance.userVariables
14239
+ ...this.webRtcCallSession.userVariables
14241
14240
  },
14242
14241
  screenShare: rtcPeerConnectionController.isScreenShare,
14243
14242
  additionalDevice: rtcPeerConnectionController.isAdditionalDevice,
@@ -14436,6 +14435,20 @@ var ParticipantFactory = class {
14436
14435
  //#region src/core/entities/Call.ts
14437
14436
  var import_cjs$9 = require_cjs();
14438
14437
  const logger$9 = getLogger();
14438
+ const fromDestinationParams = (destination) => {
14439
+ if (!destination) return {};
14440
+ try {
14441
+ const url = new URL(`destination:${destination}`);
14442
+ const params = {};
14443
+ url.searchParams.forEach((value, key) => {
14444
+ params[key] = value;
14445
+ });
14446
+ return params;
14447
+ } catch (error) {
14448
+ logger$9.warn(`Failed to parse destination URI: ${destination}`, error);
14449
+ return {};
14450
+ }
14451
+ };
14439
14452
  /**
14440
14453
  * Concrete WebRTC call implementation.
14441
14454
  *
@@ -14453,8 +14466,21 @@ var WebRTCCall = class extends Destroyable {
14453
14466
  this._errors$ = this.createSubject();
14454
14467
  this._answered$ = this.createReplaySubject();
14455
14468
  this._holdState = false;
14469
+ this._userVariables$ = this.createBehaviorSubject({ ...PreferencesContainer.instance.userVariables });
14456
14470
  this.id = options.callId ?? v4_default();
14457
14471
  this.to = options.to;
14472
+ this._userVariables$.next({
14473
+ ...this._userVariables$.value,
14474
+ ...fromDestinationParams(options.to),
14475
+ ...options.userVariables
14476
+ });
14477
+ this.subscribeTo(this.webrtcMessages$, (message) => {
14478
+ const userVars = getValueFrom(message, "params.userVariables");
14479
+ if (userVars) this._userVariables$.next({
14480
+ ...this._userVariables$.value,
14481
+ ...userVars
14482
+ });
14483
+ });
14458
14484
  const managers = initialization.initializeManagers(this);
14459
14485
  this.vertoManager = managers.vertoManager;
14460
14486
  this.callEventsManager = managers.callEventsManager;
@@ -14668,6 +14694,21 @@ var WebRTCCall = class extends Destroyable {
14668
14694
  get remoteStream() {
14669
14695
  return this.vertoManager.remoteStream;
14670
14696
  }
14697
+ /** Observable of custom user variables associated with the call. */
14698
+ get userVariables$() {
14699
+ return this._userVariables$.asObservable();
14700
+ }
14701
+ /** a copy of the current custom user variables of the call. */
14702
+ get userVariables() {
14703
+ return { ...this._userVariables$.value };
14704
+ }
14705
+ /** Merge current custom user variables of the call. */
14706
+ set userVariables(variables) {
14707
+ this._userVariables$.next({
14708
+ ...this._userVariables$.value,
14709
+ ...variables
14710
+ });
14711
+ }
14671
14712
  /** @internal */
14672
14713
  createParticipant(memberId, selfId) {
14673
14714
  if (memberId === (selfId ?? this.vertoManager.selfId)) return this.participantFactory.createSelfParticipant(memberId);
@@ -15516,7 +15557,8 @@ var ClientSessionManager = class extends Destroyable {
15516
15557
  to: invite.callee_id_number,
15517
15558
  fromName: invite.caller_id_name,
15518
15559
  from: invite.caller_id_number,
15519
- displayDirection: invite.display_direction
15560
+ displayDirection: invite.display_direction,
15561
+ userVariables: invite.userVariables
15520
15562
  });
15521
15563
  await (0, import_cjs$5.firstValueFrom)(callSession.status$);
15522
15564
  this._calls$.next({