@voicenter-team/events-sdk 0.0.10 → 0.0.11

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.
@@ -0,0 +1,20 @@
1
+ import EventsSdkClass from '../events-sdk/events-sdk.class';
2
+ import { EventsSdkOptions } from '../events-sdk/events-sdk.types';
3
+ declare class AuthClass {
4
+ private readonly eventsSdkClass;
5
+ constructor(eventsSdkClass: EventsSdkClass);
6
+ private delay;
7
+ lastLoginTimestamp: number | undefined;
8
+ token: string | undefined;
9
+ private storageKey;
10
+ login(options: EventsSdkOptions): Promise<void>;
11
+ updateLastLoginTimestamp(): void;
12
+ private checkLoginStatus;
13
+ private userLoginFunction;
14
+ private onLoginResponse;
15
+ handleTokenExpiry(): void;
16
+ private externalLogin;
17
+ private getSettings;
18
+ private refreshToken;
19
+ }
20
+ export default AuthClass;
@@ -0,0 +1,4 @@
1
+ declare const newLoginUrl = "https://loginapidev.voicenter.co.il/Auth/Login/Voicenter/Monitor";
2
+ declare const getSettingsUrl = "https://loginapidev.voicenter.co.il/Application/GetSettings";
3
+ declare const refreshTokenUrl = "https://loginapidev.voicenter.co.il/Auth/RefreshToken";
4
+ export { newLoginUrl, getSettingsUrl, refreshTokenUrl };
@@ -0,0 +1,2 @@
1
+ import { EventsSdkOptions } from './events-sdk.types';
2
+ export declare const eventsSdkDefaultOptions: EventsSdkOptions;
@@ -0,0 +1,35 @@
1
+ import AuthClass from '../auth/auth.class';
2
+ import { SocketIoClass } from '../socket-io/socket-io.class';
3
+ import { EventsSdkOptions, ReconnectOptions, Server, ServerParameter } from './events-sdk.types';
4
+ import { SocketTyped } from '../../types/socket';
5
+ import { GenericEventWrapper, EventSpecificCallback, EventTypeData, EventTypeNames } from '../../types/events';
6
+ declare class EventsSdkClass {
7
+ constructor(options: EventsSdkOptions);
8
+ private argumentOptions;
9
+ readonly options: EventsSdkOptions;
10
+ servers: Server[];
11
+ server: Server;
12
+ socket: SocketTyped | undefined;
13
+ authClass: AuthClass;
14
+ socketIoClass: SocketIoClass;
15
+ reconnectOptions: ReconnectOptions;
16
+ retryConnection: import("lodash").DebouncedFuncLeading<(server?: ServerParameter, skipLogin?: boolean) => void>;
17
+ private listeners;
18
+ private allListeners;
19
+ on<T extends EventTypeNames>(event: T, callback: EventSpecificCallback<T>): void;
20
+ on(event: '*', callback: (data: GenericEventWrapper) => void): void;
21
+ off<T extends EventTypeNames>(event: T, callback: EventSpecificCallback<T>): void;
22
+ off(event: '*', callback: (data: GenericEventWrapper) => void): void;
23
+ emit<T extends EventTypeNames>(event: T, data: EventTypeData<T>): void;
24
+ connect(server?: ServerParameter, skipLogin?: boolean): void;
25
+ disconnect(): void;
26
+ clearKeepAliveInterval(): void;
27
+ private findCurrentServer;
28
+ private findNextAvailableServer;
29
+ private findMaxPriorityServer;
30
+ private findMinPriorityServer;
31
+ getServerWithHighestPriority(servers: Server[]): Server;
32
+ init(): Promise<boolean>;
33
+ private getServers;
34
+ }
35
+ export default EventsSdkClass;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ import { LoginType } from '../../enum/auth.enum';
2
+ export interface EventsSdkOptions {
3
+ fallbackServer: Server;
4
+ refreshTokenUrl?: string;
5
+ refreshToken?: string;
6
+ servers?: string;
7
+ token: string;
8
+ tokenExpiry?: Date;
9
+ loginType: LoginType;
10
+ forceNew?: boolean;
11
+ reconnectionDelay: number;
12
+ reconnectionDelayMax?: number;
13
+ maxReconnectAttempts: number;
14
+ timeout?: number;
15
+ keepAliveTimeout: number;
16
+ idleInterval?: number;
17
+ protocol: string;
18
+ transports?: string[];
19
+ upgrade?: boolean;
20
+ serverFetchStrategy?: string;
21
+ serverType?: number;
22
+ useLogger?: boolean;
23
+ loggerSocketConnection?: string;
24
+ loggerServer?: string;
25
+ loggerConfig?: LoggerConfig;
26
+ loggerConnectOptions?: LoggerConnectOptions;
27
+ email: string;
28
+ password: string;
29
+ username: string;
30
+ }
31
+ export interface Server {
32
+ Priority: number;
33
+ Domain: string;
34
+ URLID: number;
35
+ Version: string;
36
+ }
37
+ export interface LoggerConfig {
38
+ logToConsole?: boolean;
39
+ overloadGlobalConsole?: boolean;
40
+ namespace?: string;
41
+ socketEmitInterval?: number;
42
+ }
43
+ export interface LoggerConnectOptions {
44
+ reconnection?: boolean;
45
+ reconnectionDelay?: number;
46
+ reconnectionAttempts?: number;
47
+ perMessageDeflate?: boolean;
48
+ upgrade?: boolean;
49
+ transports?: string[];
50
+ debug?: boolean;
51
+ }
52
+ export interface ReconnectOptions {
53
+ retryCount: number;
54
+ maxReconnectAttempts: number;
55
+ reconnectionDelay: number;
56
+ minReconnectionDelay: number;
57
+ maxReconnectionDelay: number;
58
+ }
59
+ export declare enum ServerParameter {
60
+ DEFAULT = "default",
61
+ NEXT = "next",
62
+ PREVIOUS = "previous"
63
+ }
@@ -0,0 +1,23 @@
1
+ import EventsSdkClass from '../events-sdk/events-sdk.class';
2
+ import { TypedSocketIo } from './versions';
3
+ import { SocketTyped } from '../../types/socket';
4
+ export declare class SocketIoClass {
5
+ private readonly eventsSdkClass;
6
+ constructor(eventsSdkClass: EventsSdkClass);
7
+ io: SocketTyped | undefined;
8
+ ioFunction: TypedSocketIo | undefined;
9
+ lastEventTimestamp: number;
10
+ doReconnect: boolean;
11
+ private keepAliveInterval;
12
+ private keepReconnectInterval;
13
+ private connected;
14
+ getSocketIoFunction(Client: string): void;
15
+ initSocketConnection(): void;
16
+ initSocketEvents(): void;
17
+ clearKeepAliveInterval(): void;
18
+ initKeepAlive(): void;
19
+ closeAllConnections(): void;
20
+ private onKeepAliveResponse;
21
+ private onConnect;
22
+ private onDisconnect;
23
+ }
@@ -0,0 +1,10 @@
1
+ export interface SocketIoOptions {
2
+ reconnection: boolean,
3
+ perMessageDeflate: boolean,
4
+ upgrade: boolean,
5
+ transports: string[],
6
+ debug: boolean,
7
+ query: {
8
+ token: string
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ import { io } from 'socket.io-client';
2
+ import { SocketTyped } from '../../../types/socket';
3
+ export type TypedSocketIo = (...args: Parameters<typeof io>) => SocketTyped;
4
+ declare const _default: {
5
+ getSocketVersion: (version: string) => TypedSocketIo;
6
+ makeSocketVersion: (version: string, uri: string, opts?: Partial<import("socket.io-client").ManagerOptions & import("socket.io-client").SocketOptions> | undefined) => SocketTyped;
7
+ };
8
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { LoginSessionData } from '../../types/auth';
2
+ export declare class StorageClass {
3
+ static getSessionStorageDataByKey(key: string): Promise<LoginSessionData | undefined>;
4
+ static updateSessionStorageKey(key: string, storageData: LoginSessionData): Promise<void>;
5
+ static clearSessionStorage(): void;
6
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum LoginType {
2
+ USER = "User",
3
+ TOKEN = "Token"
4
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * All events that can be received from the server.
3
+ */
4
+ export declare enum EventsEnum {
5
+ ALL_DIALER_STATUS = "AllDialersStatus",
6
+ ALL_EXTENSION_STATUS = "AllExtensionsStatus",
7
+ ALL_USERS_STATUS = "AllUsersStatus",
8
+ CONNECT = "connect",
9
+ DISCONNECT = "disconnect",
10
+ EXTENSION_EVENT = "ExtensionEvent",
11
+ KEEP_ALIVE = "keepalive",
12
+ KEEP_ALIVE_RESPONSE = "keepaliveResponse",
13
+ LOGIN_STATUS = "loginStatus",
14
+ LOGIN_SUCCESS = "loginSuccess",
15
+ QUEUE_EVENT = "QueueEvent",
16
+ ONLINE_STATUS_EVENT = "onlineStatusEvent",
17
+ DIALER_EVENT = "DialerEvent"
18
+ }
19
+ /**
20
+ * All the reasons for the extension event, e.g. a new call is ringing or dialing from an extension.
21
+ */
22
+ export declare enum ExtensionEventReasonEnum {
23
+ NEW_CALL = "NEWCALL",
24
+ ANSWER = "ANSWER",
25
+ HOLD = "HOLD",
26
+ UNHOLD = "UNHOLD",
27
+ HANGUP = "HANGUP",
28
+ USER_STATUS_UPDATE = "userStatusUpdate"
29
+ }
30
+ export declare enum QueueEventReasonEnum {
31
+ ANSWER = "ANSWER",
32
+ ABANDONED = "ABANDONED",
33
+ EXIT = "EXIT",
34
+ JOIN = "JOIN"
35
+ }
36
+ export declare enum DialerType {
37
+ AUTOMATIC = "Automatic",
38
+ IVR = "IVR"
39
+ }
40
+ /**
41
+ * All the eventNames that can be received from the server. Exists only in EXTENSION_EVENT and QueueEvent
42
+ */
43
+ export declare enum EventNameEnum {
44
+ EXTENSION = "extension",
45
+ QUEUE = "queue",
46
+ DIALER = "dialer"
47
+ }
48
+ export declare enum ExtensionHangupCauseEnum {
49
+ NORMAL_HANGUP = "Normal hangup",
50
+ USER_BUSY = "User busy",
51
+ CALL_REJECTED = "Call Rejected",
52
+ UNALLOCATED_NUMBER = "Unallocated (unassigned) number",
53
+ UNKNOWN = "Unknown",
54
+ NO_USER_RESPONDING = "No user responding",
55
+ USER_ALERTING = "User alerting, no answer",
56
+ ANSWERED_ELSEWHERE = "Answered elsewhere"
57
+ }
58
+ export declare enum CallStatusEnum {
59
+ RINGING = "Ringing",
60
+ TALKING = "Talking",
61
+ DIALING = "Dialing",
62
+ HOLD = "Hold"
63
+ }
64
+ export declare enum CallTypeEnum {
65
+ INCOMING = "Incoming",
66
+ OUTGOING = "Outgoing"
67
+ }
68
+ export declare enum DoNotCallMeStatusCodeEnum {
69
+ RESPONSE_FROM_API_VALID = "RESPONSE_FROM_API_VALID",
70
+ RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID"
71
+ }
72
+ export declare enum DirectionEnum {
73
+ INCOMING = "Incoming",
74
+ OUTGOING = "Outgoing",
75
+ SPY = "Spy",
76
+ CLICK2CALL = "Click2call"
77
+ }
@@ -0,0 +1,11 @@
1
+ import EventsSdkClass from './classes/events-sdk/events-sdk.class';
2
+ import { EventsEnum } from './enum/events.enum';
3
+ export type * from './types/auth';
4
+ export type * from './types/events.common';
5
+ export type * from './types/events';
6
+ export type * from './types/listeners';
7
+ export type * from './types/public-api';
8
+ export type * from './types/socket';
9
+ export type * from './classes/events-sdk/events-sdk.types';
10
+ export { EventsEnum };
11
+ export default EventsSdkClass;
@@ -0,0 +1,49 @@
1
+ import { Server } from '../classes/events-sdk/events-sdk.types'
2
+ import { LoginType } from '../enum/auth.enum'
3
+
4
+ export interface LoginSessionPayload {
5
+ token: string,
6
+ email: string,
7
+ password: string
8
+ }
9
+
10
+ export interface ExternalLoginRequestBody {
11
+ identityType: LoginType,
12
+ username?: string,
13
+ password?: string,
14
+ token?: string
15
+ }
16
+
17
+ interface ExternalLoginResponseData {
18
+ AccessToken: string,
19
+ RefreshToken: string
20
+ }
21
+
22
+ export interface ExternalLoginResponse {
23
+ StatusCode: number,
24
+ Status: string,
25
+ Data: ExternalLoginResponseData
26
+ }
27
+
28
+ export interface Socket {
29
+ Client: string,
30
+ PersonId: number,
31
+ RefreshToken: string,
32
+ RefreshTokenExpiry: Date,
33
+ Token: string,
34
+ TokenExpiry: Date,
35
+ URLList: string[],
36
+ Url: string,
37
+ Version: string
38
+ }
39
+
40
+ export interface Settings {
41
+ IdentityCode: string,
42
+ IdentityCodeExpiry: Date,
43
+ PersonID: number,
44
+ PersonType: number,
45
+ ExtensionMonitorID: number,
46
+ MonitorList: Server[]
47
+ }
48
+
49
+ export interface LoginSessionData extends Settings, ExternalLoginResponseData {}
@@ -0,0 +1,110 @@
1
+ import { CallStatusEnum, CallTypeEnum, DialerType, DirectionEnum, DoNotCallMeStatusCodeEnum } from '../enum/events.enum'
2
+
3
+ export interface Dialer {
4
+ campaignID: number,
5
+ name: string,
6
+ typeID: number,
7
+ type: DialerType,
8
+ code: string,
9
+ calls: unknown,
10
+ statistics: unknown
11
+ }
12
+
13
+ export interface User {
14
+ userID: number,
15
+ userName: string,
16
+ accountID: number
17
+
18
+ }
19
+
20
+ export interface Extension {
21
+ calls: ExtensionCall[],
22
+ userID: number,
23
+ userName: string,
24
+ number: number,
25
+ extenUser: string,
26
+ accountID: number,
27
+ topAccountID: number,
28
+ summery: Summery,
29
+ onlineUserID: number,
30
+ representative: number,
31
+ representativeStatus: number,
32
+ lastCallEventEpoch: number,
33
+ lastAnsweredCallEventEpoch: number,
34
+ lastHangupCallEpoch: number,
35
+ representativeUpdated: number,
36
+ peerStatus: unknown,
37
+ currentCall?: ExtensionCall,
38
+ }
39
+
40
+ export interface Queue {
41
+ QueueID: number,
42
+ QueueName: string,
43
+ Calls: QueueCall[],
44
+ UserId?: number,
45
+ DistributorID?: number,
46
+ IsDistributedQueue?: boolean,
47
+ AnsweredAgent?: string,
48
+ }
49
+
50
+ export interface ExtensionCall {
51
+ callStarted: number,
52
+ calldurationinterval: number,
53
+ callAnswered: number,
54
+ answered: number,
55
+ callername: string,
56
+ callerphone: string,
57
+ outgoingcallername?: string,
58
+ outgoingcallerphone?: string,
59
+ callstatus: CallStatusEnum,
60
+ customdata: CustomData,
61
+ direction: DirectionEnum,
62
+ ivrid: string,
63
+ recording: Recording,
64
+ did: string,
65
+ relatedIvrUniqueIDs?: string[],
66
+ callType?: CallTypeEnum,
67
+ ip: string,
68
+ isInternal: boolean
69
+ blcServerID: number,
70
+ isOpensips: boolean,
71
+ channel: string,
72
+ channel2: string,
73
+ queueID?: number,
74
+ isSpyed?: boolean,
75
+ blcServerId?: number,
76
+ originalCallerID?: string,
77
+ originalCallerName?: string,
78
+ actualDialedNumber?: number
79
+ }
80
+
81
+ interface QueueCall {
82
+ CallerID: string,
83
+ CallerName: string,
84
+ IvrUniqueID: string,
85
+ JoinTimeStamp: number,
86
+ calldurationinterval: number,
87
+ ivrid: string,
88
+ isDistributedQueue?: boolean
89
+ }
90
+
91
+ interface Summery {
92
+ representative: string
93
+ }
94
+
95
+ interface CustomData {
96
+ DoNotCallMeStatus?: string,
97
+ DoNotCallMeStatusCode?: DoNotCallMeStatusCodeEnum,
98
+ DoNotCallMeTokenName?: string,
99
+ DoNotCallMetransactionId?: string,
100
+ IsDoNotCallMe?: string
101
+ }
102
+
103
+ interface Recording {
104
+ Filename: string,
105
+ Options: string,
106
+ ApproximateURL: string,
107
+ IsMuted: number
108
+ }
109
+
110
+
@@ -0,0 +1,175 @@
1
+ import {
2
+ EventNameEnum,
3
+ EventsEnum,
4
+ ExtensionEventReasonEnum,
5
+ ExtensionHangupCauseEnum,
6
+ QueueEventReasonEnum
7
+ } from '@/enum/events.enum'
8
+ import { Queue, Extension, Dialer, User } from './events.common'
9
+
10
+ /**
11
+ * Base structure for all event types, containing common properties.
12
+ */
13
+ interface CommonEventProperties {
14
+ // Error code, 0 indicates no error
15
+ errorCode?: number
16
+ // Description of the error, "Ok" indicates successful connection
17
+ errorDesc?: string
18
+ // Server time at the moment of the event
19
+ serverTime: number
20
+ // Difference in time between server and client
21
+ serverTimeOffset: number
22
+ }
23
+
24
+ // Inherits properties from CommonEventProperties
25
+ type LoginSuccessEvent = CommonEventProperties
26
+
27
+ /**
28
+ * Data structure for login status event.
29
+ */
30
+ export interface LoginStatusEvent extends CommonEventProperties {
31
+ // Array of Queue objects
32
+ queues: Queue[]
33
+ }
34
+
35
+ /**
36
+ * Data structure for all extension status event.
37
+ */
38
+ export interface AllExtensionStatusEvent extends CommonEventProperties {
39
+ // Array of Extension objects
40
+ extensions: Extension[]
41
+ }
42
+
43
+ /**
44
+ * Data structure for all dialers status event.
45
+ */
46
+ export interface AllDialersStatusEvent extends CommonEventProperties {
47
+ // Array of Dialer objects
48
+ dialers: Dialer[]
49
+ }
50
+
51
+ /**
52
+ * Data structure for all users status event.
53
+ */
54
+ export interface AllUsersStatusEvent extends CommonEventProperties {
55
+ // Array of User objects
56
+ users: User[]
57
+ }
58
+
59
+ /**
60
+ * Data structure for queue event.
61
+ */
62
+ export interface QueueEvent extends CommonEventProperties {
63
+ eventName: EventNameEnum.QUEUE,
64
+ reason: QueueEventReasonEnum,
65
+ telephonyServerTime: number,
66
+ ivrUniqueId: string,
67
+ data: Queue
68
+ }
69
+
70
+ /**
71
+ * Data structure for extension event.
72
+ */
73
+ export interface ExtensionEvent extends CommonEventProperties {
74
+ data: Extension
75
+ eventName: EventNameEnum.EXTENSION
76
+ reason: ExtensionEventReasonEnum
77
+ telephonyServerTime?: number
78
+ callerID?: string
79
+ ivrUniqueId?: string
80
+ dialStatus?: string
81
+ cause?: ExtensionHangupCauseEnum
82
+ }
83
+
84
+ /**
85
+ * Data structure for dialer event.
86
+ */
87
+ export interface DialerEvent extends CommonEventProperties {
88
+ data: Dialer
89
+ eventName: EventNameEnum.DIALER
90
+ //reason: ExtensionEventReasonEnum // TODO: do research for dialer 'reason' prop
91
+ telephonyServerTime?: number
92
+ callerID?: string
93
+ ivrUniqueId?: string
94
+ dialStatus?: string
95
+ //cause?: ExtensionHangupCauseEnum // TODO: do research for dialer 'cause' prop
96
+ }
97
+
98
+ /**
99
+ * Data structure for keep alive response event.
100
+ */
101
+ export interface KeepAliveResponseEvent extends CommonEventProperties {
102
+ isOk: boolean
103
+ }
104
+
105
+ export interface OnlineStatusEvent {
106
+ isSocketConnected: boolean
107
+ }
108
+
109
+ /**
110
+ * Mapping of event names to their respective data structures.
111
+ */
112
+ export interface EventDataMap {
113
+ [EventsEnum.ALL_EXTENSION_STATUS]: AllExtensionStatusEvent
114
+ [EventsEnum.ALL_DIALER_STATUS]: AllDialersStatusEvent
115
+ [EventsEnum.ALL_USERS_STATUS]: AllUsersStatusEvent
116
+ [EventsEnum.QUEUE_EVENT]: QueueEvent
117
+ [EventsEnum.EXTENSION_EVENT]: ExtensionEvent
118
+ [EventsEnum.DIALER_EVENT]: DialerEvent
119
+ [EventsEnum.LOGIN_SUCCESS]: LoginSuccessEvent
120
+ [EventsEnum.LOGIN_STATUS]: LoginStatusEvent
121
+ [EventsEnum.KEEP_ALIVE_RESPONSE]: KeepAliveResponseEvent
122
+ [EventsEnum.ONLINE_STATUS_EVENT]: OnlineStatusEvent
123
+ }
124
+
125
+ /**
126
+ * Represents the set of all possible event type names as keys from the EventDataMap.
127
+ * This type is used to define event listeners and handlers.
128
+ */
129
+ type EventTypeNames = keyof EventDataMap
130
+
131
+ // Generic structure for wrapped socket event data
132
+ type WrappedSocketEvent<T extends EventsEnum> = {
133
+ name: T
134
+ data: EventDataMap[T]
135
+ }
136
+
137
+ // Generic type for event type data
138
+ export type EventTypeData<T extends EventsEnum> = EventDataMap[T]
139
+
140
+ /**
141
+ * Defines a registry of callback functions for each event type.
142
+ * Each key is an event type name, and the value is a function that takes the specific event data type as an argument.
143
+ * This registry is used to manage and invoke event-specific callbacks.
144
+ */
145
+ export type EventCallbackRegistry = {
146
+ [K in EventTypeNames]: (data: EventDataMap[K]) => void
147
+ }
148
+
149
+ /**
150
+ * This is a generic type for callback functions used in event handling.
151
+ * It takes a generic event name and defines a callback function that receives wrapped socket event data for that specific event.
152
+ */
153
+ export type EventSpecificCallback<T extends EventTypeNames> = (data: WrappedSocketEvent<T>) => void
154
+
155
+ /**
156
+ * This type defines a map where each key is an event name, and the value is an array of callback functions associated with that event.
157
+ * This structure is used to manage event listeners for different events
158
+ */
159
+ export type EventCallbackListenersMap = {
160
+ [K in EventTypeNames]: Array<EventSpecificCallback<K>>
161
+ }
162
+
163
+ /**
164
+ * This type represents a mapping of listener event names to their corresponding wrapped socket event data structures.
165
+ * Each key is an event name, and the value is the wrapped socket event data for that event
166
+ */
167
+ type EventWrappedSocketDataMap = {
168
+ [K in EventTypeNames]: WrappedSocketEvent<K>
169
+ }
170
+
171
+ /**
172
+ * A generic type that represents the structure of any event data wrapped in a socket event format.
173
+ * This type is used in the handling of all event types, providing a consistent structure for event data processing.
174
+ */
175
+ export type GenericEventWrapper = EventWrappedSocketDataMap[EventTypeNames]
@@ -0,0 +1,37 @@
1
+ export type readyListener = (value: boolean) => void
2
+ export type changeActiveCallsListener = (event: { [key: string]: string }) => void
3
+ export type TestEventListener = (event: { test: string }) => void
4
+ export type ActiveRoomListener = (event: number | undefined) => void
5
+ export type CallAddingProgressListener = (callId: string | undefined) => void
6
+ export type RoomDeletedListener = (roomId: number) => void
7
+ export type changeActiveInputMediaDeviceListener = (event: string) => void
8
+ export type changeActiveOutputMediaDeviceListener = (event: string) => void
9
+ export type changeMuteWhenJoinListener = (value: boolean) => void
10
+ export type changeIsDNDListener = (value: boolean) => void
11
+ export type changeIsMutedListener = (value: boolean) => void
12
+ export type addRoomListener = (value: string) => void
13
+ export type updateRoomListener = (value: string) => void
14
+ export type removeRoomListener = (value: string) => void
15
+ export type changeCallStatusListener = (event: { [key: string]: number }) => void
16
+
17
+ export interface OpenSIPSEventMap {
18
+ ready: readyListener
19
+ changeActiveCalls: changeActiveCallsListener
20
+ callConfirmed: TestEventListener
21
+ currentActiveRoomChanged: ActiveRoomListener
22
+ callAddingInProgressChanged: CallAddingProgressListener
23
+ roomDeleted: RoomDeletedListener
24
+ changeActiveInputMediaDevice: changeActiveInputMediaDeviceListener
25
+ changeActiveOutputMediaDevice: changeActiveOutputMediaDeviceListener
26
+ changeMuteWhenJoin: changeMuteWhenJoinListener
27
+ changeIsDND: changeIsDNDListener
28
+ changeIsMuted: changeIsMutedListener
29
+ addRoom: addRoomListener
30
+ updateRoom: updateRoomListener
31
+ removeRoom: removeRoomListener
32
+ changeCallStatus: changeCallStatusListener
33
+ }
34
+
35
+ export type ListenersKeyType = keyof OpenSIPSEventMap
36
+ export type ListenersCallbackFnType = OpenSIPSEventMap[ListenersKeyType]
37
+ export type ListenerCallbackFnType<T extends ListenersKeyType> = OpenSIPSEventMap[T]