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.
package/README.md CHANGED
@@ -229,6 +229,7 @@ Also, there are next public fields on OpensipsJS instance:
229
229
  - `setSpeakerVolume(value: Number): void` - set volume of callers. Value should be in range from 0 to 1
230
230
  - `setDND(value: Boolean): void` - set the agent "Do not disturb" status
231
231
  - `setMetricsConfig(config: WebrtcMetricsConfigType): void` - set the metric config (used for audio quality indicator)
232
+ - `setVADConfiguration(options: Partial<Omit<NoiseReductionOptions, 'vadModule'>>): void` - update noise reduction configuration at runtime. **Requires `vadModule` to be passed in the constructor, otherwise throws an error**
232
233
 
233
234
  ### Audio instance fields
234
235
  - `sipOptions: Object` - returns sip options
@@ -247,6 +248,14 @@ Also, there are next public fields on OpensipsJS instance:
247
248
 
248
249
  **Important**: Voice Activity Detection (VAD) is an **optional feature** that requires installing an additional peer dependency. It is **NOT compatible with React Native**.
249
250
 
251
+ #### Critical: VAD Module Must Be Passed to Constructor
252
+
253
+ **If you plan to use noise reduction features (including `setVADConfiguration` in runtime), you MUST pass `vadModule` to the OpenSIPSJS constructor during initialization.**
254
+
255
+ - ✅ **Required**: Pass `vadModule` in the constructor if you want to use noise reduction
256
+ - ❌ **Will throw error**: Calling `setVADConfiguration()` without `vadModule` in the constructor will throw an error
257
+ - ⚠️ **Cannot be changed later**: The `vadModule` cannot be set after initialization - it must be provided in the constructor
258
+
250
259
  #### For Web Applications (with VAD support)
251
260
 
252
261
  Install the VAD library:
@@ -256,7 +265,7 @@ npm install @ricky0123/vad-web
256
265
  yarn add @ricky0123/vad-web
257
266
  ```
258
267
 
259
- Then import and inject it in your configuration:
268
+ Then import and inject it in your configuration **during initialization**:
260
269
  ```javascript
261
270
  import OpenSIPSJS from 'opensips-js'
262
271
  import * as VAD from '@ricky0123/vad-web'
@@ -266,7 +275,7 @@ const opensipsJS = new OpenSIPSJS({
266
275
  // ... other configuration
267
276
  noiseReductionOptions: {
268
277
  mode: 'dynamic', // or 'enabled'
269
- vadModule: VAD, // Inject the VAD module
278
+ vadModule: VAD, // ⚠️ REQUIRED: Must be passed here if you plan to use noise reduction
270
279
  noiseThreshold: 0.004,
271
280
  checkEveryMs: 500,
272
281
  noiseCheckInterval: 2000
@@ -274,6 +283,12 @@ const opensipsJS = new OpenSIPSJS({
274
283
  },
275
284
  // ... rest of configuration
276
285
  })
286
+
287
+ // ✅ Now you can use setVADConfiguration
288
+ opensipsJS.audio.setVADConfiguration({
289
+ mode: 'enabled',
290
+ noiseThreshold: 0.005
291
+ })
277
292
  ```
278
293
 
279
294
  #### For React Native Applications (VAD not supported)
package/dist/index.d.ts CHANGED
@@ -78,6 +78,8 @@ declare class AudioModule {
78
78
  private MicVAD;
79
79
  managedAudioContext: ManagedAudioContext;
80
80
  constructor(context: OpenSIPSJS);
81
+ setVADConfiguration(options: Partial<Omit<NoiseReductionOptions, 'vadModule'>>): void;
82
+ private setupVADInstance;
81
83
  private processVADConfiguration;
82
84
  get sipOptions(): {
83
85
  mediaConstraints: {