sip-connector 17.0.0 → 19.0.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 +123 -29
- package/dist/@SipConnector-DNQcZdY9.cjs +1 -0
- package/dist/{@SipConnector-DADbRZIb.js → @SipConnector-Wp8bjnnP.js} +1417 -1072
- package/dist/ApiManager/__tests-utils__/helpers.d.ts +2 -4
- package/dist/ApiManager/constants.d.ts +1 -2
- package/dist/ApiManager/eventNames.d.ts +1 -2
- package/dist/AutoConnectorManager/@AutoConnectorManager.d.ts +41 -0
- package/dist/AutoConnectorManager/AttemptsState.d.ts +21 -0
- package/dist/AutoConnectorManager/CheckTelephonyRequester.d.ts +19 -0
- package/dist/AutoConnectorManager/PingServerIfNotActiveCallRequester.d.ts +18 -0
- package/dist/AutoConnectorManager/PingServerRequester.d.ts +13 -0
- package/dist/AutoConnectorManager/RegistrationFailedOutOfCallSubscriber.d.ts +18 -0
- package/dist/AutoConnectorManager/eventNames.d.ts +18 -0
- package/dist/AutoConnectorManager/index.d.ts +3 -0
- package/dist/AutoConnectorManager/types.d.ts +22 -0
- package/dist/AutoConnectorManager/utils/errors.d.ts +2 -0
- package/dist/AutoConnectorManager/utils/index.d.ts +1 -0
- package/dist/CallManager/@CallManager.d.ts +9 -7
- package/dist/CallManager/AbstractCallStrategy.d.ts +2 -6
- package/dist/CallManager/MCUCallStrategy.d.ts +1 -9
- package/dist/CallManager/eventNames.d.ts +48 -4
- package/dist/CallManager/index.d.ts +3 -3
- package/dist/CallManager/types.d.ts +1 -13
- package/dist/ConnectionManager/@ConnectionManager.d.ts +10 -1
- package/dist/ConnectionManager/eventNames.d.ts +6 -2
- package/dist/ConnectionManager/index.d.ts +1 -0
- package/dist/ConnectionManager/utils/errors.d.ts +2 -0
- package/dist/ConnectionManager/utils/index.d.ts +2 -0
- package/dist/ConnectionManager/utils/resolveParameters.d.ts +2 -0
- package/dist/ConnectionQueueManager/@ConnectionQueueManager.d.ts +1 -7
- package/dist/ConnectionQueueManager/index.d.ts +1 -0
- package/dist/SipConnector/@SipConnector.d.ts +12 -6
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/SipConnectorFacade/{SipConnectorFacade.d.ts → @SipConnectorFacade.d.ts} +16 -10
- package/dist/SipConnectorFacade/index.d.ts +1 -1
- package/dist/StatsPeerConnection/index.d.ts +1 -1
- package/dist/{CallManager/TransceiverManager.d.ts → TransceiverManager/@TransceiverManager.d.ts} +19 -0
- package/dist/TransceiverManager/index.d.ts +1 -0
- package/dist/TransceiverManager/types.d.ts +11 -0
- package/dist/VideoSendingBalancer/index.d.ts +1 -1
- package/dist/__fixtures__/eventNames.d.ts +1 -1
- 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 +209 -195
- package/package.json +13 -13
- package/dist/@SipConnector-aB66gnC6.cjs +0 -1
- /package/dist/StatsPeerConnection/{StatsPeerConnection.d.ts → @StatsPeerConnection.d.ts} +0 -0
- /package/dist/VideoSendingBalancer/{VideoSendingBalancer.d.ts → @VideoSendingBalancer.d.ts} +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { IncomingInfoEvent, OutgoingInfoEvent } from '@krivega/jssip';
|
|
1
2
|
export declare class MockRequest {
|
|
2
3
|
private headers;
|
|
3
|
-
static createInfoEvent(originator:
|
|
4
|
-
readonly originator: string;
|
|
5
|
-
readonly request: MockRequest;
|
|
6
|
-
};
|
|
4
|
+
static createInfoEvent(originator: 'local' | 'remote', request: MockRequest): IncomingInfoEvent | OutgoingInfoEvent;
|
|
7
5
|
setHeader(name: string, value: string): void;
|
|
8
6
|
getHeader(name: string): string | undefined;
|
|
9
7
|
}
|
|
@@ -35,8 +35,7 @@ export declare enum EShareState {
|
|
|
35
35
|
}
|
|
36
36
|
export declare enum EParticipantType {
|
|
37
37
|
SPECTATOR = "SPECTATOR",
|
|
38
|
-
PARTICIPANT = "PARTICIPANT"
|
|
39
|
-
SPECTATOR_OVER_SFU = "SPECTATOROVERSFU"
|
|
38
|
+
PARTICIPANT = "PARTICIPANT"
|
|
40
39
|
}
|
|
41
40
|
export declare enum EContentTypeReceived {
|
|
42
41
|
ENTER_ROOM = "application/vinteo.webrtc.roomname",
|
|
@@ -6,7 +6,6 @@ export declare enum EEvent {
|
|
|
6
6
|
PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream",
|
|
7
7
|
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators",
|
|
8
8
|
PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants",
|
|
9
|
-
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu",
|
|
10
9
|
PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request",
|
|
11
10
|
PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request",
|
|
12
11
|
WEBCAST_STARTED = "webcast:started",
|
|
@@ -30,6 +29,6 @@ export declare enum EEvent {
|
|
|
30
29
|
NEW_DTMF = "newDTMF",
|
|
31
30
|
RESTART = "restart"
|
|
32
31
|
}
|
|
33
|
-
export declare const EVENT_NAMES: readonly ["participation:accepting-word-request", "participation:cancelling-word-request", "participant:move-request-to-stream", "channels:notify", "conference:participant-token-issued", "account:changed", "account:deleted", "webcast:started", "webcast:stopped", "participant:added-to-list-moderators", "participant:removed-from-list-moderators", "participant:move-request-to-spectators", "participant:move-request-to-participants", "
|
|
32
|
+
export declare const EVENT_NAMES: readonly ["participation:accepting-word-request", "participation:cancelling-word-request", "participant:move-request-to-stream", "channels:notify", "conference:participant-token-issued", "account:changed", "account:deleted", "webcast:started", "webcast:stopped", "participant:added-to-list-moderators", "participant:removed-from-list-moderators", "participant:move-request-to-spectators", "participant:move-request-to-participants", "channels", "enterRoom", "shareState", "main-cam-control", "useLicense", "admin-start-main-cam", "admin-stop-main-cam", "admin-start-mic", "admin-stop-mic", "admin-force-sync-media-state", "availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "newDTMF", "restart"];
|
|
34
33
|
export type TEvent = (typeof EVENT_NAMES)[number];
|
|
35
34
|
export type TEvents = Events<typeof EVENT_NAMES>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ConnectionManager } from '../ConnectionManager';
|
|
2
|
+
import { CallManager } from '../CallManager';
|
|
3
|
+
import { ConnectionQueueManager } from '../ConnectionQueueManager';
|
|
4
|
+
import { TEventMap, TEvents } from './eventNames';
|
|
5
|
+
import { IAutoConnectorOptions, TParametersAutoConnect } from './types';
|
|
6
|
+
declare class AutoConnectorManager {
|
|
7
|
+
readonly events: TEvents;
|
|
8
|
+
private readonly connectionManager;
|
|
9
|
+
private readonly connectionQueueManager;
|
|
10
|
+
private readonly checkTelephonyRequester;
|
|
11
|
+
private readonly pingServerIfNotActiveCallRequester;
|
|
12
|
+
private readonly registrationFailedOutOfCallSubscriber;
|
|
13
|
+
private readonly attemptsState;
|
|
14
|
+
private readonly delayBetweenAttempts;
|
|
15
|
+
private readonly cancelableRequestBeforeRetry;
|
|
16
|
+
private readonly onBeforeRetry;
|
|
17
|
+
constructor({ connectionQueueManager, connectionManager, callManager, }: {
|
|
18
|
+
connectionQueueManager: ConnectionQueueManager;
|
|
19
|
+
connectionManager: ConnectionManager;
|
|
20
|
+
callManager: CallManager;
|
|
21
|
+
}, options?: IAutoConnectorOptions);
|
|
22
|
+
start(parameters: TParametersAutoConnect): void;
|
|
23
|
+
stop(): void;
|
|
24
|
+
on<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
|
|
25
|
+
once<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
|
|
26
|
+
onceRace<T extends keyof TEventMap>(eventNames: T[], handler: (data: TEventMap[T], eventName: string) => void): () => void;
|
|
27
|
+
wait<T extends keyof TEventMap>(eventName: T): Promise<TEventMap[T]>;
|
|
28
|
+
off<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): void;
|
|
29
|
+
private stopAttempts;
|
|
30
|
+
private stopConnectTriggers;
|
|
31
|
+
private runCheckTelephony;
|
|
32
|
+
private connect;
|
|
33
|
+
private processConnect;
|
|
34
|
+
private handleLimitReached;
|
|
35
|
+
private handleSucceededAttempt;
|
|
36
|
+
private subscribeToConnectTriggers;
|
|
37
|
+
private connectIfDisconnected;
|
|
38
|
+
private reconnect;
|
|
39
|
+
private hasFailedOrDisconnectedConnection;
|
|
40
|
+
}
|
|
41
|
+
export default AutoConnectorManager;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TEvents } from './eventNames';
|
|
2
|
+
declare class AttemptsState {
|
|
3
|
+
private readonly events;
|
|
4
|
+
private countInner;
|
|
5
|
+
private readonly initialCount;
|
|
6
|
+
private readonly limitInner;
|
|
7
|
+
private isInProgress;
|
|
8
|
+
constructor({ events }: {
|
|
9
|
+
events: TEvents;
|
|
10
|
+
});
|
|
11
|
+
get count(): number;
|
|
12
|
+
get limit(): number;
|
|
13
|
+
get isAttemptInProgress(): boolean;
|
|
14
|
+
hasLimitReached(): boolean;
|
|
15
|
+
startAttempt(): void;
|
|
16
|
+
finishAttempt(): void;
|
|
17
|
+
increment(): void;
|
|
18
|
+
reset(): void;
|
|
19
|
+
private emitStatusChange;
|
|
20
|
+
}
|
|
21
|
+
export default AttemptsState;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConnectionManager } from '../ConnectionManager';
|
|
2
|
+
import { TParametersCheckTelephony } from './types';
|
|
3
|
+
declare class CheckTelephonyRequester {
|
|
4
|
+
private readonly connectionManager;
|
|
5
|
+
private readonly interval;
|
|
6
|
+
private checkTelephonyByTimeout;
|
|
7
|
+
private cancelableBeforeRequest;
|
|
8
|
+
constructor({ connectionManager, interval, }: {
|
|
9
|
+
connectionManager: ConnectionManager;
|
|
10
|
+
interval: number;
|
|
11
|
+
});
|
|
12
|
+
start({ onBeforeRequest, onSuccessRequest, onFailRequest, }: {
|
|
13
|
+
onBeforeRequest: () => Promise<TParametersCheckTelephony>;
|
|
14
|
+
onSuccessRequest: () => void;
|
|
15
|
+
onFailRequest: () => void;
|
|
16
|
+
}): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
}
|
|
19
|
+
export default CheckTelephonyRequester;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CallManager } from '../CallManager';
|
|
2
|
+
import { ConnectionManager } from '../ConnectionManager';
|
|
3
|
+
declare class PingServerIfNotActiveCallRequester {
|
|
4
|
+
private readonly callManager;
|
|
5
|
+
private readonly pingServerRequester;
|
|
6
|
+
private disposeCallStatusChange;
|
|
7
|
+
constructor({ connectionManager, callManager, }: {
|
|
8
|
+
connectionManager: ConnectionManager;
|
|
9
|
+
callManager: CallManager;
|
|
10
|
+
});
|
|
11
|
+
start({ onFailRequest }: {
|
|
12
|
+
onFailRequest: () => void;
|
|
13
|
+
}): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
private unsubscribeCallStatusChange;
|
|
16
|
+
private handleCallStatusChange;
|
|
17
|
+
}
|
|
18
|
+
export default PingServerIfNotActiveCallRequester;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConnectionManager } from '../ConnectionManager';
|
|
2
|
+
declare class PingServerRequester {
|
|
3
|
+
private readonly connectionManager;
|
|
4
|
+
private readonly pingServerByTimeoutWithFailCalls;
|
|
5
|
+
constructor({ connectionManager }: {
|
|
6
|
+
connectionManager: ConnectionManager;
|
|
7
|
+
});
|
|
8
|
+
start({ onFailRequest }: {
|
|
9
|
+
onFailRequest: () => void;
|
|
10
|
+
}): void;
|
|
11
|
+
stop(): void;
|
|
12
|
+
}
|
|
13
|
+
export default PingServerRequester;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CallManager } from '../CallManager';
|
|
2
|
+
import { ConnectionManager } from '../ConnectionManager';
|
|
3
|
+
import { ISubscriber } from './types';
|
|
4
|
+
declare class RegistrationFailedOutOfCallSubscriber implements ISubscriber {
|
|
5
|
+
private readonly connectionManager;
|
|
6
|
+
private readonly callManager;
|
|
7
|
+
private isRegistrationFailed;
|
|
8
|
+
private disposers;
|
|
9
|
+
constructor({ connectionManager, callManager, }: {
|
|
10
|
+
connectionManager: ConnectionManager;
|
|
11
|
+
callManager: CallManager;
|
|
12
|
+
});
|
|
13
|
+
subscribe(callback: () => void): void;
|
|
14
|
+
unsubscribe(): void;
|
|
15
|
+
private setIsRegistrationFailed;
|
|
16
|
+
private resetIsRegistrationFailed;
|
|
17
|
+
}
|
|
18
|
+
export default RegistrationFailedOutOfCallSubscriber;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TypedEvents } from 'events-constructor';
|
|
2
|
+
import { TAttemptStatus } from './types';
|
|
3
|
+
export declare enum EEvent {
|
|
4
|
+
BEFORE_ATTEMPT = "before-attempt",
|
|
5
|
+
SUCCEEDED_ATTEMPT = "succeeded-attempt",
|
|
6
|
+
FAILED_ATTEMPT = "failed-attempt",
|
|
7
|
+
CANCELLED_ATTEMPT = "cancelled-attempt",
|
|
8
|
+
CHANGED_ATTEMPT_STATUS = "changed-attempt-status"
|
|
9
|
+
}
|
|
10
|
+
export declare const EVENT_NAMES: readonly ["before-attempt", "succeeded-attempt", "failed-attempt", "cancelled-attempt", "changed-attempt-status"];
|
|
11
|
+
export type TEventMap = {
|
|
12
|
+
'before-attempt': Record<string, never>;
|
|
13
|
+
'succeeded-attempt': Record<string, never>;
|
|
14
|
+
'failed-attempt': Error;
|
|
15
|
+
'cancelled-attempt': Error;
|
|
16
|
+
'changed-attempt-status': TAttemptStatus;
|
|
17
|
+
};
|
|
18
|
+
export type TEvents = TypedEvents<TEventMap>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConnectionManager } from '../ConnectionManager';
|
|
2
|
+
import { ConnectionQueueManager } from '../ConnectionQueueManager';
|
|
3
|
+
export interface IAutoConnectorOptions {
|
|
4
|
+
checkTelephonyRequestInterval?: number;
|
|
5
|
+
timeoutBetweenAttempts?: number;
|
|
6
|
+
onBeforeRetry?: () => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export type ISubscriber<T = void> = {
|
|
9
|
+
subscribe: (callback: (value: T) => void) => void;
|
|
10
|
+
unsubscribe: () => void;
|
|
11
|
+
};
|
|
12
|
+
export type TParametersCheckTelephony = Parameters<ConnectionManager['checkTelephony']>[0];
|
|
13
|
+
export type TParametersConnect = Parameters<ConnectionQueueManager['connect']>[0] extends (() => Promise<infer T>) | infer T ? T : never;
|
|
14
|
+
type TOptionsConnect = Parameters<ConnectionQueueManager['connect']>[1];
|
|
15
|
+
export type TParametersAutoConnect = {
|
|
16
|
+
getParameters: () => Promise<TParametersConnect & TParametersCheckTelephony>;
|
|
17
|
+
options?: TOptionsConnect;
|
|
18
|
+
};
|
|
19
|
+
export type TAttemptStatus = {
|
|
20
|
+
isInProgress: boolean;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { hasParametersNotExistError, createParametersNotExistError } from './errors';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RTCSession } from '@krivega/jssip';
|
|
2
|
-
import {
|
|
2
|
+
import { TEvents, TEventMap } from './eventNames';
|
|
3
3
|
import { ICallStrategy } from './types';
|
|
4
4
|
declare class CallManager {
|
|
5
5
|
readonly events: TEvents;
|
|
@@ -9,11 +9,12 @@ declare class CallManager {
|
|
|
9
9
|
get connection(): RTCPeerConnection | undefined;
|
|
10
10
|
get establishedRTCSession(): RTCSession | undefined;
|
|
11
11
|
get isCallActive(): ICallStrategy['isCallActive'];
|
|
12
|
-
on<T>(eventName:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
on<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
|
|
13
|
+
onRace<T extends keyof TEventMap>(eventNames: T[], handler: (data: TEventMap[T], eventName: string) => void): () => void;
|
|
14
|
+
once<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
|
|
15
|
+
onceRace<T extends keyof TEventMap>(eventNames: T[], handler: (data: TEventMap[T], eventName: string) => void): () => void;
|
|
16
|
+
wait<T extends keyof TEventMap>(eventName: T): Promise<TEventMap[T]>;
|
|
17
|
+
off<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): void;
|
|
17
18
|
setStrategy(strategy: ICallStrategy): void;
|
|
18
19
|
startCall: ICallStrategy['startCall'];
|
|
19
20
|
endCall: ICallStrategy['endCall'];
|
|
@@ -21,9 +22,10 @@ declare class CallManager {
|
|
|
21
22
|
getEstablishedRTCSession: ICallStrategy['getEstablishedRTCSession'];
|
|
22
23
|
getCallConfiguration: ICallStrategy['getCallConfiguration'];
|
|
23
24
|
getRemoteStreams: ICallStrategy['getRemoteStreams'];
|
|
24
|
-
getTransceivers: ICallStrategy['getTransceivers'];
|
|
25
25
|
addTransceiver: ICallStrategy['addTransceiver'];
|
|
26
26
|
replaceMediaStream: ICallStrategy['replaceMediaStream'];
|
|
27
27
|
restartIce: ICallStrategy['restartIce'];
|
|
28
|
+
private subscribeCallStatusChange;
|
|
29
|
+
private maybeTriggerCallStatus;
|
|
28
30
|
}
|
|
29
31
|
export default CallManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RTCSession } from '@krivega/jssip';
|
|
2
2
|
import { TEvents } from './eventNames';
|
|
3
|
-
import { ICallStrategy,
|
|
3
|
+
import { ICallStrategy, TCallConfiguration, TOntrack } from './types';
|
|
4
4
|
export declare abstract class AbstractCallStrategy implements ICallStrategy {
|
|
5
5
|
protected isPendingCall: boolean;
|
|
6
6
|
protected isPendingAnswer: boolean;
|
|
@@ -16,7 +16,7 @@ export declare abstract class AbstractCallStrategy implements ICallStrategy {
|
|
|
16
16
|
/**
|
|
17
17
|
* Запуск исходящего звонка
|
|
18
18
|
*/
|
|
19
|
-
abstract startCall(
|
|
19
|
+
abstract startCall(ua: Parameters<ICallStrategy['startCall']>[0], getSipServerUrl: Parameters<ICallStrategy['startCall']>[1], params: Parameters<ICallStrategy['startCall']>[2]): Promise<RTCPeerConnection>;
|
|
20
20
|
/**
|
|
21
21
|
* Завершение звонка
|
|
22
22
|
*/
|
|
@@ -38,10 +38,6 @@ export declare abstract class AbstractCallStrategy implements ICallStrategy {
|
|
|
38
38
|
* Получение удаленных медиа-потоков
|
|
39
39
|
*/
|
|
40
40
|
abstract getRemoteStreams(): MediaStream[] | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Получение сохраненных transceiver'ов
|
|
43
|
-
*/
|
|
44
|
-
abstract getTransceivers(): Readonly<ITransceiverStorage>;
|
|
45
41
|
/**
|
|
46
42
|
* Добавление нового transceiver'а
|
|
47
43
|
*/
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { AbstractCallStrategy } from './AbstractCallStrategy';
|
|
2
2
|
import { RTCSession } from '@krivega/jssip';
|
|
3
3
|
import { TEvents } from './eventNames';
|
|
4
|
-
import { ICallStrategy,
|
|
4
|
+
import { ICallStrategy, TOntrack } from './types';
|
|
5
5
|
export declare class MCUCallStrategy extends AbstractCallStrategy {
|
|
6
6
|
private readonly remoteStreamsManager;
|
|
7
7
|
private readonly disposers;
|
|
8
|
-
/**
|
|
9
|
-
* Менеджер для управления transceiver'ами
|
|
10
|
-
*/
|
|
11
|
-
private readonly transceiverManager;
|
|
12
8
|
constructor(events: TEvents);
|
|
13
9
|
get requested(): boolean;
|
|
14
10
|
get connection(): RTCPeerConnection | undefined;
|
|
@@ -32,10 +28,6 @@ export declare class MCUCallStrategy extends AbstractCallStrategy {
|
|
|
32
28
|
degradationPreference?: RTCDegradationPreference;
|
|
33
29
|
}): Promise<boolean>;
|
|
34
30
|
addTransceiver(kind: 'audio' | 'video', options?: RTCRtpTransceiverInit): Promise<RTCRtpTransceiver>;
|
|
35
|
-
/**
|
|
36
|
-
* Возвращает сохраненные transceiver'ы
|
|
37
|
-
*/
|
|
38
|
-
getTransceivers(): Readonly<ITransceiverStorage>;
|
|
39
31
|
protected readonly handleCall: ({ ontrack, }: {
|
|
40
32
|
ontrack?: TOntrack;
|
|
41
33
|
}) => Promise<RTCPeerConnection>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IncomingInfoEvent, OutgoingInfoEvent, EndEvent } from '@krivega/jssip';
|
|
2
|
+
import { TypedEvents } from 'events-constructor';
|
|
2
3
|
export declare enum EEvent {
|
|
3
4
|
PEER_CONNECTION = "peerconnection",
|
|
4
5
|
CONNECTING = "connecting",
|
|
@@ -32,7 +33,8 @@ export declare enum EEvent {
|
|
|
32
33
|
FAILED_PRESENTATION = "presentation:failed",
|
|
33
34
|
PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed",
|
|
34
35
|
PEER_CONNECTION_ONTRACK = "peerconnection:ontrack",
|
|
35
|
-
ENDED_FROM_SERVER = "ended:fromserver"
|
|
36
|
+
ENDED_FROM_SERVER = "ended:fromserver",
|
|
37
|
+
CALL_STATUS_CHANGED = "call-status-changed"
|
|
36
38
|
}
|
|
37
39
|
export declare enum Originator {
|
|
38
40
|
LOCAL = "local",
|
|
@@ -40,6 +42,48 @@ export declare enum Originator {
|
|
|
40
42
|
SYSTEM = "system"
|
|
41
43
|
}
|
|
42
44
|
export declare const SESSION_JSSIP_EVENT_NAMES: readonly ["peerconnection", "connecting", "sending", "progress", "accepted", "confirmed", "ended", "failed", "newInfo", "newDTMF", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "reinvite", "update", "refer", "replaces", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed"];
|
|
43
|
-
export declare const EVENT_NAMES: readonly ["peerconnection", "connecting", "sending", "progress", "accepted", "confirmed", "ended", "failed", "newInfo", "newDTMF", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "reinvite", "update", "refer", "replaces", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "peerconnection:confirmed", "peerconnection:ontrack", "ended:fromserver"];
|
|
44
|
-
export type TEvents = Events<typeof EVENT_NAMES>;
|
|
45
|
+
export declare const EVENT_NAMES: readonly ["peerconnection", "connecting", "sending", "progress", "accepted", "confirmed", "ended", "failed", "newInfo", "newDTMF", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "reinvite", "update", "refer", "replaces", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "peerconnection:confirmed", "peerconnection:ontrack", "ended:fromserver", "call-status-changed"];
|
|
45
46
|
export type TEvent = (typeof EVENT_NAMES)[number];
|
|
47
|
+
export type TEventMap = {
|
|
48
|
+
peerconnection: {
|
|
49
|
+
peerconnection: RTCPeerConnection;
|
|
50
|
+
};
|
|
51
|
+
connecting: unknown;
|
|
52
|
+
sending: unknown;
|
|
53
|
+
progress: unknown;
|
|
54
|
+
accepted: unknown;
|
|
55
|
+
confirmed: unknown;
|
|
56
|
+
ended: EndEvent;
|
|
57
|
+
failed: EndEvent;
|
|
58
|
+
newDTMF: {
|
|
59
|
+
originator: `${Originator}`;
|
|
60
|
+
};
|
|
61
|
+
newInfo: IncomingInfoEvent | OutgoingInfoEvent;
|
|
62
|
+
hold: unknown;
|
|
63
|
+
unhold: unknown;
|
|
64
|
+
muted: unknown;
|
|
65
|
+
unmuted: unknown;
|
|
66
|
+
reinvite: unknown;
|
|
67
|
+
update: unknown;
|
|
68
|
+
refer: unknown;
|
|
69
|
+
replaces: unknown;
|
|
70
|
+
sdp: unknown;
|
|
71
|
+
icecandidate: unknown;
|
|
72
|
+
getusermediafailed: unknown;
|
|
73
|
+
'peerconnection:createofferfailed': unknown;
|
|
74
|
+
'peerconnection:createanswerfailed': unknown;
|
|
75
|
+
'peerconnection:setlocaldescriptionfailed': unknown;
|
|
76
|
+
'peerconnection:setremotedescriptionfailed': unknown;
|
|
77
|
+
'presentation:start': MediaStream;
|
|
78
|
+
'presentation:started': MediaStream;
|
|
79
|
+
'presentation:end': MediaStream;
|
|
80
|
+
'presentation:ended': MediaStream;
|
|
81
|
+
'presentation:failed': Error;
|
|
82
|
+
'peerconnection:confirmed': RTCPeerConnection;
|
|
83
|
+
'peerconnection:ontrack': RTCTrackEvent;
|
|
84
|
+
'ended:fromserver': EndEvent;
|
|
85
|
+
'call-status-changed': {
|
|
86
|
+
isCallActive: boolean;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type TEvents = TypedEvents<TEventMap>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as CallManager } from './@CallManager';
|
|
2
2
|
export { ECallCause } from './causes';
|
|
3
|
-
export {
|
|
3
|
+
export type { TEventMap } from './eventNames';
|
|
4
|
+
export { EEvent as ECallEvent } from './eventNames';
|
|
4
5
|
export type { TEvent as TCallEvent, TEvents as TCallEvents } from './eventNames';
|
|
5
6
|
export { default as hasCanceledCallError } from './hasCanceledCallError';
|
|
6
7
|
export { MCUCallStrategy } from './MCUCallStrategy';
|
|
7
|
-
export {
|
|
8
|
-
export type { TCustomError, TGetServerUrl, ITransceiverStorage } from './types';
|
|
8
|
+
export type { TCustomError, TGetServerUrl } from './types';
|
|
@@ -25,7 +25,7 @@ export type TParamsCall = TParamsAnswerToIncomingCall & {
|
|
|
25
25
|
number: string;
|
|
26
26
|
};
|
|
27
27
|
export type TCustomError = Error & {
|
|
28
|
-
originator?: Originator
|
|
28
|
+
originator?: `${Originator}`;
|
|
29
29
|
cause?: unknown;
|
|
30
30
|
message: unknown;
|
|
31
31
|
_ws?: unknown;
|
|
@@ -33,17 +33,6 @@ export type TCustomError = Error & {
|
|
|
33
33
|
url?: string;
|
|
34
34
|
code?: string;
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
37
|
-
* Интерфейс для хранения основных transceiver'ов
|
|
38
|
-
*/
|
|
39
|
-
export interface ITransceiverStorage {
|
|
40
|
-
/** Основной transceiver для видео */
|
|
41
|
-
mainVideo?: RTCRtpTransceiver;
|
|
42
|
-
/** Основной transceiver для аудио */
|
|
43
|
-
mainAudio?: RTCRtpTransceiver;
|
|
44
|
-
/** Transceiver для презентации видео */
|
|
45
|
-
presentationVideo?: RTCRtpTransceiver;
|
|
46
|
-
}
|
|
47
36
|
export type TCallConfiguration = {
|
|
48
37
|
answer?: boolean;
|
|
49
38
|
number?: string;
|
|
@@ -59,7 +48,6 @@ export interface ICallStrategy {
|
|
|
59
48
|
getEstablishedRTCSession: () => RTCSession | undefined;
|
|
60
49
|
getCallConfiguration: () => TCallConfiguration;
|
|
61
50
|
getRemoteStreams: () => MediaStream[] | undefined;
|
|
62
|
-
getTransceivers: () => Readonly<ITransceiverStorage>;
|
|
63
51
|
addTransceiver: (kind: 'audio' | 'video', options?: RTCRtpTransceiverInit) => Promise<RTCRtpTransceiver>;
|
|
64
52
|
replaceMediaStream: (mediaStream: MediaStream, options?: {
|
|
65
53
|
deleteExisting?: boolean;
|
|
@@ -5,6 +5,10 @@ import { RegisteredEvent, UA, UnRegisteredEvent, WebSocketInterface } from '@kri
|
|
|
5
5
|
import { TGetServerUrl } from '../CallManager';
|
|
6
6
|
import { TJsSIP } from '../types';
|
|
7
7
|
import { TConnect, TSet } from './ConnectionFlow';
|
|
8
|
+
type TConnectParameters = (() => Promise<Parameters<TConnect>[0]>) | Parameters<TConnect>[0];
|
|
9
|
+
type TConnectOptions = Parameters<TConnect>[1] & {
|
|
10
|
+
hasReadyForConnection?: () => boolean;
|
|
11
|
+
};
|
|
8
12
|
export default class ConnectionManager {
|
|
9
13
|
readonly events: Events<typeof EVENT_NAMES>;
|
|
10
14
|
ua?: UA;
|
|
@@ -22,10 +26,12 @@ export default class ConnectionManager {
|
|
|
22
26
|
get requested(): boolean;
|
|
23
27
|
get isPendingConnect(): boolean;
|
|
24
28
|
get isPendingInitUa(): boolean;
|
|
29
|
+
get isDisconnected(): boolean;
|
|
30
|
+
get isFailed(): boolean;
|
|
25
31
|
get connectionState(): import('./ConnectionStateMachine').EState;
|
|
26
32
|
get isRegistered(): boolean;
|
|
27
33
|
get isRegisterConfig(): boolean;
|
|
28
|
-
connect:
|
|
34
|
+
connect: (parameters: TConnectParameters, options?: TConnectOptions) => Promise<UA>;
|
|
29
35
|
set: TSet;
|
|
30
36
|
disconnect: () => Promise<void>;
|
|
31
37
|
register(): Promise<RegisteredEvent>;
|
|
@@ -45,4 +51,7 @@ export default class ConnectionManager {
|
|
|
45
51
|
getSipServerUrl: TGetServerUrl;
|
|
46
52
|
readonly getUaProtected: () => UA;
|
|
47
53
|
private readonly getUa;
|
|
54
|
+
private readonly connectWithProcessError;
|
|
55
|
+
private readonly processConnect;
|
|
48
56
|
}
|
|
57
|
+
export {};
|
|
@@ -3,14 +3,18 @@ export declare enum EEvent {
|
|
|
3
3
|
CONNECTING = "connecting",
|
|
4
4
|
CONNECTED = "connected",
|
|
5
5
|
DISCONNECTED = "disconnected",
|
|
6
|
+
DISCONNECTING = "disconnecting",
|
|
6
7
|
NEW_RTC_SESSION = "newRTCSession",
|
|
7
8
|
REGISTERED = "registered",
|
|
8
9
|
UNREGISTERED = "unregistered",
|
|
9
10
|
REGISTRATION_FAILED = "registrationFailed",
|
|
10
11
|
NEW_MESSAGE = "newMessage",
|
|
11
|
-
SIP_EVENT = "sipEvent"
|
|
12
|
+
SIP_EVENT = "sipEvent",
|
|
13
|
+
CONNECT_STARTED = "connect-started",
|
|
14
|
+
CONNECT_SUCCEEDED = "connect-succeeded",
|
|
15
|
+
CONNECT_FAILED = "connect-failed"
|
|
12
16
|
}
|
|
13
17
|
export declare const UA_EVENT_NAMES: readonly ["connecting", "connected", "disconnected", "newRTCSession", "registered", "unregistered", "registrationFailed", "newMessage", "sipEvent"];
|
|
14
|
-
export declare const EVENT_NAMES:
|
|
18
|
+
export declare const EVENT_NAMES: readonly ["connecting", "connected", "disconnected", "newRTCSession", "registered", "unregistered", "registrationFailed", "newMessage", "sipEvent", "disconnecting", "connect-started", "connect-succeeded", "connect-failed"];
|
|
15
19
|
export type TEvent = (typeof EVENT_NAMES)[number];
|
|
16
20
|
export type TEvents = Events<typeof EVENT_NAMES>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as ConnectionManager } from './@ConnectionManager';
|
|
2
2
|
export { EVENT_NAMES as CONNECTION_MANAGER_EVENT_NAMES, EEvent as EConnectionManagerEvent, } from './eventNames';
|
|
3
3
|
export type { TEvent as TConnectionManagerEvent, TEvents as TConnectionManagerEvents, } from './eventNames';
|
|
4
|
+
export { hasNotReadyForConnectionError, resolveParameters } from './utils';
|
|
@@ -7,12 +7,6 @@ declare class ConnectionQueueManager {
|
|
|
7
7
|
});
|
|
8
8
|
connect: ConnectionManager['connect'];
|
|
9
9
|
disconnect: ConnectionManager['disconnect'];
|
|
10
|
-
|
|
11
|
-
unregister: ConnectionManager['unregister'];
|
|
12
|
-
tryRegister: ConnectionManager['tryRegister'];
|
|
13
|
-
checkTelephony: ConnectionManager['checkTelephony'];
|
|
14
|
-
sendOptions: ConnectionManager['sendOptions'];
|
|
15
|
-
ping: ConnectionManager['ping'];
|
|
16
|
-
set: ConnectionManager['set'];
|
|
10
|
+
stop(): void;
|
|
17
11
|
}
|
|
18
12
|
export default ConnectionQueueManager;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Events } from 'events-constructor';
|
|
2
2
|
import { ApiManager } from '../ApiManager';
|
|
3
|
-
import {
|
|
3
|
+
import { AutoConnectorManager, IAutoConnectorOptions } from '../AutoConnectorManager';
|
|
4
|
+
import { CallManager, TGetServerUrl } from '../CallManager';
|
|
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';
|
|
10
|
+
import { TransceiverManager } from '../TransceiverManager';
|
|
9
11
|
import { VideoSendingBalancerManager } from '../VideoSendingBalancerManager';
|
|
10
12
|
import { EVENT_NAMES, TEvent } from './eventNames';
|
|
11
|
-
import { TGetServerUrl } from '../CallManager';
|
|
12
13
|
import { TJsSIP } from '../types';
|
|
13
14
|
import { IBalancerOptions } from '../VideoSendingBalancer';
|
|
14
15
|
declare class SipConnector {
|
|
@@ -16,19 +17,22 @@ declare class SipConnector {
|
|
|
16
17
|
readonly connectionManager: ConnectionManager;
|
|
17
18
|
readonly connectionQueueManager: ConnectionQueueManager;
|
|
18
19
|
readonly callManager: CallManager;
|
|
20
|
+
readonly autoConnectorManager: AutoConnectorManager;
|
|
19
21
|
readonly apiManager: ApiManager;
|
|
20
22
|
readonly incomingCallManager: IncomingCallManager;
|
|
21
23
|
readonly presentationManager: PresentationManager;
|
|
22
24
|
readonly statsManager: StatsManager;
|
|
23
25
|
readonly videoSendingBalancerManager: VideoSendingBalancerManager;
|
|
26
|
+
readonly transceiverManager: TransceiverManager;
|
|
24
27
|
private readonly preferredMimeTypesVideoCodecs?;
|
|
25
28
|
private readonly excludeMimeTypesVideoCodecs?;
|
|
26
29
|
constructor({ JsSIP }: {
|
|
27
30
|
JsSIP: TJsSIP;
|
|
28
|
-
}, { preferredMimeTypesVideoCodecs, excludeMimeTypesVideoCodecs, videoBalancerOptions, }?: {
|
|
31
|
+
}, { preferredMimeTypesVideoCodecs, excludeMimeTypesVideoCodecs, videoBalancerOptions, autoConnectorOptions, }?: {
|
|
29
32
|
preferredMimeTypesVideoCodecs?: string[];
|
|
30
33
|
excludeMimeTypesVideoCodecs?: string[];
|
|
31
34
|
videoBalancerOptions?: IBalancerOptions;
|
|
35
|
+
autoConnectorOptions?: IAutoConnectorOptions;
|
|
32
36
|
});
|
|
33
37
|
get requestedConnection(): boolean;
|
|
34
38
|
get isPendingConnect(): boolean;
|
|
@@ -49,17 +53,19 @@ declare class SipConnector {
|
|
|
49
53
|
wait<T>(eventName: TEvent): Promise<T>;
|
|
50
54
|
off<T>(eventName: TEvent, handler: (data: T) => void): void;
|
|
51
55
|
connect: ConnectionManager['connect'];
|
|
52
|
-
set: ConnectionManager['set'];
|
|
53
56
|
disconnect: () => Promise<void>;
|
|
54
57
|
register: () => Promise<import('@krivega/jssip').RegisteredEvent>;
|
|
55
58
|
unregister: () => Promise<import('@krivega/jssip').UnRegisteredEvent>;
|
|
56
59
|
tryRegister: () => Promise<import('@krivega/jssip').RegisteredEvent>;
|
|
60
|
+
set: ConnectionManager['set'];
|
|
57
61
|
sendOptions: (target: Parameters<ConnectionManager["sendOptions"]>[0], body?: Parameters<ConnectionManager["sendOptions"]>[1], extraHeaders?: Parameters<ConnectionManager["sendOptions"]>[2]) => Promise<void>;
|
|
58
62
|
ping: (body?: Parameters<ConnectionManager["ping"]>[0], extraHeaders?: Parameters<ConnectionManager["ping"]>[1]) => Promise<void>;
|
|
59
63
|
checkTelephony: ConnectionManager['checkTelephony'];
|
|
60
64
|
isConfigured: () => boolean;
|
|
61
65
|
getConnectionConfiguration: () => import('../ConnectionManager/ConfigurationManager').IConnectionConfiguration;
|
|
62
66
|
getSipServerUrl: TGetServerUrl;
|
|
67
|
+
startAutoConnect: AutoConnectorManager['start'];
|
|
68
|
+
stopAutoConnect: AutoConnectorManager['stop'];
|
|
63
69
|
call: (params: Parameters<CallManager["startCall"]>[2]) => Promise<RTCPeerConnection>;
|
|
64
70
|
hangUp: CallManager['endCall'];
|
|
65
71
|
answerToIncomingCall: (params: Parameters<CallManager["answerToIncomingCall"]>[1]) => Promise<RTCPeerConnection>;
|
|
@@ -106,7 +112,7 @@ declare class SipConnector {
|
|
|
106
112
|
askPermissionToEnableCam(...args: Parameters<ApiManager['askPermissionToEnableCam']>): Promise<void>;
|
|
107
113
|
private setCodecPreferences;
|
|
108
114
|
private subscribe;
|
|
109
|
-
private readonly
|
|
110
|
-
private readonly
|
|
115
|
+
private readonly bridgeEvents;
|
|
116
|
+
private readonly resolveHandleAddTransceiver;
|
|
111
117
|
}
|
|
112
118
|
export default SipConnector;
|