sip-connector 20.2.1 → 20.4.0
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 +116 -1
- package/dist/@SipConnector-DB4bLDI5.cjs +1 -0
- package/dist/{@SipConnector-OO78fz6E.js → @SipConnector-FYEV5h4G.js} +1948 -713
- package/dist/ApiManager/index.d.ts +1 -0
- package/dist/CallManager/CallStateMachine.d.ts +83 -0
- package/dist/ConferenceStateManager/@ConferenceStateManager.d.ts +22 -0
- package/dist/ConferenceStateManager/events.d.ts +18 -0
- package/dist/ConferenceStateManager/index.d.ts +4 -0
- package/dist/ConferenceStateManager/types.d.ts +12 -0
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +53 -4
- package/dist/IncomingCallManager/IncomingCallStateMachine.d.ts +114 -0
- package/dist/PresentationManager/PresentationStateMachine.d.ts +101 -0
- package/dist/SipConnector/@SipConnector.d.ts +11 -3
- package/dist/SipConnector/events.d.ts +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +206 -188
- package/dist/session/createSession.d.ts +26 -0
- package/dist/session/index.d.ts +5 -0
- package/dist/session/selectors.d.ts +10 -0
- package/dist/session/types.d.ts +20 -0
- package/dist/tools/BaseStateMachine.d.ts +18 -0
- package/dist/tools/sendOffer.d.ts +8 -1
- package/package.json +1 -1
- package/dist/@SipConnector-BTqBRDjY.cjs +0 -1
- package/dist/CallManager/@CallManager.d.ts +0 -60
- package/dist/ConnectionManager/@ConnectionManager.d.ts +0 -57
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +0 -29
- package/dist/PresentationManager/@PresentationManager.d.ts +0 -49
|
@@ -2,3 +2,4 @@ export { default as ApiManager } from './@ApiManager';
|
|
|
2
2
|
export { EContentTypeReceived, EContentTypeSent, EEventsMainCAM, EEventsMic, EEventsSyncMediaState, EHeader, EShareState, EUseLicense, } from './constants';
|
|
3
3
|
export { createEvents } from './events';
|
|
4
4
|
export type { TEventMap, TEvent as TApiEvent, TEvents as TApiEvents } from './events';
|
|
5
|
+
export type { TChannels } from './types';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { BaseStateMachine } from '../tools/BaseStateMachine';
|
|
2
|
+
import { ActorRefFrom, SnapshotFrom } from 'xstate';
|
|
3
|
+
import { TEvents } from './events';
|
|
4
|
+
export declare enum EState {
|
|
5
|
+
IDLE = "call:idle",
|
|
6
|
+
CONNECTING = "call:connecting",
|
|
7
|
+
RINGING = "call:ringing",
|
|
8
|
+
ACCEPTED = "call:accepted",
|
|
9
|
+
IN_CALL = "call:inCall",
|
|
10
|
+
ENDED = "call:ended",
|
|
11
|
+
FAILED = "call:failed"
|
|
12
|
+
}
|
|
13
|
+
type TCallEvent = {
|
|
14
|
+
type: 'CALL.CONNECTING';
|
|
15
|
+
} | {
|
|
16
|
+
type: 'CALL.RINGING';
|
|
17
|
+
} | {
|
|
18
|
+
type: 'CALL.ACCEPTED';
|
|
19
|
+
} | {
|
|
20
|
+
type: 'CALL.CONFIRMED';
|
|
21
|
+
} | {
|
|
22
|
+
type: 'CALL.ENDED';
|
|
23
|
+
} | {
|
|
24
|
+
type: 'CALL.FAILED';
|
|
25
|
+
error?: unknown;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'CALL.RESET';
|
|
28
|
+
};
|
|
29
|
+
interface ICallContext {
|
|
30
|
+
lastError?: Error;
|
|
31
|
+
}
|
|
32
|
+
declare const callMachine: import('xstate').StateMachine<ICallContext, {
|
|
33
|
+
type: "CALL.CONNECTING";
|
|
34
|
+
} | {
|
|
35
|
+
type: "CALL.RINGING";
|
|
36
|
+
} | {
|
|
37
|
+
type: "CALL.ACCEPTED";
|
|
38
|
+
} | {
|
|
39
|
+
type: "CALL.CONFIRMED";
|
|
40
|
+
} | {
|
|
41
|
+
type: "CALL.ENDED";
|
|
42
|
+
} | {
|
|
43
|
+
type: "CALL.FAILED";
|
|
44
|
+
error?: unknown;
|
|
45
|
+
} | {
|
|
46
|
+
type: "CALL.RESET";
|
|
47
|
+
}, {}, never, {
|
|
48
|
+
type: "rememberError";
|
|
49
|
+
params: import('xstate').NonReducibleUnknown;
|
|
50
|
+
} | {
|
|
51
|
+
type: "resetError";
|
|
52
|
+
params: import('xstate').NonReducibleUnknown;
|
|
53
|
+
}, never, never, EState, string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
54
|
+
id: "call";
|
|
55
|
+
states: {
|
|
56
|
+
readonly "call:idle": {};
|
|
57
|
+
readonly "call:connecting": {};
|
|
58
|
+
readonly "call:ringing": {};
|
|
59
|
+
readonly "call:accepted": {};
|
|
60
|
+
readonly "call:inCall": {};
|
|
61
|
+
readonly "call:ended": {};
|
|
62
|
+
readonly "call:failed": {};
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
export type TCallSnapshot = SnapshotFrom<typeof callMachine>;
|
|
66
|
+
export type TCallActor = ActorRefFrom<typeof callMachine>;
|
|
67
|
+
export declare class CallStateMachine extends BaseStateMachine<typeof callMachine, EState> {
|
|
68
|
+
constructor(events: TEvents);
|
|
69
|
+
get isIdle(): boolean;
|
|
70
|
+
get isConnecting(): boolean;
|
|
71
|
+
get isRinging(): boolean;
|
|
72
|
+
get isAccepted(): boolean;
|
|
73
|
+
get isInCall(): boolean;
|
|
74
|
+
get isEnded(): boolean;
|
|
75
|
+
get isFailed(): boolean;
|
|
76
|
+
get isActive(): boolean;
|
|
77
|
+
get isPending(): boolean;
|
|
78
|
+
get lastError(): Error | undefined;
|
|
79
|
+
reset(): void;
|
|
80
|
+
send(event: TCallEvent): void;
|
|
81
|
+
private subscribeToEvents;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TEventMap, TEvents } from './events';
|
|
2
|
+
import { TConferenceState, TConferenceStateUpdate } from './types';
|
|
3
|
+
declare class ConferenceStateManager {
|
|
4
|
+
readonly events: TEvents;
|
|
5
|
+
private state;
|
|
6
|
+
constructor();
|
|
7
|
+
getState(): Readonly<TConferenceState>;
|
|
8
|
+
updateState(updates: TConferenceStateUpdate): void;
|
|
9
|
+
reset(): void;
|
|
10
|
+
getToken(): string | undefined;
|
|
11
|
+
getRoom(): string | undefined;
|
|
12
|
+
getParticipantName(): string | undefined;
|
|
13
|
+
getChannels(): TConferenceState['channels'];
|
|
14
|
+
getConference(): string | undefined;
|
|
15
|
+
getParticipant(): string | undefined;
|
|
16
|
+
getNumber(): string | undefined;
|
|
17
|
+
getAnswer(): boolean | undefined;
|
|
18
|
+
on<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
|
|
19
|
+
once<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
|
|
20
|
+
off<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): void;
|
|
21
|
+
}
|
|
22
|
+
export default ConferenceStateManager;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TypedEvents } from 'events-constructor';
|
|
2
|
+
import { TConferenceState } from './types';
|
|
3
|
+
export declare enum EEvent {
|
|
4
|
+
STATE_CHANGED = "state-changed",
|
|
5
|
+
STATE_RESET = "state-reset"
|
|
6
|
+
}
|
|
7
|
+
export declare const EVENT_NAMES: readonly ["state-changed", "state-reset"];
|
|
8
|
+
export type TEvent = (typeof EVENT_NAMES)[number];
|
|
9
|
+
export type TEventMap = {
|
|
10
|
+
'state-changed': {
|
|
11
|
+
previous: TConferenceState;
|
|
12
|
+
current: TConferenceState;
|
|
13
|
+
updates: Partial<TConferenceState>;
|
|
14
|
+
};
|
|
15
|
+
'state-reset': Record<string, never>;
|
|
16
|
+
};
|
|
17
|
+
export type TEvents = TypedEvents<TEventMap>;
|
|
18
|
+
export declare const createEvents: () => TypedEvents<TEventMap, readonly (keyof TEventMap)[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TChannels } from '../ApiManager';
|
|
2
|
+
export type TConferenceState = {
|
|
3
|
+
room?: string;
|
|
4
|
+
participantName?: string;
|
|
5
|
+
channels?: TChannels;
|
|
6
|
+
token?: string;
|
|
7
|
+
conference?: string;
|
|
8
|
+
participant?: string;
|
|
9
|
+
number?: string;
|
|
10
|
+
answer?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type TConferenceStateUpdate = Partial<TConferenceState>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BaseStateMachine } from '../tools/BaseStateMachine';
|
|
2
|
+
import { ActorRefFrom, SnapshotFrom } from 'xstate';
|
|
1
3
|
import { TEvents } from './events';
|
|
2
4
|
export declare enum EEvents {
|
|
3
5
|
START_CONNECT = "START_CONNECT",
|
|
@@ -10,6 +12,13 @@ export declare enum EEvents {
|
|
|
10
12
|
RESET = "RESET"
|
|
11
13
|
}
|
|
12
14
|
type TConnectionMachineEvent = `${EEvents}`;
|
|
15
|
+
type TConnectionFailedEvent = {
|
|
16
|
+
type: typeof EEvents.CONNECTION_FAILED;
|
|
17
|
+
error?: Error;
|
|
18
|
+
};
|
|
19
|
+
interface IConnectionMachineContext {
|
|
20
|
+
error?: Error;
|
|
21
|
+
}
|
|
13
22
|
export declare enum EState {
|
|
14
23
|
IDLE = "connection:idle",
|
|
15
24
|
CONNECTING = "connection:connecting",
|
|
@@ -19,14 +28,51 @@ export declare enum EState {
|
|
|
19
28
|
DISCONNECTED = "connection:disconnected",
|
|
20
29
|
FAILED = "connection:failed"
|
|
21
30
|
}
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
declare enum EAction {
|
|
32
|
+
LOG_TRANSITION = "logTransition",
|
|
33
|
+
LOG_STATE_CHANGE = "logStateChange",
|
|
34
|
+
SET_ERROR = "setError",
|
|
35
|
+
CLEAR_ERROR = "clearError"
|
|
36
|
+
}
|
|
37
|
+
declare const connectionMachine: import('xstate').StateMachine<IConnectionMachineContext, TConnectionFailedEvent | {
|
|
38
|
+
type: TConnectionMachineEvent;
|
|
39
|
+
}, {}, never, {
|
|
40
|
+
type: EAction.LOG_TRANSITION;
|
|
41
|
+
params: {
|
|
42
|
+
from: string;
|
|
43
|
+
to: string;
|
|
44
|
+
event: string;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
type: EAction.LOG_STATE_CHANGE;
|
|
48
|
+
params: {
|
|
49
|
+
state: string;
|
|
50
|
+
};
|
|
51
|
+
} | {
|
|
52
|
+
type: EAction.SET_ERROR;
|
|
53
|
+
params: import('xstate').NonReducibleUnknown;
|
|
54
|
+
} | {
|
|
55
|
+
type: EAction.CLEAR_ERROR;
|
|
56
|
+
params: import('xstate').NonReducibleUnknown;
|
|
57
|
+
}, never, never, EState, string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
58
|
+
id: "connection";
|
|
59
|
+
states: {
|
|
60
|
+
readonly "connection:idle": {};
|
|
61
|
+
readonly "connection:connecting": {};
|
|
62
|
+
readonly "connection:initializing": {};
|
|
63
|
+
readonly "connection:connected": {};
|
|
64
|
+
readonly "connection:registered": {};
|
|
65
|
+
readonly "connection:disconnected": {};
|
|
66
|
+
readonly "connection:failed": {};
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
69
|
+
export type TConnectionSnapshot = SnapshotFrom<typeof connectionMachine>;
|
|
70
|
+
export type TConnectionActor = ActorRefFrom<typeof connectionMachine>;
|
|
71
|
+
export default class ConnectionStateMachine extends BaseStateMachine<typeof connectionMachine, EState> {
|
|
24
72
|
private readonly stateChangeListeners;
|
|
25
73
|
private readonly events;
|
|
26
74
|
private unsubscribeFromEvents?;
|
|
27
|
-
private readonly actorSubscription?;
|
|
28
75
|
constructor(events: TEvents);
|
|
29
|
-
get state(): EState;
|
|
30
76
|
get isIdle(): boolean;
|
|
31
77
|
get isConnecting(): boolean;
|
|
32
78
|
get isInitializing(): boolean;
|
|
@@ -34,6 +80,7 @@ export default class ConnectionStateMachine {
|
|
|
34
80
|
get isRegistered(): boolean;
|
|
35
81
|
get isDisconnected(): boolean;
|
|
36
82
|
get isFailed(): boolean;
|
|
83
|
+
get error(): Error | undefined;
|
|
37
84
|
get isPending(): boolean;
|
|
38
85
|
get isPendingConnect(): boolean;
|
|
39
86
|
get isPendingInitUa(): boolean;
|
|
@@ -56,5 +103,7 @@ export default class ConnectionStateMachine {
|
|
|
56
103
|
private readonly toFailed;
|
|
57
104
|
private readonly toIdle;
|
|
58
105
|
private subscribeToEvents;
|
|
106
|
+
private readonly handleRegistrationFailed;
|
|
107
|
+
private readonly handleConnectFailed;
|
|
59
108
|
}
|
|
60
109
|
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { BaseStateMachine } from '../tools/BaseStateMachine';
|
|
2
|
+
import { ActorRefFrom, SnapshotFrom } from 'xstate';
|
|
3
|
+
import { TEvents as TConnectionEvents } from '../ConnectionManager/events';
|
|
4
|
+
import { TEvents as TIncomingEvents, TRemoteCallerData } from './events';
|
|
5
|
+
export declare enum EState {
|
|
6
|
+
IDLE = "incoming:idle",
|
|
7
|
+
RINGING = "incoming:ringing",
|
|
8
|
+
CONSUMED = "incoming:consumed",
|
|
9
|
+
DECLINED = "incoming:declined",
|
|
10
|
+
TERMINATED = "incoming:terminated",
|
|
11
|
+
FAILED = "incoming:failed"
|
|
12
|
+
}
|
|
13
|
+
declare enum EAction {
|
|
14
|
+
LOG_TRANSITION = "logTransition",
|
|
15
|
+
LOG_STATE_CHANGE = "logStateChange",
|
|
16
|
+
REMEMBER_INCOMING = "rememberIncoming",
|
|
17
|
+
REMEMBER_REASON = "rememberReason",
|
|
18
|
+
CLEAR_INCOMING = "clearIncoming"
|
|
19
|
+
}
|
|
20
|
+
type TIncomingEvent = {
|
|
21
|
+
type: 'INCOMING.RINGING';
|
|
22
|
+
data: TRemoteCallerData;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'INCOMING.CONSUMED';
|
|
25
|
+
} | {
|
|
26
|
+
type: 'INCOMING.DECLINED';
|
|
27
|
+
data: TRemoteCallerData;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'INCOMING.TERMINATED';
|
|
30
|
+
data: TRemoteCallerData;
|
|
31
|
+
} | {
|
|
32
|
+
type: 'INCOMING.FAILED';
|
|
33
|
+
data: TRemoteCallerData;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'INCOMING.CLEAR';
|
|
36
|
+
};
|
|
37
|
+
interface IIncomingContext {
|
|
38
|
+
remoteCallerData?: TRemoteCallerData;
|
|
39
|
+
lastReason?: EState.CONSUMED | EState.DECLINED | EState.TERMINATED | EState.FAILED;
|
|
40
|
+
}
|
|
41
|
+
declare const incomingMachine: import('xstate').StateMachine<IIncomingContext, {
|
|
42
|
+
type: "INCOMING.RINGING";
|
|
43
|
+
data: TRemoteCallerData;
|
|
44
|
+
} | {
|
|
45
|
+
type: "INCOMING.CONSUMED";
|
|
46
|
+
} | {
|
|
47
|
+
type: "INCOMING.DECLINED";
|
|
48
|
+
data: TRemoteCallerData;
|
|
49
|
+
} | {
|
|
50
|
+
type: "INCOMING.TERMINATED";
|
|
51
|
+
data: TRemoteCallerData;
|
|
52
|
+
} | {
|
|
53
|
+
type: "INCOMING.FAILED";
|
|
54
|
+
data: TRemoteCallerData;
|
|
55
|
+
} | {
|
|
56
|
+
type: "INCOMING.CLEAR";
|
|
57
|
+
}, {}, never, {
|
|
58
|
+
type: EAction.LOG_TRANSITION;
|
|
59
|
+
params: {
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
event: string;
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
type: EAction.LOG_STATE_CHANGE;
|
|
66
|
+
params: {
|
|
67
|
+
state: string;
|
|
68
|
+
};
|
|
69
|
+
} | {
|
|
70
|
+
type: EAction.REMEMBER_INCOMING;
|
|
71
|
+
params: import('xstate').NonReducibleUnknown;
|
|
72
|
+
} | {
|
|
73
|
+
type: EAction.REMEMBER_REASON;
|
|
74
|
+
params: import('xstate').NonReducibleUnknown;
|
|
75
|
+
} | {
|
|
76
|
+
type: EAction.CLEAR_INCOMING;
|
|
77
|
+
params: import('xstate').NonReducibleUnknown;
|
|
78
|
+
}, never, never, EState, string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
79
|
+
id: "incoming";
|
|
80
|
+
states: {
|
|
81
|
+
readonly "incoming:idle": {};
|
|
82
|
+
readonly "incoming:ringing": {};
|
|
83
|
+
readonly "incoming:consumed": {};
|
|
84
|
+
readonly "incoming:declined": {};
|
|
85
|
+
readonly "incoming:terminated": {};
|
|
86
|
+
readonly "incoming:failed": {};
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
89
|
+
export type TIncomingSnapshot = SnapshotFrom<typeof incomingMachine>;
|
|
90
|
+
export type TIncomingActor = ActorRefFrom<typeof incomingMachine>;
|
|
91
|
+
type TDeps = {
|
|
92
|
+
incomingEvents: TIncomingEvents;
|
|
93
|
+
connectionEvents: TConnectionEvents;
|
|
94
|
+
};
|
|
95
|
+
export declare class IncomingCallStateMachine extends BaseStateMachine<typeof incomingMachine, EState> {
|
|
96
|
+
constructor({ incomingEvents, connectionEvents }: TDeps);
|
|
97
|
+
get isIdle(): boolean;
|
|
98
|
+
get isRinging(): boolean;
|
|
99
|
+
get isConsumed(): boolean;
|
|
100
|
+
get isDeclined(): boolean;
|
|
101
|
+
get isTerminated(): boolean;
|
|
102
|
+
get isFailed(): boolean;
|
|
103
|
+
get isActive(): boolean;
|
|
104
|
+
get isFinished(): boolean;
|
|
105
|
+
get remoteCallerData(): TRemoteCallerData | undefined;
|
|
106
|
+
get lastReason(): EState.CONSUMED | EState.DECLINED | EState.TERMINATED | EState.FAILED | undefined;
|
|
107
|
+
reset(): void;
|
|
108
|
+
send(event: TIncomingEvent): void;
|
|
109
|
+
toConsumed(): void;
|
|
110
|
+
private subscribeIncomingEvents;
|
|
111
|
+
private subscribeConnectionEvents;
|
|
112
|
+
private toClearIncoming;
|
|
113
|
+
}
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { BaseStateMachine } from '../tools/BaseStateMachine';
|
|
2
|
+
import { ActorRefFrom, SnapshotFrom } from 'xstate';
|
|
3
|
+
import { TCallEvents } from '../CallManager';
|
|
4
|
+
export declare enum EState {
|
|
5
|
+
IDLE = "presentation:idle",
|
|
6
|
+
STARTING = "presentation:starting",
|
|
7
|
+
ACTIVE = "presentation:active",
|
|
8
|
+
STOPPING = "presentation:stopping",
|
|
9
|
+
FAILED = "presentation:failed"
|
|
10
|
+
}
|
|
11
|
+
declare enum EAction {
|
|
12
|
+
LOG_TRANSITION = "logTransition",
|
|
13
|
+
LOG_STATE_CHANGE = "logStateChange",
|
|
14
|
+
SET_ERROR = "setError",
|
|
15
|
+
CLEAR_ERROR = "clearError"
|
|
16
|
+
}
|
|
17
|
+
type TPresentationEvent = {
|
|
18
|
+
type: 'SCREEN.STARTING';
|
|
19
|
+
} | {
|
|
20
|
+
type: 'SCREEN.STARTED';
|
|
21
|
+
} | {
|
|
22
|
+
type: 'SCREEN.ENDING';
|
|
23
|
+
} | {
|
|
24
|
+
type: 'SCREEN.ENDED';
|
|
25
|
+
} | {
|
|
26
|
+
type: 'SCREEN.FAILED';
|
|
27
|
+
error?: unknown;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'CALL.ENDED';
|
|
30
|
+
} | {
|
|
31
|
+
type: 'CALL.FAILED';
|
|
32
|
+
error?: unknown;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'PRESENTATION.RESET';
|
|
35
|
+
};
|
|
36
|
+
interface IPresentationContext {
|
|
37
|
+
lastError?: Error;
|
|
38
|
+
}
|
|
39
|
+
declare const presentationMachine: import('xstate').StateMachine<IPresentationContext, {
|
|
40
|
+
type: "SCREEN.STARTING";
|
|
41
|
+
} | {
|
|
42
|
+
type: "SCREEN.STARTED";
|
|
43
|
+
} | {
|
|
44
|
+
type: "SCREEN.ENDING";
|
|
45
|
+
} | {
|
|
46
|
+
type: "SCREEN.ENDED";
|
|
47
|
+
} | {
|
|
48
|
+
type: "SCREEN.FAILED";
|
|
49
|
+
error?: unknown;
|
|
50
|
+
} | {
|
|
51
|
+
type: "CALL.ENDED";
|
|
52
|
+
} | {
|
|
53
|
+
type: "CALL.FAILED";
|
|
54
|
+
error?: unknown;
|
|
55
|
+
} | {
|
|
56
|
+
type: "PRESENTATION.RESET";
|
|
57
|
+
}, {}, never, {
|
|
58
|
+
type: EAction.LOG_TRANSITION;
|
|
59
|
+
params: {
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
event: string;
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
type: EAction.LOG_STATE_CHANGE;
|
|
66
|
+
params: {
|
|
67
|
+
state: string;
|
|
68
|
+
};
|
|
69
|
+
} | {
|
|
70
|
+
type: EAction.SET_ERROR;
|
|
71
|
+
params: import('xstate').NonReducibleUnknown;
|
|
72
|
+
} | {
|
|
73
|
+
type: EAction.CLEAR_ERROR;
|
|
74
|
+
params: import('xstate').NonReducibleUnknown;
|
|
75
|
+
}, never, never, EState, string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
76
|
+
id: "presentation";
|
|
77
|
+
states: {
|
|
78
|
+
readonly "presentation:idle": {};
|
|
79
|
+
readonly "presentation:starting": {};
|
|
80
|
+
readonly "presentation:active": {};
|
|
81
|
+
readonly "presentation:stopping": {};
|
|
82
|
+
readonly "presentation:failed": {};
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
export type TPresentationSnapshot = SnapshotFrom<typeof presentationMachine>;
|
|
86
|
+
export type TPresentationActor = ActorRefFrom<typeof presentationMachine>;
|
|
87
|
+
export declare class PresentationStateMachine extends BaseStateMachine<typeof presentationMachine, EState> {
|
|
88
|
+
constructor(callEvents: TCallEvents);
|
|
89
|
+
get isIdle(): boolean;
|
|
90
|
+
get isStarting(): boolean;
|
|
91
|
+
get isActive(): boolean;
|
|
92
|
+
get isStopping(): boolean;
|
|
93
|
+
get isFailed(): boolean;
|
|
94
|
+
get isPending(): boolean;
|
|
95
|
+
get isActiveOrPending(): boolean;
|
|
96
|
+
get lastError(): Error | undefined;
|
|
97
|
+
reset(): void;
|
|
98
|
+
send(event: TPresentationEvent): void;
|
|
99
|
+
private subscribeCallEvents;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ApiManager } from '../ApiManager';
|
|
2
2
|
import { AutoConnectorManager, IAutoConnectorOptions } from '../AutoConnectorManager';
|
|
3
3
|
import { CallManager, TGetUri } from '../CallManager';
|
|
4
|
+
import { ConferenceStateManager } from '../ConferenceStateManager';
|
|
4
5
|
import { ConnectionManager } from '../ConnectionManager';
|
|
5
6
|
import { ConnectionQueueManager } from '../ConnectionQueueManager';
|
|
6
7
|
import { IncomingCallManager } from '../IncomingCallManager';
|
|
7
8
|
import { PresentationManager, TContentHint, TOnAddedTransceiver } from '../PresentationManager';
|
|
8
9
|
import { StatsManager } from '../StatsManager';
|
|
9
10
|
import { VideoSendingBalancerManager } from '../VideoSendingBalancerManager';
|
|
11
|
+
import { ISession } from '../session';
|
|
10
12
|
import { TJsSIP } from '../types';
|
|
11
13
|
import { IBalancerOptions } from '../VideoSendingBalancer';
|
|
12
14
|
import { TEventMap, TEvents } from './events';
|
|
@@ -14,6 +16,7 @@ declare class SipConnector {
|
|
|
14
16
|
readonly events: TEvents;
|
|
15
17
|
readonly connectionManager: ConnectionManager;
|
|
16
18
|
readonly connectionQueueManager: ConnectionQueueManager;
|
|
19
|
+
readonly conferenceStateManager: ConferenceStateManager;
|
|
17
20
|
readonly callManager: CallManager;
|
|
18
21
|
readonly autoConnectorManager: AutoConnectorManager;
|
|
19
22
|
readonly apiManager: ApiManager;
|
|
@@ -21,6 +24,7 @@ declare class SipConnector {
|
|
|
21
24
|
readonly presentationManager: PresentationManager;
|
|
22
25
|
readonly statsManager: StatsManager;
|
|
23
26
|
readonly videoSendingBalancerManager: VideoSendingBalancerManager;
|
|
27
|
+
readonly session: ISession;
|
|
24
28
|
private readonly mainStreamHealthMonitor;
|
|
25
29
|
private readonly mainStreamRecovery;
|
|
26
30
|
private readonly preferredMimeTypesVideoCodecs?;
|
|
@@ -36,7 +40,7 @@ declare class SipConnector {
|
|
|
36
40
|
get requestedConnection(): boolean;
|
|
37
41
|
get isPendingConnect(): boolean;
|
|
38
42
|
get isPendingInitUa(): boolean;
|
|
39
|
-
get connectionState(): import('../
|
|
43
|
+
get connectionState(): import('../session').EConnectionStatus;
|
|
40
44
|
get isRegistered(): boolean;
|
|
41
45
|
get isRegisterConfig(): boolean;
|
|
42
46
|
get socket(): import('@krivega/jssip').WebSocketInterface | undefined;
|
|
@@ -69,7 +73,10 @@ declare class SipConnector {
|
|
|
69
73
|
answerToIncomingCall: (params: Parameters<CallManager["answerToIncomingCall"]>[1]) => Promise<RTCPeerConnection>;
|
|
70
74
|
declineToIncomingCall: IncomingCallManager['declineToIncomingCall'];
|
|
71
75
|
getEstablishedRTCSession: CallManager['getEstablishedRTCSession'];
|
|
72
|
-
getCallConfiguration:
|
|
76
|
+
getCallConfiguration: () => {
|
|
77
|
+
number: string | undefined;
|
|
78
|
+
answer: boolean | undefined;
|
|
79
|
+
};
|
|
73
80
|
getRemoteStreams: CallManager['getRemoteStreams'];
|
|
74
81
|
replaceMediaStream: CallManager['replaceMediaStream'];
|
|
75
82
|
startPresentation(mediaStream: MediaStream, options?: {
|
|
@@ -92,7 +99,7 @@ declare class SipConnector {
|
|
|
92
99
|
sendEncodings?: RTCRtpEncodingParameters[];
|
|
93
100
|
onAddedTransceiver?: TOnAddedTransceiver;
|
|
94
101
|
}): Promise<MediaStream | undefined>;
|
|
95
|
-
waitChannels(...args: Parameters<ApiManager['waitChannels']>): Promise<import('../ApiManager
|
|
102
|
+
waitChannels(...args: Parameters<ApiManager['waitChannels']>): Promise<import('../ApiManager').TChannels>;
|
|
96
103
|
waitSyncMediaState(...args: Parameters<ApiManager['waitSyncMediaState']>): Promise<{
|
|
97
104
|
isSyncForced: boolean;
|
|
98
105
|
}>;
|
|
@@ -110,6 +117,7 @@ declare class SipConnector {
|
|
|
110
117
|
askPermissionToEnableCam(...args: Parameters<ApiManager['askPermissionToEnableCam']>): Promise<void>;
|
|
111
118
|
private subscribeDisconnectedFromOutOfCall;
|
|
112
119
|
private subscribeConnectedWithConfigurationFromOutOfCall;
|
|
120
|
+
private mayBeStopPresentationAndNotify;
|
|
113
121
|
private subscribeToApiEvents;
|
|
114
122
|
private readonly sendOffer;
|
|
115
123
|
private setCodecPreferences;
|
|
@@ -8,7 +8,7 @@ import { TEventMap as TIncomingCallManagerEventMap } from '../IncomingCallManage
|
|
|
8
8
|
import { TEventMap as TPresentationManagerEventMap } from '../PresentationManager/events';
|
|
9
9
|
import { TEventMap as TStatsManagerEventMap } from '../StatsPeerConnection/events';
|
|
10
10
|
import { TEventMap as TVideoBalancerManagerEventMap } from '../VideoSendingBalancerManager/events';
|
|
11
|
-
export declare const EVENT_NAMES: readonly [...("connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:
|
|
11
|
+
export declare const EVENT_NAMES: readonly [...("call:connecting" | "call:accepted" | "call:ended" | "call:failed" | "connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:sending" | "call:progress" | "call:confirmed" | "call:newDTMF" | "call:newInfo" | "call:reinvite" | "call:update" | "call:refer" | "call:replaces" | "call:sdp" | "call:icecandidate" | "call:getusermediafailed" | "call:peerconnection:createofferfailed" | "call:peerconnection:createanswerfailed" | "call:peerconnection:setlocaldescriptionfailed" | "call:peerconnection:setremotedescriptionfailed" | "call:presentation:start" | "call:presentation:started" | "call:presentation:end" | "call:presentation:ended" | "call:presentation:failed" | "call:peerconnection:confirmed" | "call:peerconnection:ontrack" | "call:ended:fromserver" | "call:call-status-changed" | "call:remote-streams-changed" | "api:channels:notify" | "api:participant:added-to-list-moderators" | "api:participant:removed-from-list-moderators" | "api:participant:move-request-to-stream" | "api:participant:move-request-to-participants" | "api:participant:move-request-to-spectators" | "api:participant:move-request-to-spectators-synthetic" | "api:participant:move-request-to-spectators-with-audio-id" | "api:participation:accepting-word-request" | "api:participation:cancelling-word-request" | "api:webcast:started" | "api:webcast:stopped" | "api:account:changed" | "api:account:deleted" | "api:conference:participant-token-issued" | "api:channels" | "api:enterRoom" | "api:shareState" | "api:main-cam-control" | "api:useLicense" | "api:admin-start-main-cam" | "api:admin-stop-main-cam" | "api:admin-start-mic" | "api:admin-stop-mic" | "api:admin-force-sync-media-state" | "api:availableSecondRemoteStream" | "api:notAvailableSecondRemoteStream" | "api:mustStopPresentation" | "api:newDTMF" | "incoming-call:incomingCall" | "incoming-call:declinedIncomingCall" | "incoming-call:terminatedIncomingCall" | "incoming-call:failedIncomingCall" | "presentation:presentation:start" | "presentation:presentation:started" | "presentation:presentation:end" | "presentation:presentation:ended" | "presentation:presentation:failed" | "stats:collected" | "video-balancer:balancing-scheduled" | "video-balancer:balancing-started" | "video-balancer:balancing-stopped" | "video-balancer:parameters-updated")[], "disconnected-from-out-of-call", "connected-with-configuration-from-out-of-call", "stopped-presentation-by-server-command"];
|
|
12
12
|
export type TEvent = (typeof EVENT_NAMES)[number];
|
|
13
13
|
type PrefixedEventMap<T extends Record<string, unknown>, Prefix extends string> = {
|
|
14
14
|
[K in keyof T as `${Prefix}:${string & K}`]: T[K];
|
|
@@ -20,5 +20,5 @@ type TSipConnectorEventMap = {
|
|
|
20
20
|
};
|
|
21
21
|
export type TEventMap = PrefixedEventMap<TAutoConnectorManagerEventMap, 'auto-connect'> & PrefixedEventMap<TConnectionManagerEventMap, 'connection'> & PrefixedEventMap<TCallManagerEventMap, 'call'> & PrefixedEventMap<TApiManagerEventMap, 'api'> & PrefixedEventMap<TIncomingCallManagerEventMap, 'incoming-call'> & PrefixedEventMap<TPresentationManagerEventMap, 'presentation'> & PrefixedEventMap<TStatsManagerEventMap, 'stats'> & PrefixedEventMap<TVideoBalancerManagerEventMap, 'video-balancer'> & TSipConnectorEventMap;
|
|
22
22
|
export type TEvents = TypedEvents<TEventMap>;
|
|
23
|
-
export declare const createEvents: () => TypedEvents<TEventMap, readonly ("connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:
|
|
23
|
+
export declare const createEvents: () => TypedEvents<TEventMap, readonly ("call:connecting" | "call:accepted" | "call:ended" | "call:failed" | "connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:sending" | "call:progress" | "call:confirmed" | "call:newDTMF" | "call:newInfo" | "call:hold" | "call:unhold" | "call:muted" | "call:unmuted" | "call:reinvite" | "call:update" | "call:refer" | "call:replaces" | "call:sdp" | "call:icecandidate" | "call:getusermediafailed" | "call:peerconnection:createofferfailed" | "call:peerconnection:createanswerfailed" | "call:peerconnection:setlocaldescriptionfailed" | "call:peerconnection:setremotedescriptionfailed" | "call:presentation:start" | "call:presentation:started" | "call:presentation:end" | "call:presentation:ended" | "call:presentation:failed" | "call:peerconnection:confirmed" | "call:peerconnection:ontrack" | "call:ended:fromserver" | "call:call-status-changed" | "call:remote-streams-changed" | "api:channels:notify" | "api:participant:added-to-list-moderators" | "api:participant:removed-from-list-moderators" | "api:participant:move-request-to-stream" | "api:participant:move-request-to-participants" | "api:participant:move-request-to-spectators" | "api:participant:move-request-to-spectators-synthetic" | "api:participant:move-request-to-spectators-with-audio-id" | "api:participation:accepting-word-request" | "api:participation:cancelling-word-request" | "api:webcast:started" | "api:webcast:stopped" | "api:account:changed" | "api:account:deleted" | "api:conference:participant-token-issued" | "api:channels" | "api:enterRoom" | "api:shareState" | "api:main-cam-control" | "api:useLicense" | "api:admin-start-main-cam" | "api:admin-stop-main-cam" | "api:admin-start-mic" | "api:admin-stop-mic" | "api:admin-force-sync-media-state" | "api:availableSecondRemoteStream" | "api:notAvailableSecondRemoteStream" | "api:mustStopPresentation" | "api:newDTMF" | "incoming-call:incomingCall" | "incoming-call:declinedIncomingCall" | "incoming-call:terminatedIncomingCall" | "incoming-call:failedIncomingCall" | "presentation:presentation:start" | "presentation:presentation:started" | "presentation:presentation:end" | "presentation:presentation:ended" | "presentation:presentation:failed" | "stats:collected" | "video-balancer:balancing-scheduled" | "video-balancer:balancing-started" | "video-balancer:balancing-stopped" | "video-balancer:parameters-updated" | keyof TSipConnectorEventMap)[]>;
|
|
24
24
|
export {};
|