opensips-js 0.1.14 → 0.1.16
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 +55 -2
- package/dist/index.d.ts +6 -0
- package/dist/opensips-js.cjs.js +2 -2
- package/dist/opensips-js.es.js +438 -442
- package/dist/opensips-js.iife.js +4 -4
- package/dist/opensips-js.umd.js +4 -4
- package/package.json +9 -2
- package/src/types/rtc.d.ts +5 -0
package/README.md
CHANGED
|
@@ -243,11 +243,64 @@ Also, there are next public fields on OpensipsJS instance:
|
|
|
243
243
|
- `isDND: Boolean` - returns if the agent is in "Do not disturb" status
|
|
244
244
|
- `isMuted: Boolean` - returns if the agent is muted
|
|
245
245
|
|
|
246
|
-
### Noise Reduction Options
|
|
246
|
+
### Noise Reduction Options (VAD)
|
|
247
|
+
|
|
248
|
+
**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
|
+
#### For Web Applications (with VAD support)
|
|
251
|
+
|
|
252
|
+
Install the VAD library:
|
|
253
|
+
```bash
|
|
254
|
+
npm install @ricky0123/vad-web
|
|
255
|
+
# or
|
|
256
|
+
yarn add @ricky0123/vad-web
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Then import and inject it in your configuration:
|
|
260
|
+
```javascript
|
|
261
|
+
import OpenSIPSJS from 'opensips-js'
|
|
262
|
+
import * as VAD from '@ricky0123/vad-web'
|
|
263
|
+
|
|
264
|
+
const opensipsJS = new OpenSIPSJS({
|
|
265
|
+
configuration: {
|
|
266
|
+
// ... other configuration
|
|
267
|
+
noiseReductionOptions: {
|
|
268
|
+
mode: 'dynamic', // or 'enabled'
|
|
269
|
+
noiseThreshold: 0.004,
|
|
270
|
+
checkEveryMs: 500,
|
|
271
|
+
noiseCheckInterval: 2000
|
|
272
|
+
},
|
|
273
|
+
vadModule: VAD // Inject the VAD module
|
|
274
|
+
},
|
|
275
|
+
// ... rest of configuration
|
|
276
|
+
})
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### For React Native Applications (VAD not supported)
|
|
280
|
+
|
|
281
|
+
Simply omit the VAD module and disable noise reduction:
|
|
282
|
+
```javascript
|
|
283
|
+
import OpenSIPSJS from 'opensips-js'
|
|
284
|
+
|
|
285
|
+
const opensipsJS = new OpenSIPSJS({
|
|
286
|
+
configuration: {
|
|
287
|
+
// ... other configuration
|
|
288
|
+
noiseReductionOptions: {
|
|
289
|
+
mode: 'disabled' // or omit noiseReductionOptions entirely
|
|
290
|
+
}
|
|
291
|
+
// NO vadModule needed
|
|
292
|
+
},
|
|
293
|
+
// ... rest of configuration
|
|
294
|
+
})
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**See [VAD_USAGE.md](VAD_USAGE.md) and [EXAMPLES.md](EXAMPLES.md) for detailed usage examples.**
|
|
298
|
+
|
|
299
|
+
#### Configuration Parameters
|
|
247
300
|
|
|
248
301
|
| Parameter | Type | Default | Description |
|
|
249
302
|
|----------------------|----------------------------------|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
250
|
-
| `mode` | `disabled \| enabled \| dynamic` | `disabled` |
|
|
303
|
+
| `mode` | `disabled \| enabled \| dynamic` | `disabled` | Noise reduction mode. **Note**: `enabled` and `dynamic` modes require `vadModule` to be provided |
|
|
251
304
|
| `vadConfig` | `Partial<RealTimeVADOptions>` | `{}` | VAD configuration |
|
|
252
305
|
| `noiseThreshold` | `number` | `0.004` | Noise threshold |
|
|
253
306
|
| `noiseCheckInterval` | `number` | `2000` | The interval, used to check if we need to disable/enable outgoing audio every N-milliseconds |
|
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare class AudioModule {
|
|
|
75
75
|
private vadIntervals;
|
|
76
76
|
private vadMrsIntervals;
|
|
77
77
|
private VUMeter;
|
|
78
|
+
private MicVAD;
|
|
78
79
|
managedAudioContext: ManagedAudioContext;
|
|
79
80
|
constructor(context: OpenSIPSJS);
|
|
80
81
|
private processVADConfiguration;
|
|
@@ -978,6 +979,7 @@ declare type UAConfigurationExtended = UAConfiguration & {
|
|
|
978
979
|
overrideUserAgent?: (userAgent: string) => string
|
|
979
980
|
noiseReductionOptions?: NoiseReductionOptions
|
|
980
981
|
onTransportCallback?: OnTransportCallback
|
|
982
|
+
vadModule?: VADModule
|
|
981
983
|
}
|
|
982
984
|
|
|
983
985
|
declare const UAConstructor: typeof UA;
|
|
@@ -1067,6 +1069,10 @@ declare interface UAExtendedInterface_2 extends UA {
|
|
|
1067
1069
|
|
|
1068
1070
|
declare type updateRoomListener = (value: RoomChangeEmitType) => void
|
|
1069
1071
|
|
|
1072
|
+
declare interface VADModule {
|
|
1073
|
+
MicVAD: any
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1070
1076
|
declare interface VADOptions {
|
|
1071
1077
|
model: 'v5' | 'legacy'
|
|
1072
1078
|
positiveSpeechThreshold: number
|