@voicenter-team/opensips-js 1.0.124 → 1.0.126
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 +276 -6
- package/dist/opensips-js.cjs.js +18334 -133
- package/dist/opensips-js.es.js +77159 -14629
- 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 +6 -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
|
@@ -277,6 +348,7 @@ declare interface ICall extends RTCSessionExtended {
|
|
277
348
|
localHold?: boolean
|
278
349
|
audioTag?: StreamMediaType
|
279
350
|
autoAnswer?: boolean
|
351
|
+
putOnHoldTimestamp?: number
|
280
352
|
}
|
281
353
|
|
282
354
|
declare interface ICallStatus {
|
@@ -301,7 +373,7 @@ declare interface IncomingMSRPSessionEvent {
|
|
301
373
|
|
302
374
|
declare type IncomingMSRPSessionListener = (event: IncomingMSRPSessionEvent) => void;
|
303
375
|
|
304
|
-
declare type IOpenSIPSConfiguration = Omit<
|
376
|
+
declare type IOpenSIPSConfiguration = Omit<UAConfigurationExtended, 'sockets'>
|
305
377
|
|
306
378
|
declare interface IOpenSIPSJSOptions {
|
307
379
|
configuration: IOpenSIPSConfiguration
|
@@ -372,6 +444,12 @@ declare interface JanusSessionEventMap {
|
|
372
444
|
'peerconnection:setremotedescriptionfailed': Listener_2;
|
373
445
|
}
|
374
446
|
|
447
|
+
declare type KonvaDrawerOptions = {
|
448
|
+
strokeWidth?: number
|
449
|
+
strokeColor?: string
|
450
|
+
emptyDrawerRectColor?: string
|
451
|
+
}
|
452
|
+
|
375
453
|
declare type Listener = (event: unknown) => void
|
376
454
|
|
377
455
|
declare type Listener_2 = (event: unknown) => void
|
@@ -384,6 +462,8 @@ declare type ListenerEventType = EndEvent | IncomingEvent | OutgoingEvent | Inco
|
|
384
462
|
|
385
463
|
declare type ListenersKeyType = keyof OpenSIPSEventMap
|
386
464
|
|
465
|
+
declare type MaskEffectTypeConfigType = 'bokehEffect' | 'backgroundImageEffect';
|
466
|
+
|
387
467
|
declare type memberHangupListener = (event: object) => void
|
388
468
|
|
389
469
|
declare type memberJoinListener = (event: object) => void
|
@@ -660,7 +740,11 @@ declare interface OpenSIPSEventMap extends UAEventMap {
|
|
660
740
|
newMSRPSession: MSRPSessionListener
|
661
741
|
// JANUS
|
662
742
|
conferenceStart: conferenceStartListener
|
663
|
-
|
743
|
+
conferenceEnd: conferenceEndListener
|
744
|
+
startScreenShare: startScreenShareListener
|
745
|
+
stopScreenShare: stopScreenShareListener
|
746
|
+
startBlur: startBlurListener
|
747
|
+
stopBlur: stopBlurListener
|
664
748
|
memberJoin: memberJoinListener
|
665
749
|
memberHangup: memberHangupListener
|
666
750
|
changeAudioState: changeAudioStateListener
|
@@ -680,6 +764,7 @@ declare class OpenSIPSJS extends UAExtended {
|
|
680
764
|
private readonly newMSRPSessionEventName;
|
681
765
|
private isMSRPInitializingValue;
|
682
766
|
private isReconnecting;
|
767
|
+
private activeConnection;
|
683
768
|
audio: AudioModule;
|
684
769
|
msrp: MSRPModule;
|
685
770
|
video: VideoModule;
|
@@ -690,7 +775,10 @@ declare class OpenSIPSJS extends UAExtended {
|
|
690
775
|
off<T extends ListenersKeyType>(type: T, listener: ListenerCallbackFnType<T>): this;
|
691
776
|
emit(type: ListenersKeyType, args: any): boolean;
|
692
777
|
get sipDomain(): string;
|
778
|
+
use(plugin: BaseNewStreamPlugin | BaseProcessStreamPlugin): void;
|
779
|
+
getPlugin(name: string): BaseNewStreamPlugin | BaseProcessStreamPlugin;
|
693
780
|
begin(): this;
|
781
|
+
disconnect(): void;
|
694
782
|
subscribe(type: string, listener: (c: RTCSessionExtended) => void): void;
|
695
783
|
removeIListener(value: string): void;
|
696
784
|
triggerListener({ listenerType, session, event }: TriggerListenerOptions): void;
|
@@ -707,6 +795,10 @@ declare interface OutgoingMSRPSessionEvent {
|
|
707
795
|
|
708
796
|
declare type OutgoingMSRPSessionListener = (event: OutgoingMSRPSessionEvent) => void;
|
709
797
|
|
798
|
+
declare interface PluginConfig {
|
799
|
+
immediate: boolean;
|
800
|
+
}
|
801
|
+
|
710
802
|
declare type readyListener = (value: boolean) => void
|
711
803
|
|
712
804
|
declare interface RemoteIdentityCallType {
|
@@ -767,6 +859,124 @@ declare interface RTCSessionExtended extends RTCSession {
|
|
767
859
|
init_icncoming(request: IncomingRequest): void
|
768
860
|
}
|
769
861
|
|
862
|
+
export declare class ScreenSharePlugin extends BaseNewStreamPlugin {
|
863
|
+
constructor();
|
864
|
+
generateStream(): Promise<MediaStream>;
|
865
|
+
kill(): Promise<void>;
|
866
|
+
}
|
867
|
+
|
868
|
+
declare interface ScreenShareWhiteboardOptions {
|
869
|
+
selectors: ScreenShareWhiteboardSelectors;
|
870
|
+
}
|
871
|
+
|
872
|
+
export declare class ScreenShareWhiteBoardPlugin extends BaseProcessStreamPlugin {
|
873
|
+
private video;
|
874
|
+
private wrapperEl;
|
875
|
+
private screenShareKonvaDrawer;
|
876
|
+
private initialStream;
|
877
|
+
private imageSrc;
|
878
|
+
private konvaDrawer;
|
879
|
+
mode: ConferencingModeType;
|
880
|
+
private screenSharePlugin;
|
881
|
+
private selectors;
|
882
|
+
constructor(screenSharePlugin: any, options?: Partial<ScreenShareWhiteboardOptions>);
|
883
|
+
private createVideoElement;
|
884
|
+
private getAspectRatioDimensions;
|
885
|
+
/**
|
886
|
+
* Starts stream processing to add mask effect for it
|
887
|
+
* This method is useful in cases like drawing over the screen share as we
|
888
|
+
* already have a screen share stream and there is no need to create another one
|
889
|
+
* @param {MediaStream} stream
|
890
|
+
* @return {MediaStream} processed stream with mask effect
|
891
|
+
*/
|
892
|
+
start(stream: any): Promise<MediaStream>;
|
893
|
+
/**
|
894
|
+
* Stops stream processing
|
895
|
+
*/
|
896
|
+
stop(): void;
|
897
|
+
setupScreenShareDrawerOptions(options: KonvaDrawerOptions): void;
|
898
|
+
}
|
899
|
+
|
900
|
+
declare interface ScreenShareWhiteboardSelectors {
|
901
|
+
container: string;
|
902
|
+
compositeCanvasContainer: string;
|
903
|
+
compositeCanvas: string;
|
904
|
+
drawerContainer: string;
|
905
|
+
videoElement: string;
|
906
|
+
videoElementContainer: string;
|
907
|
+
document: HTMLElement;
|
908
|
+
}
|
909
|
+
|
910
|
+
declare type startBlurListener = () => void
|
911
|
+
|
912
|
+
declare type startScreenShareListener = (event: MediaStream) => void
|
913
|
+
|
914
|
+
declare type stopBlurListener = () => void
|
915
|
+
|
916
|
+
declare type stopScreenShareListener = () => void
|
917
|
+
|
918
|
+
declare interface StreamMaskOptions {
|
919
|
+
effect: MaskEffectTypeConfigType;
|
920
|
+
base64Image?: string;
|
921
|
+
visualizationConfig?: VisualizationConfigType;
|
922
|
+
}
|
923
|
+
|
924
|
+
export declare class StreamMaskPlugin extends BaseProcessStreamPlugin {
|
925
|
+
private visualizationConfig;
|
926
|
+
private maskEffectType;
|
927
|
+
private base64ImageMask;
|
928
|
+
private rafId;
|
929
|
+
private timeoutId;
|
930
|
+
private segmenter;
|
931
|
+
private camera;
|
932
|
+
private canvas;
|
933
|
+
private ctx;
|
934
|
+
private visibilityState;
|
935
|
+
constructor(options: StreamMaskOptions, pluginConfig?: PluginConfig);
|
936
|
+
/**
|
937
|
+
* Starts stream processing to add mask effect for it
|
938
|
+
* @param {MediaStream} stream
|
939
|
+
* @param {'bokehEffect' | 'backgroundImageEffect'} effect - defines the mask effect type
|
940
|
+
* @param {MediaStreamConstraints} options - media stream constraints
|
941
|
+
* @param {object} options - (optional) additional mask effect options
|
942
|
+
* @return {MediaStream} processed stream with mask effect
|
943
|
+
*/
|
944
|
+
start(stream: any): Promise<MediaStream>;
|
945
|
+
/**
|
946
|
+
* Listens to visibility change (like switching active tab)
|
947
|
+
* and switches between different kinds of requestAnimationFrame
|
948
|
+
*/
|
949
|
+
private processVisibilityChange;
|
950
|
+
/**
|
951
|
+
* Adds audio tracks to MediaStream which contains only video tracks
|
952
|
+
* @param {MediaStream} stream - stream with only video tracks
|
953
|
+
* @param {MediaStreamConstraints} options - media stream constraints
|
954
|
+
* @return {MediaStream} combined stream with both audio and video tracks
|
955
|
+
*/
|
956
|
+
private populateWithAudioTracks;
|
957
|
+
/**
|
958
|
+
* Stops stream processing
|
959
|
+
*/
|
960
|
+
stop(): void;
|
961
|
+
setupVisualizationConfig(config: VisualizationConfigType): void;
|
962
|
+
/**
|
963
|
+
* Starts rendering process by calling itself recursively.
|
964
|
+
* Uses requestAnimationFrame method for recursive invoking.
|
965
|
+
*/
|
966
|
+
private renderPrediction;
|
967
|
+
/**
|
968
|
+
* Creates Body Segmenter which is used for people segmentation and poses estimation
|
969
|
+
* @return {segmenter} segmenter instance
|
970
|
+
*/
|
971
|
+
private createSegmenter;
|
972
|
+
/**
|
973
|
+
* Render function which draws masked effect to canvas.
|
974
|
+
*/
|
975
|
+
private renderResult;
|
976
|
+
private applyBokehEffect;
|
977
|
+
private applyBackgroundImageEffect;
|
978
|
+
}
|
979
|
+
|
770
980
|
declare interface StreamMediaType extends HTMLAudioElement {
|
771
981
|
className: string
|
772
982
|
setSinkId (id: string): Promise<void>
|
@@ -780,6 +990,10 @@ declare interface TriggerListenerOptions {
|
|
780
990
|
event?: ListenerEventType
|
781
991
|
}
|
782
992
|
|
993
|
+
declare type UAConfigurationExtended = UAConfiguration & {
|
994
|
+
overrideUserAgent: (userAgent: string) => string
|
995
|
+
}
|
996
|
+
|
783
997
|
declare const UAConstructor: typeof UA;
|
784
998
|
|
785
999
|
declare class UAExtended extends UAConstructor implements UAExtendedInterface {
|
@@ -791,15 +1005,22 @@ declare class UAExtended extends UAConstructor implements UAExtendedInterface {
|
|
791
1005
|
ict: {};
|
792
1006
|
};
|
793
1007
|
_janus_sessions: any[];
|
1008
|
+
protected newStreamPlugins: Array<BaseNewStreamPlugin>;
|
1009
|
+
protected processStreamPlugins: Array<BaseProcessStreamPlugin>;
|
794
1010
|
constructor(configuration: UAConfiguration);
|
795
1011
|
call(target: string, options?: CallOptionsExtended): RTCSession;
|
796
|
-
joinVideoCall(target:
|
1012
|
+
joinVideoCall(target: string, displayName: string, options: VideoConferenceJoinOptions): any;
|
1013
|
+
startScreenShare(): void;
|
1014
|
+
changeMediaConstraints(constraints: MediaStreamConstraints): void;
|
1015
|
+
startBlur(): void;
|
1016
|
+
stopBlur(): void;
|
797
1017
|
_loadConfig(configuration: any): void;
|
798
1018
|
/**
|
799
1019
|
* new MSRPSession
|
800
1020
|
*/
|
801
1021
|
newMSRPSession(session: MSRPSession, data: object): void;
|
802
1022
|
newJanusSession(session: any, data: any): void;
|
1023
|
+
kill(): void;
|
803
1024
|
/**
|
804
1025
|
* MSRPSession destroyed.
|
805
1026
|
*/
|
@@ -853,6 +1074,12 @@ declare interface UAExtendedInterface_2 extends UA {
|
|
853
1074
|
|
854
1075
|
declare type updateRoomListener = (value: RoomChangeEmitType) => void
|
855
1076
|
|
1077
|
+
declare interface VideoConferenceJoinOptions {
|
1078
|
+
eventHandlers: Array<unknown>;
|
1079
|
+
extraHeaders: Array<string>;
|
1080
|
+
mediaConstraints: MediaStreamConstraints;
|
1081
|
+
}
|
1082
|
+
|
856
1083
|
declare class VideoModule {
|
857
1084
|
private context;
|
858
1085
|
constructor(context: any);
|
@@ -863,10 +1090,23 @@ declare class VideoModule {
|
|
863
1090
|
stopAudio(): void;
|
864
1091
|
startVideo(): void;
|
865
1092
|
stopVideo(): void;
|
1093
|
+
changeMediaConstraints(constraints: MediaStreamConstraints): void;
|
1094
|
+
startScreenShare(): void;
|
1095
|
+
startBlur(): void;
|
1096
|
+
stopBlur(): void;
|
866
1097
|
}
|
867
1098
|
|
868
1099
|
declare type VideoModuleName = typeof MODULES.VIDEO
|
869
1100
|
|
1101
|
+
declare type VisualizationConfigType = {
|
1102
|
+
foregroundThreshold?: number;
|
1103
|
+
maskOpacity?: number;
|
1104
|
+
maskBlur?: number;
|
1105
|
+
pixelCellWidth?: number;
|
1106
|
+
backgroundBlur?: number;
|
1107
|
+
edgeBlur?: number;
|
1108
|
+
};
|
1109
|
+
|
870
1110
|
declare interface WebrtcMetricsConfigType {
|
871
1111
|
refreshEvery?: number
|
872
1112
|
startAfter?: number
|
@@ -879,4 +1119,34 @@ declare interface WebrtcMetricsConfigType {
|
|
879
1119
|
ticket?: boolean
|
880
1120
|
}
|
881
1121
|
|
1122
|
+
declare interface WhiteboardElementSelectors {
|
1123
|
+
container: string;
|
1124
|
+
drawerContainer: string;
|
1125
|
+
konvaContainer: HTMLElement;
|
1126
|
+
document: HTMLElement;
|
1127
|
+
}
|
1128
|
+
|
1129
|
+
declare interface WhiteboardOptions {
|
1130
|
+
mode: ConferencingModeType;
|
1131
|
+
imageSrc?: string;
|
1132
|
+
selectors: Partial<WhiteboardElementSelectors>;
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
export declare class WhiteBoardPlugin extends BaseNewStreamPlugin {
|
1136
|
+
private visualizationConfig;
|
1137
|
+
private rafId;
|
1138
|
+
private imageSrc;
|
1139
|
+
private konvaDrawer;
|
1140
|
+
private selectors;
|
1141
|
+
mode: ConferencingModeType;
|
1142
|
+
constructor(options: WhiteboardOptions);
|
1143
|
+
setupDrawerOptions(options: KonvaDrawerOptions): void;
|
1144
|
+
setMode(mode: ConferencingModeType, imageSrc?: string): void;
|
1145
|
+
setupDrawerImage(imageSrc: any): void;
|
1146
|
+
private drawEmptyWhiteboard;
|
1147
|
+
private drawImageWhiteboard;
|
1148
|
+
generateStream(): Promise<void>;
|
1149
|
+
kill(): Promise<void>;
|
1150
|
+
}
|
1151
|
+
|
882
1152
|
export { }
|