@voicenter-team/opensips-js 1.0.124 → 1.0.125
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/index.d.ts +275 -6
- package/dist/opensips-js.cjs.js +18334 -133
- package/dist/opensips-js.es.js +77132 -14592
- package/dist/opensips-js.iife.js +18337 -136
- package/dist/opensips-js.umd.js +18337 -136
- package/package.json +12 -2
- package/src/types/listeners.d.ts +10 -1
- package/src/types/rtc.d.ts +5 -1
package/dist/index.d.ts
CHANGED
@@ -185,12 +185,68 @@ declare class AudioModule {
|
|
185
185
|
private stopVUMeter;
|
186
186
|
setupStream(): Promise<void>;
|
187
187
|
private triggerAddStream;
|
188
|
-
initCall(target: string, addToCurrentRoom: boolean
|
188
|
+
initCall(target: string, addToCurrentRoom: boolean): void;
|
189
189
|
private processRoomChange;
|
190
190
|
}
|
191
191
|
|
192
192
|
declare type AudioModuleName = typeof MODULES.AUDIO
|
193
193
|
|
194
|
+
export declare class BaseNewStreamPlugin extends BasePlugin {
|
195
|
+
private _candidates;
|
196
|
+
private _subscribeSent;
|
197
|
+
private _configureSent;
|
198
|
+
private _lastTrickleReceived;
|
199
|
+
private _publisherSubscribeSent;
|
200
|
+
private opaqueId;
|
201
|
+
protected handleId: number;
|
202
|
+
private readonly type;
|
203
|
+
protected _connection: RTCPeerConnection;
|
204
|
+
protected jsep_offer: RTCSessionDescription | void;
|
205
|
+
protected _request: unknown;
|
206
|
+
stream: MediaStream;
|
207
|
+
constructor(name: any, type: any);
|
208
|
+
connect(options?: ConnectOptions): void;
|
209
|
+
getStream(): MediaStream;
|
210
|
+
getConnection(): RTCPeerConnection;
|
211
|
+
private _createRTCConnection;
|
212
|
+
private addTracks;
|
213
|
+
private _sendInitialRequest;
|
214
|
+
private _receiveInviteResponse;
|
215
|
+
private _sendConfigureMessage;
|
216
|
+
private _sendDetach;
|
217
|
+
protected stopMedia(): Promise<void>;
|
218
|
+
stop(): Promise<void>;
|
219
|
+
generateStream(): Promise<void>;
|
220
|
+
}
|
221
|
+
|
222
|
+
declare class BasePlugin {
|
223
|
+
opensips: any;
|
224
|
+
session: any;
|
225
|
+
name: string;
|
226
|
+
constructor(name: any);
|
227
|
+
setOpensips(opensips: any): void;
|
228
|
+
setSession(session: any): void;
|
229
|
+
kill(): void;
|
230
|
+
}
|
231
|
+
|
232
|
+
export declare class BaseProcessStreamPlugin extends BasePlugin {
|
233
|
+
stream: any;
|
234
|
+
running: boolean;
|
235
|
+
immediate: boolean;
|
236
|
+
type: string;
|
237
|
+
constructor(name: any, type: any, options?: BaseProcessStreamPluginOptions);
|
238
|
+
start(stream: any): any;
|
239
|
+
stop(): void;
|
240
|
+
process(stream: any): Promise<any>;
|
241
|
+
connect(): Promise<void>;
|
242
|
+
terminate(): void;
|
243
|
+
kill(): Promise<void>;
|
244
|
+
}
|
245
|
+
|
246
|
+
declare interface BaseProcessStreamPluginOptions {
|
247
|
+
immediate?: boolean;
|
248
|
+
}
|
249
|
+
|
194
250
|
declare type CallAddingProgressListener = (callId: string | undefined) => void
|
195
251
|
|
196
252
|
declare interface CallOptionsExtended extends AnswerOptionsExtended {
|
@@ -233,8 +289,6 @@ declare type changeIsDNDListener = (value: boolean) => void
|
|
233
289
|
|
234
290
|
declare type changeIsMutedListener = (value: boolean) => void
|
235
291
|
|
236
|
-
declare type changeMainVideoStreamListener = (event: { name: string, event: MediaStream }) => void
|
237
|
-
|
238
292
|
declare type changeMuteWhenJoinListener = (value: boolean) => void
|
239
293
|
|
240
294
|
declare type changeVideoStateListener = (state: boolean) => void
|
@@ -246,10 +300,27 @@ declare type ChangeVolumeEventType = {
|
|
246
300
|
|
247
301
|
declare type CommonLogMethodType = (...args: unknown[]) => void
|
248
302
|
|
303
|
+
declare type conferenceEndListener = (sessionId) => void
|
304
|
+
|
249
305
|
declare type conferenceStartListener = () => void
|
250
306
|
|
307
|
+
declare const CONFERENCING_MODE: {
|
308
|
+
WHITEBOARD: string;
|
309
|
+
IMAGE_WHITEBOARD: string;
|
310
|
+
};
|
311
|
+
|
312
|
+
declare type ConferencingModeType = typeof CONFERENCING_MODE[keyof typeof CONFERENCING_MODE];
|
313
|
+
|
251
314
|
declare type connectionListener = (value: boolean) => void
|
252
315
|
|
316
|
+
declare interface ConnectOptions {
|
317
|
+
extraHeaders?: Array<string>;
|
318
|
+
fromUserName?: string;
|
319
|
+
fromDisplayName?: string;
|
320
|
+
rtcConstraints?: object;
|
321
|
+
pcConfig?: object;
|
322
|
+
}
|
323
|
+
|
253
324
|
declare interface CustomLoggerType {
|
254
325
|
log: CommonLogMethodType
|
255
326
|
warn: CommonLogMethodType
|
@@ -301,7 +372,7 @@ declare interface IncomingMSRPSessionEvent {
|
|
301
372
|
|
302
373
|
declare type IncomingMSRPSessionListener = (event: IncomingMSRPSessionEvent) => void;
|
303
374
|
|
304
|
-
declare type IOpenSIPSConfiguration = Omit<
|
375
|
+
declare type IOpenSIPSConfiguration = Omit<UAConfigurationExtended, 'sockets'>
|
305
376
|
|
306
377
|
declare interface IOpenSIPSJSOptions {
|
307
378
|
configuration: IOpenSIPSConfiguration
|
@@ -372,6 +443,12 @@ declare interface JanusSessionEventMap {
|
|
372
443
|
'peerconnection:setremotedescriptionfailed': Listener_2;
|
373
444
|
}
|
374
445
|
|
446
|
+
declare type KonvaDrawerOptions = {
|
447
|
+
strokeWidth?: number
|
448
|
+
strokeColor?: string
|
449
|
+
emptyDrawerRectColor?: string
|
450
|
+
}
|
451
|
+
|
375
452
|
declare type Listener = (event: unknown) => void
|
376
453
|
|
377
454
|
declare type Listener_2 = (event: unknown) => void
|
@@ -384,6 +461,8 @@ declare type ListenerEventType = EndEvent | IncomingEvent | OutgoingEvent | Inco
|
|
384
461
|
|
385
462
|
declare type ListenersKeyType = keyof OpenSIPSEventMap
|
386
463
|
|
464
|
+
declare type MaskEffectTypeConfigType = 'bokehEffect' | 'backgroundImageEffect';
|
465
|
+
|
387
466
|
declare type memberHangupListener = (event: object) => void
|
388
467
|
|
389
468
|
declare type memberJoinListener = (event: object) => void
|
@@ -660,7 +739,11 @@ declare interface OpenSIPSEventMap extends UAEventMap {
|
|
660
739
|
newMSRPSession: MSRPSessionListener
|
661
740
|
// JANUS
|
662
741
|
conferenceStart: conferenceStartListener
|
663
|
-
|
742
|
+
conferenceEnd: conferenceEndListener
|
743
|
+
startScreenShare: startScreenShareListener
|
744
|
+
stopScreenShare: stopScreenShareListener
|
745
|
+
startBlur: startBlurListener
|
746
|
+
stopBlur: stopBlurListener
|
664
747
|
memberJoin: memberJoinListener
|
665
748
|
memberHangup: memberHangupListener
|
666
749
|
changeAudioState: changeAudioStateListener
|
@@ -680,6 +763,7 @@ declare class OpenSIPSJS extends UAExtended {
|
|
680
763
|
private readonly newMSRPSessionEventName;
|
681
764
|
private isMSRPInitializingValue;
|
682
765
|
private isReconnecting;
|
766
|
+
private activeConnection;
|
683
767
|
audio: AudioModule;
|
684
768
|
msrp: MSRPModule;
|
685
769
|
video: VideoModule;
|
@@ -690,7 +774,10 @@ declare class OpenSIPSJS extends UAExtended {
|
|
690
774
|
off<T extends ListenersKeyType>(type: T, listener: ListenerCallbackFnType<T>): this;
|
691
775
|
emit(type: ListenersKeyType, args: any): boolean;
|
692
776
|
get sipDomain(): string;
|
777
|
+
use(plugin: BaseNewStreamPlugin | BaseProcessStreamPlugin): void;
|
778
|
+
getPlugin(name: string): BaseNewStreamPlugin | BaseProcessStreamPlugin;
|
693
779
|
begin(): this;
|
780
|
+
disconnect(): void;
|
694
781
|
subscribe(type: string, listener: (c: RTCSessionExtended) => void): void;
|
695
782
|
removeIListener(value: string): void;
|
696
783
|
triggerListener({ listenerType, session, event }: TriggerListenerOptions): void;
|
@@ -707,6 +794,10 @@ declare interface OutgoingMSRPSessionEvent {
|
|
707
794
|
|
708
795
|
declare type OutgoingMSRPSessionListener = (event: OutgoingMSRPSessionEvent) => void;
|
709
796
|
|
797
|
+
declare interface PluginConfig {
|
798
|
+
immediate: boolean;
|
799
|
+
}
|
800
|
+
|
710
801
|
declare type readyListener = (value: boolean) => void
|
711
802
|
|
712
803
|
declare interface RemoteIdentityCallType {
|
@@ -767,6 +858,124 @@ declare interface RTCSessionExtended extends RTCSession {
|
|
767
858
|
init_icncoming(request: IncomingRequest): void
|
768
859
|
}
|
769
860
|
|
861
|
+
export declare class ScreenSharePlugin extends BaseNewStreamPlugin {
|
862
|
+
constructor();
|
863
|
+
generateStream(): Promise<MediaStream>;
|
864
|
+
kill(): Promise<void>;
|
865
|
+
}
|
866
|
+
|
867
|
+
declare interface ScreenShareWhiteboardOptions {
|
868
|
+
selectors: ScreenShareWhiteboardSelectors;
|
869
|
+
}
|
870
|
+
|
871
|
+
export declare class ScreenShareWhiteBoardPlugin extends BaseProcessStreamPlugin {
|
872
|
+
private static video;
|
873
|
+
private static wrapperEl;
|
874
|
+
private static screenShareKonvaDrawer;
|
875
|
+
private static initialStream;
|
876
|
+
private imageSrc;
|
877
|
+
private konvaDrawer;
|
878
|
+
mode: ConferencingModeType;
|
879
|
+
private screenSharePlugin;
|
880
|
+
private selectors;
|
881
|
+
constructor(screenSharePlugin: any, options?: Partial<ScreenShareWhiteboardOptions>);
|
882
|
+
private createVideoElement;
|
883
|
+
private getAspectRatioDimensions;
|
884
|
+
/**
|
885
|
+
* Starts stream processing to add mask effect for it
|
886
|
+
* This method is useful in cases like drawing over the screen share as we
|
887
|
+
* already have a screen share stream and there is no need to create another one
|
888
|
+
* @param {MediaStream} stream
|
889
|
+
* @return {MediaStream} processed stream with mask effect
|
890
|
+
*/
|
891
|
+
start(stream: any): Promise<MediaStream>;
|
892
|
+
/**
|
893
|
+
* Stops stream processing
|
894
|
+
*/
|
895
|
+
stop(): void;
|
896
|
+
setupScreenShareDrawerOptions(options: KonvaDrawerOptions): void;
|
897
|
+
}
|
898
|
+
|
899
|
+
declare interface ScreenShareWhiteboardSelectors {
|
900
|
+
container: string;
|
901
|
+
compositeCanvasContainer: string;
|
902
|
+
compositeCanvas: string;
|
903
|
+
drawerContainer: string;
|
904
|
+
videoElement: string;
|
905
|
+
videoElementContainer: string;
|
906
|
+
document: HTMLElement;
|
907
|
+
}
|
908
|
+
|
909
|
+
declare type startBlurListener = () => void
|
910
|
+
|
911
|
+
declare type startScreenShareListener = (event: MediaStream) => void
|
912
|
+
|
913
|
+
declare type stopBlurListener = () => void
|
914
|
+
|
915
|
+
declare type stopScreenShareListener = () => void
|
916
|
+
|
917
|
+
declare interface StreamMaskOptions {
|
918
|
+
effect: MaskEffectTypeConfigType;
|
919
|
+
base64Image?: string;
|
920
|
+
visualizationConfig?: VisualizationConfigType;
|
921
|
+
}
|
922
|
+
|
923
|
+
export declare class StreamMaskPlugin extends BaseProcessStreamPlugin {
|
924
|
+
private visualizationConfig;
|
925
|
+
private maskEffectType;
|
926
|
+
private base64ImageMask;
|
927
|
+
private rafId;
|
928
|
+
private timeoutId;
|
929
|
+
private segmenter;
|
930
|
+
private camera;
|
931
|
+
private canvas;
|
932
|
+
private ctx;
|
933
|
+
private visibilityState;
|
934
|
+
constructor(options: StreamMaskOptions, pluginConfig?: PluginConfig);
|
935
|
+
/**
|
936
|
+
* Starts stream processing to add mask effect for it
|
937
|
+
* @param {MediaStream} stream
|
938
|
+
* @param {'bokehEffect' | 'backgroundImageEffect'} effect - defines the mask effect type
|
939
|
+
* @param {MediaStreamConstraints} options - media stream constraints
|
940
|
+
* @param {object} options - (optional) additional mask effect options
|
941
|
+
* @return {MediaStream} processed stream with mask effect
|
942
|
+
*/
|
943
|
+
start(stream: any): Promise<MediaStream>;
|
944
|
+
/**
|
945
|
+
* Listens to visibility change (like switching active tab)
|
946
|
+
* and switches between different kinds of requestAnimationFrame
|
947
|
+
*/
|
948
|
+
private processVisibilityChange;
|
949
|
+
/**
|
950
|
+
* Adds audio tracks to MediaStream which contains only video tracks
|
951
|
+
* @param {MediaStream} stream - stream with only video tracks
|
952
|
+
* @param {MediaStreamConstraints} options - media stream constraints
|
953
|
+
* @return {MediaStream} combined stream with both audio and video tracks
|
954
|
+
*/
|
955
|
+
private populateWithAudioTracks;
|
956
|
+
/**
|
957
|
+
* Stops stream processing
|
958
|
+
*/
|
959
|
+
stop(): void;
|
960
|
+
setupVisualizationConfig(config: VisualizationConfigType): void;
|
961
|
+
/**
|
962
|
+
* Starts rendering process by calling itself recursively.
|
963
|
+
* Uses requestAnimationFrame method for recursive invoking.
|
964
|
+
*/
|
965
|
+
private renderPrediction;
|
966
|
+
/**
|
967
|
+
* Creates Body Segmenter which is used for people segmentation and poses estimation
|
968
|
+
* @return {segmenter} segmenter instance
|
969
|
+
*/
|
970
|
+
private createSegmenter;
|
971
|
+
/**
|
972
|
+
* Render function which draws masked effect to canvas.
|
973
|
+
*/
|
974
|
+
private renderResult;
|
975
|
+
private applyBokehEffect;
|
976
|
+
private applyBackgroundImageEffect;
|
977
|
+
}
|
978
|
+
|
770
979
|
declare interface StreamMediaType extends HTMLAudioElement {
|
771
980
|
className: string
|
772
981
|
setSinkId (id: string): Promise<void>
|
@@ -780,6 +989,10 @@ declare interface TriggerListenerOptions {
|
|
780
989
|
event?: ListenerEventType
|
781
990
|
}
|
782
991
|
|
992
|
+
declare type UAConfigurationExtended = UAConfiguration & {
|
993
|
+
overrideUserAgent: (userAgent: string) => string
|
994
|
+
}
|
995
|
+
|
783
996
|
declare const UAConstructor: typeof UA;
|
784
997
|
|
785
998
|
declare class UAExtended extends UAConstructor implements UAExtendedInterface {
|
@@ -791,15 +1004,22 @@ declare class UAExtended extends UAConstructor implements UAExtendedInterface {
|
|
791
1004
|
ict: {};
|
792
1005
|
};
|
793
1006
|
_janus_sessions: any[];
|
1007
|
+
protected newStreamPlugins: Array<BaseNewStreamPlugin>;
|
1008
|
+
protected processStreamPlugins: Array<BaseProcessStreamPlugin>;
|
794
1009
|
constructor(configuration: UAConfiguration);
|
795
1010
|
call(target: string, options?: CallOptionsExtended): RTCSession;
|
796
|
-
joinVideoCall(target:
|
1011
|
+
joinVideoCall(target: string, displayName: string, options: VideoConferenceJoinOptions): any;
|
1012
|
+
startScreenShare(): void;
|
1013
|
+
changeMediaConstraints(constraints: MediaStreamConstraints): void;
|
1014
|
+
startBlur(): void;
|
1015
|
+
stopBlur(): void;
|
797
1016
|
_loadConfig(configuration: any): void;
|
798
1017
|
/**
|
799
1018
|
* new MSRPSession
|
800
1019
|
*/
|
801
1020
|
newMSRPSession(session: MSRPSession, data: object): void;
|
802
1021
|
newJanusSession(session: any, data: any): void;
|
1022
|
+
kill(): void;
|
803
1023
|
/**
|
804
1024
|
* MSRPSession destroyed.
|
805
1025
|
*/
|
@@ -853,6 +1073,12 @@ declare interface UAExtendedInterface_2 extends UA {
|
|
853
1073
|
|
854
1074
|
declare type updateRoomListener = (value: RoomChangeEmitType) => void
|
855
1075
|
|
1076
|
+
declare interface VideoConferenceJoinOptions {
|
1077
|
+
eventHandlers: Array<unknown>;
|
1078
|
+
extraHeaders: Array<string>;
|
1079
|
+
mediaConstraints: MediaStreamConstraints;
|
1080
|
+
}
|
1081
|
+
|
856
1082
|
declare class VideoModule {
|
857
1083
|
private context;
|
858
1084
|
constructor(context: any);
|
@@ -863,10 +1089,23 @@ declare class VideoModule {
|
|
863
1089
|
stopAudio(): void;
|
864
1090
|
startVideo(): void;
|
865
1091
|
stopVideo(): void;
|
1092
|
+
changeMediaConstraints(constraints: MediaStreamConstraints): void;
|
1093
|
+
startScreenShare(): void;
|
1094
|
+
startBlur(): void;
|
1095
|
+
stopBlur(): void;
|
866
1096
|
}
|
867
1097
|
|
868
1098
|
declare type VideoModuleName = typeof MODULES.VIDEO
|
869
1099
|
|
1100
|
+
declare type VisualizationConfigType = {
|
1101
|
+
foregroundThreshold?: number;
|
1102
|
+
maskOpacity?: number;
|
1103
|
+
maskBlur?: number;
|
1104
|
+
pixelCellWidth?: number;
|
1105
|
+
backgroundBlur?: number;
|
1106
|
+
edgeBlur?: number;
|
1107
|
+
};
|
1108
|
+
|
870
1109
|
declare interface WebrtcMetricsConfigType {
|
871
1110
|
refreshEvery?: number
|
872
1111
|
startAfter?: number
|
@@ -879,4 +1118,34 @@ declare interface WebrtcMetricsConfigType {
|
|
879
1118
|
ticket?: boolean
|
880
1119
|
}
|
881
1120
|
|
1121
|
+
declare interface WhiteboardElementSelectors {
|
1122
|
+
container: string;
|
1123
|
+
drawerContainer: string;
|
1124
|
+
konvaContainer: HTMLElement;
|
1125
|
+
document: HTMLElement;
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
declare interface WhiteboardOptions {
|
1129
|
+
mode: ConferencingModeType;
|
1130
|
+
imageSrc?: string;
|
1131
|
+
selectors: Partial<WhiteboardElementSelectors>;
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
export declare class WhiteBoardPlugin extends BaseNewStreamPlugin {
|
1135
|
+
private visualizationConfig;
|
1136
|
+
private rafId;
|
1137
|
+
private imageSrc;
|
1138
|
+
private konvaDrawer;
|
1139
|
+
private selectors;
|
1140
|
+
mode: ConferencingModeType;
|
1141
|
+
constructor(options: WhiteboardOptions);
|
1142
|
+
setupDrawerOptions(options: KonvaDrawerOptions): void;
|
1143
|
+
setMode(mode: ConferencingModeType, imageSrc?: string): void;
|
1144
|
+
setupDrawerImage(imageSrc: any): void;
|
1145
|
+
private drawEmptyWhiteboard;
|
1146
|
+
private drawImageWhiteboard;
|
1147
|
+
generateStream(): Promise<void>;
|
1148
|
+
kill(): Promise<void>;
|
1149
|
+
}
|
1150
|
+
|
882
1151
|
export { }
|