@voicenter-team/opensips-js 1.0.46 → 1.0.74

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
@@ -29,23 +29,25 @@ const openSIPSJS = new OpenSIPSJS({
29
29
  Then you will be able to call next methods on openSIPSJS instance:
30
30
 
31
31
  ### Methods
32
- - `async setMediaDevices(setDefaults: Boolean = false)` - will set up media devices
33
- - `async setMicrophone(deviceId: String)` - set passed device as input device for calls
34
- - `async setSpeaker(deviceId: String)` - set passed device as output device for calls
35
- - `async setCurrentActiveRoomId(roomId: Number)` - move to the room
36
- - `doCallHold({callId: Number, toHold: Boolean, automatic: Boolean})` - hold/unhold call by id
37
- - `doCall(target: String, addToCurrentRoom: Boolean)` - call to the target. If addToCurrentRoom is true then the call will be added to the user's current room
38
- - `callTerminate(callId: String)` - terminate call
39
- - `callTransfer({callId: String, target: String})` - transfer call to target
40
- - `callMerge(roomId: Number)` - merge calls in specific room
41
- - `callAnswer(callId: String)` - answer the call
42
- - `setMetricsConfig(config: WebrtcMetricsConfigType)` - set the metric config (used for audio quality indicator)
43
- - `doMute(muted: Boolean)` - set the agent muteness
44
- - `setDND(value: Boolean)` - set the agent "Do not disturb" status
45
- - `async callChangeRoom({callId: String, roomId: Number})` - move call to the room
46
- - `callMove({callId: String, roomId: Number})` - Same as callChangeRoom. Move call to the specific room
47
- - `subscribe({type: String, listener: function})` - subscribe to an event. Available events: `new_call`, `ended`, `progress`, `failed`, `confirmed`
48
- - `removeIListener(type: String)` - remove event listener
32
+ - `initCall(target: String, addToCurrentRoom: Boolean): void` - call to the target. If addToCurrentRoom is true then the call will be added to the user's current room
33
+ - `holdCall(callId: String, automatic?: Boolean): Promise<void>` - put call on hold
34
+ - `unholdCall(callId: String): Promise<void>` - unhold a call
35
+ - `terminateCall(callId: String): void` - terminate call
36
+ - `moveCall({callId: String, roomId: Number}): Promise<void>` - Same as callChangeRoom. Move call to the specific room
37
+ - `transferCall({callId: String, target: String}): void` - transfer call to target
38
+ - `mergeCall(roomId: Number): void` - merge calls in specific room. Works only for rooms with 2 calls inside
39
+ - `answerCall(callId: String): void` - answer a call
40
+ - `mute(): void` - mute ourself
41
+ - `unmute(): void` - unmute ourself
42
+ - `muteCaller(callId: String): void` - mute caller
43
+ - `unmuteCaller(callId: String): void` - unmute caller
44
+ - `setMicrophone(deviceId: String): Promise<void>` - set passed device as input device for calls
45
+ - `setSpeaker(deviceId: String): Promise<void>` - set passed device as output device for calls
46
+ - `setActiveRoom(roomId: Number): Promise<void>` - switch to the room
47
+ - `setDND(value: Boolean): void` - set the agent "Do not disturb" status
48
+ - `subscribe({type: String, listener: function}): void` - subscribe to an event. Available events: `new_call`, `ended`, `progress`, `failed`, `confirmed`
49
+ - `removeIListener(type: String): void` - remove event listener
50
+ - `setMetricsConfig(config: WebrtcMetricsConfigType): void` - set the metric config (used for audio quality indicator)
49
51
 
50
52
  WebrtcMetricsConfigType
51
53
 
@@ -72,4 +74,4 @@ Also there are next public fields on openSIPSJS instance:
72
74
  - `selectedInputDevice: String` - returns current selected input device id
73
75
  - `selectedOutputDevice: String` - returns current selected output device id
74
76
  - `isDND: Boolean` - returns if the agent is in "Do not disturb" status
75
- - `isMuted: Boolean` - returns if the agent is muted
77
+ - `isMuted: Boolean` - returns if the agent is muted
package/dist/index.d.ts CHANGED
@@ -63,6 +63,8 @@ declare type changeActiveMessagesListener = (event: { [key: string]: IMessage })
63
63
 
64
64
  declare type changeActiveOutputMediaDeviceListener = (event: string) => void
65
65
 
66
+ declare type changeActiveStreamListener = (value: MediaStream) => void
67
+
66
68
  declare type changeAvailableDeviceListListener = (event: Array<MediaDeviceInfo>) => void
67
69
 
68
70
  declare type changeCallMetricsListener = (event: { [key: string]: any }) => void
@@ -71,13 +73,18 @@ declare type changeCallStatusListener = (event: { [key: string]: ICallStatus })
71
73
 
72
74
  declare type changeCallTimeListener = (event: { [key: string]: ITimeData }) => void
73
75
 
76
+ declare type changeCallVolumeListener = (event: ChangeVolumeEventType) => void
77
+
74
78
  declare type changeIsDNDListener = (value: boolean) => void
75
79
 
76
80
  declare type changeIsMutedListener = (value: boolean) => void
77
81
 
78
82
  declare type changeMuteWhenJoinListener = (value: boolean) => void
79
83
 
80
- declare type changeOriginalStreamListener = (value: MediaStream) => void
84
+ declare type ChangeVolumeEventType = {
85
+ callId: string
86
+ volume: number
87
+ }
81
88
 
82
89
  declare type CommonLogMethodType = (...args: unknown[]) => void
83
90
 
@@ -116,11 +123,6 @@ declare interface ICallStatus {
116
123
  isMerging: boolean
117
124
  }
118
125
 
119
- declare interface IDoCallParam {
120
- target: string
121
- addToCurrentRoom: boolean
122
- }
123
-
124
126
  declare interface IMessage extends MSRPSessionExtended {
125
127
  roomId?: number
126
128
  localMuted?: boolean
@@ -396,13 +398,14 @@ declare interface OpenSIPSEventMap extends UAEventMap {
396
398
  changeMuteWhenJoin: changeMuteWhenJoinListener
397
399
  changeIsDND: changeIsDNDListener
398
400
  changeIsMuted: changeIsMutedListener
399
- changeOriginalStream: changeOriginalStreamListener
401
+ changeActiveStream: changeActiveStreamListener
400
402
  addRoom: addRoomListener
401
403
  updateRoom: updateRoomListener
402
404
  removeRoom: removeRoomListener
403
405
  changeCallStatus: changeCallStatusListener
404
406
  changeCallTime: changeCallTimeListener
405
407
  changeCallMetrics: changeCallMetricsListener
408
+ changeCallVolume: changeCallVolumeListener
406
409
  newMSRPMessage: MSRPMessageListener
407
410
  newMSRPSession: MSRPSessionListener
408
411
  }
@@ -411,6 +414,7 @@ declare class OpenSIPSJS extends UAExtended {
411
414
  private initialized;
412
415
  private readonly options;
413
416
  private logger;
417
+ private VUMeter;
414
418
  private readonly newRTCSessionEventName;
415
419
  private readonly registeredEventName;
416
420
  private readonly unregisteredEventName;
@@ -436,7 +440,8 @@ declare class OpenSIPSJS extends UAExtended {
436
440
  private callMetrics;
437
441
  private timeIntervals;
438
442
  private metricConfig;
439
- private originalStreamValue;
443
+ private activeStreamValue;
444
+ private initialStreamValue;
440
445
  private currentActiveRoomIdValue;
441
446
  private isCallAddingInProgress;
442
447
  private isMSRPInitializingValue;
@@ -491,32 +496,31 @@ declare class OpenSIPSJS extends UAExtended {
491
496
  };
492
497
  video: boolean;
493
498
  };
494
- get getInputDefaultDevice(): MediaDeviceInfo;
495
- get getOutputDefaultDevice(): MediaDeviceInfo;
496
499
  get selectedInputDevice(): string;
497
500
  get selectedOutputDevice(): string;
498
- get originalStream(): MediaStream;
501
+ get activeStream(): MediaStream;
499
502
  private setAvailableMediaDevices;
500
503
  updateDeviceList(): Promise<void>;
501
- setMediaDevices(setDefaults?: boolean): Promise<void>;
504
+ private initializeMediaDevices;
502
505
  setCallTime(value: ITimeData): void;
503
506
  removeCallTime(callId: string): void;
504
507
  private setTimeInterval;
505
508
  private removeTimeInterval;
506
509
  private stopCallTimer;
510
+ private emitVolumeChange;
507
511
  setMetricsConfig(config: WebrtcMetricsConfigType): void;
508
512
  sendDTMF(callId: string, value: string): void;
509
513
  private setIsMuted;
510
- doMute(value: boolean): void;
511
- doCallHold({ callId, toHold, automatic }: {
512
- callId: string;
513
- toHold: boolean;
514
- automatic?: boolean;
515
- }): void;
514
+ private processMute;
515
+ mute(): void;
516
+ unmute(): void;
517
+ private processHold;
518
+ holdCall(callId: string, automatic?: boolean): Promise<void>;
519
+ unholdCall(callId: string): Promise<void>;
516
520
  private cancelAllOutgoingUnanswered;
517
- callAnswer(callId: string): void;
521
+ answerCall(callId: string): void;
518
522
  msrpAnswer(callId: string): void;
519
- callMove(callId: string, roomId: number): Promise<void>;
523
+ moveCall(callId: string, roomId: number): Promise<void>;
520
524
  updateCall(value: ICall): void;
521
525
  updateMSRPSession(value: IMessage): void;
522
526
  updateRoom(value: IRoomUpdate): void;
@@ -528,8 +532,9 @@ declare class OpenSIPSJS extends UAExtended {
528
532
  private updateCallStatus;
529
533
  private removeCallStatus;
530
534
  private addRoom;
535
+ private getActiveStream;
531
536
  setMicrophone(dId: string): Promise<void>;
532
- private setOriginalStream;
537
+ private setActiveStream;
533
538
  setSpeaker(dId: string): Promise<void>;
534
539
  private removeRoom;
535
540
  private deleteRoomIfEmpty;
@@ -537,14 +542,16 @@ declare class OpenSIPSJS extends UAExtended {
537
542
  private muteReconfigure;
538
543
  private roomReconfigure;
539
544
  private doConference;
540
- muteCaller(callId: string, value: boolean): void;
541
- callTerminate(callId: string): void;
545
+ private processCallerMute;
546
+ muteCaller(callId: string): void;
547
+ unmuteCaller(callId: string): void;
548
+ terminateCall(callId: string): void;
542
549
  messageTerminate(callId: string): void;
543
- callTransfer(callId: string, target: string): void;
544
- callMerge(roomId: number): void;
550
+ transferCall(callId: string, target: string): Error;
551
+ mergeCall(roomId: number): void;
545
552
  setDND(value: boolean): void;
546
553
  private startCallTimer;
547
- setCurrentActiveRoomId(roomId: number | undefined): Promise<void>;
554
+ setActiveRoom(roomId: number | undefined): Promise<void>;
548
555
  private getNewRoomId;
549
556
  subscribe(type: string, listener: (c: RTCSessionExtended) => void): void;
550
557
  removeIListener(value: string): void;
@@ -570,11 +577,14 @@ declare class OpenSIPSJS extends UAExtended {
570
577
  private setCallMetrics;
571
578
  private removeCallMetrics;
572
579
  private getCallQuality;
580
+ private setupVUMeter;
581
+ private stopVUMeter;
582
+ setupStream(): Promise<void>;
573
583
  private triggerAddStream;
574
- doCall({ target, addToCurrentRoom }: IDoCallParam): void;
584
+ initCall(target: string, addToCurrentRoom: boolean): void;
575
585
  initMSRP(target: string, body: string, options: any): void;
576
586
  sendMSRP(msrpSessionId: string, body: string): void;
577
- private callChangeRoom;
587
+ private processRoomChange;
578
588
  }
579
589
  export default OpenSIPSJS;
580
590