opensips-js 0.1.19 → 0.1.24

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.
@@ -23502,8 +23502,8 @@ const da = {
23502
23502
  }, fS = 0;
23503
23503
  class hS {
23504
23504
  constructor(t) {
23505
- var n, a;
23506
- if (this.isAutoAnswer = !1, this.muteWhenJoinEnabled = !1, this.isDNDEnabled = !1, this.isCallWaitingEnabled = !0, this.muted = !1, this.microphoneInputLevelValue = 1, this.speakerVolumeValue = 1, this.activeRooms = {}, this.activeCalls = {}, this.extendedCalls = {}, this.conferenceNodes = {}, this.availableMediaDevices = [], this.selectedMediaDevices = {
23505
+ var n;
23506
+ this.isAutoAnswer = !1, this.muteWhenJoinEnabled = !1, this.isDNDEnabled = !1, this.isCallWaitingEnabled = !0, this.muted = !1, this.microphoneInputLevelValue = 1, this.speakerVolumeValue = 1, this.activeRooms = {}, this.activeCalls = {}, this.extendedCalls = {}, this.conferenceNodes = {}, this.availableMediaDevices = [], this.selectedMediaDevices = {
23507
23507
  input: "default",
23508
23508
  output: "default"
23509
23509
  }, this.callStatus = {}, this.callTime = {}, this.callMetrics = {}, this.timeIntervals = {}, this.metricConfig = {
@@ -23513,14 +23513,22 @@ class hS {
23513
23513
  this.newRTCSessionCallback.bind(this)
23514
23514
  ), this.VUMeter = new uS({
23515
23515
  onChangeFunction: this.emitVolumeChange.bind(this)
23516
- }), this.processVADConfiguration(), this.initializeMediaDevices(), ["enabled", "dynamic"].includes(this.noiseReduction.mode)) {
23517
- const o = (a = (n = this.context.options.configuration) == null ? void 0 : n.noiseReductionOptions) == null ? void 0 : a.vadModule;
23518
- o && o.MicVAD ? (this.MicVAD = o.MicVAD, console.log("✅ VAD module loaded successfully")) : (console.warn("⚠️ Noise reduction is enabled but VAD module is not provided. To use VAD features, please install @ricky0123/vad-web and pass it via configuration.noiseReductionOptions.vadModule option."), this.noiseReduction.mode = "disabled");
23519
- }
23516
+ }), this.initializeMediaDevices(), this.processVADConfiguration(((n = this.context.options.configuration) == null ? void 0 : n.noiseReductionOptions) || {}), this.setupVADInstance();
23520
23517
  }
23521
- processVADConfiguration() {
23522
- var n;
23523
- const t = ((n = this.context.options.configuration) == null ? void 0 : n.noiseReductionOptions) || {};
23518
+ setVADConfiguration(t) {
23519
+ if (!this.MicVAD)
23520
+ throw new Error("VAD module is not provided in the initial configuration");
23521
+ const n = Object.keys(t);
23522
+ for (const a of n)
23523
+ this.noiseReduction[a] = t[a];
23524
+ this.hasActiveCalls && this.roomReconfigure(this.currentActiveRoomId);
23525
+ }
23526
+ setupVADInstance() {
23527
+ var n, a;
23528
+ const t = (a = (n = this.context.options.configuration) == null ? void 0 : n.noiseReductionOptions) == null ? void 0 : a.vadModule;
23529
+ t && t.MicVAD ? (this.MicVAD = t.MicVAD, console.log("✅ VAD module loaded successfully")) : this.noiseReduction.mode !== "disabled" && (console.warn("⚠️ Noise reduction is enabled but VAD module is not provided. To use VAD features, please install @ricky0123/vad-web and pass it via configuration.noiseReductionOptions.vadModule option."), this.noiseReduction.mode = "disabled");
23530
+ }
23531
+ processVADConfiguration(t) {
23524
23532
  this.noiseReduction = {
23525
23533
  mode: t.mode || "disabled",
23526
23534
  checkEveryMs: t.checkEveryMs || 500,