sip-connector 16.2.0 → 18.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.
Files changed (34) hide show
  1. package/README.md +128 -45
  2. package/dist/@SipConnector-CFYT0HQB.cjs +1 -0
  3. package/dist/{@SipConnector-D1YBDd7g.js → @SipConnector-UTHCoMXw.js} +880 -800
  4. package/dist/ApiManager/__tests-utils__/helpers.d.ts +2 -4
  5. package/dist/ApiManager/constants.d.ts +1 -2
  6. package/dist/ApiManager/eventNames.d.ts +1 -2
  7. package/dist/ApiManager/index.d.ts +1 -0
  8. package/dist/CallManager/@CallManager.d.ts +7 -6
  9. package/dist/CallManager/AbstractCallStrategy.d.ts +5 -1
  10. package/dist/CallManager/MCUCallStrategy.d.ts +1 -0
  11. package/dist/CallManager/eventNames.d.ts +42 -2
  12. package/dist/CallManager/index.d.ts +2 -1
  13. package/dist/CallManager/types.d.ts +5 -4
  14. package/dist/PresentationManager/types.d.ts +1 -1
  15. package/dist/SipConnector/@SipConnector.d.ts +4 -1
  16. package/dist/SipConnector/eventNames.d.ts +1 -1
  17. package/dist/SipConnectorFacade/index.d.ts +1 -1
  18. package/dist/StatsPeerConnection/index.d.ts +1 -1
  19. package/dist/TransceiverManager/@TransceiverManager.d.ts +70 -0
  20. package/dist/TransceiverManager/index.d.ts +1 -0
  21. package/dist/TransceiverManager/types.d.ts +11 -0
  22. package/dist/VideoSendingBalancer/index.d.ts +1 -1
  23. package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +2 -1
  24. package/dist/__fixtures__/RTCRtpTransceiverMock.d.ts +16 -0
  25. package/dist/__fixtures__/eventNames.d.ts +1 -1
  26. package/dist/doMock.cjs +1 -1
  27. package/dist/doMock.js +166 -143
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.js +83 -83
  30. package/package.json +12 -12
  31. package/dist/@SipConnector-B5FFHZzJ.cjs +0 -1
  32. /package/dist/SipConnectorFacade/{SipConnectorFacade.d.ts → @SipConnectorFacade.d.ts} +0 -0
  33. /package/dist/StatsPeerConnection/{StatsPeerConnection.d.ts → @StatsPeerConnection.d.ts} +0 -0
  34. /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: string, request: MockRequest): {
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", "participant:move-request-to-spectators-over-sfu", "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"];
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>;
@@ -1,3 +1,4 @@
1
1
  export { default as ApiManager } from './@ApiManager';
2
2
  export { EContentTypeReceived, EContentTypeSent, EEventsMainCAM, EEventsMic, EEventsSyncMediaState, EHeader, EShareState, EUseLicense, } from './constants';
3
3
  export type { TEvent as TApiEvent } from './eventNames';
4
+ export type { TRestartData } from './types';
@@ -1,5 +1,5 @@
1
1
  import { RTCSession } from '@krivega/jssip';
2
- import { TEvent, TEvents } from './eventNames';
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,11 @@ 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: TEvent, handler: (data: T) => void): () => void;
13
- once<T>(eventName: TEvent, handler: (data: T) => void): () => void;
14
- onceRace<T>(eventNames: TEvent[], handler: (data: T, eventName: string) => void): () => void;
15
- wait<T>(eventName: TEvent): Promise<T>;
16
- off<T>(eventName: TEvent, handler: (data: T) => void): void;
12
+ on<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
13
+ once<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): () => void;
14
+ onceRace<T extends keyof TEventMap>(eventNames: T[], handler: (data: TEventMap[T], eventName: string) => void): () => void;
15
+ wait<T extends keyof TEventMap>(eventName: T): Promise<TEventMap[T]>;
16
+ off<T extends keyof TEventMap>(eventName: T, handler: (data: TEventMap[T]) => void): void;
17
17
  setStrategy(strategy: ICallStrategy): void;
18
18
  startCall: ICallStrategy['startCall'];
19
19
  endCall: ICallStrategy['endCall'];
@@ -21,6 +21,7 @@ declare class CallManager {
21
21
  getEstablishedRTCSession: ICallStrategy['getEstablishedRTCSession'];
22
22
  getCallConfiguration: ICallStrategy['getCallConfiguration'];
23
23
  getRemoteStreams: ICallStrategy['getRemoteStreams'];
24
+ addTransceiver: ICallStrategy['addTransceiver'];
24
25
  replaceMediaStream: ICallStrategy['replaceMediaStream'];
25
26
  restartIce: ICallStrategy['restartIce'];
26
27
  }
@@ -16,7 +16,7 @@ export declare abstract class AbstractCallStrategy implements ICallStrategy {
16
16
  /**
17
17
  * Запуск исходящего звонка
18
18
  */
19
- abstract startCall(params: Parameters<ICallStrategy['startCall']>[0], ua: Parameters<ICallStrategy['startCall']>[1], getSipServerUrl: Parameters<ICallStrategy['startCall']>[2]): Promise<RTCPeerConnection>;
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,6 +38,10 @@ export declare abstract class AbstractCallStrategy implements ICallStrategy {
38
38
  * Получение удаленных медиа-потоков
39
39
  */
40
40
  abstract getRemoteStreams(): MediaStream[] | undefined;
41
+ /**
42
+ * Добавление нового transceiver'а
43
+ */
44
+ abstract addTransceiver(kind: 'audio' | 'video', options?: RTCRtpTransceiverInit): Promise<RTCRtpTransceiver>;
41
45
  /**
42
46
  * Перезапуск ICE-соединения
43
47
  */
@@ -27,6 +27,7 @@ export declare class MCUCallStrategy extends AbstractCallStrategy {
27
27
  sendEncodings?: RTCRtpEncodingParameters[];
28
28
  degradationPreference?: RTCDegradationPreference;
29
29
  }): Promise<boolean>;
30
+ addTransceiver(kind: 'audio' | 'video', options?: RTCRtpTransceiverInit): Promise<RTCRtpTransceiver>;
30
31
  protected readonly handleCall: ({ ontrack, }: {
31
32
  ontrack?: TOntrack;
32
33
  }) => Promise<RTCPeerConnection>;
@@ -1,4 +1,5 @@
1
- import { Events } from 'events-constructor';
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",
@@ -41,5 +42,44 @@ export declare enum Originator {
41
42
  }
42
43
  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
44
  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
45
  export type TEvent = (typeof EVENT_NAMES)[number];
46
+ export type TEventMap = {
47
+ peerconnection: {
48
+ peerconnection: RTCPeerConnection;
49
+ };
50
+ connecting: unknown;
51
+ sending: unknown;
52
+ progress: unknown;
53
+ accepted: unknown;
54
+ confirmed: unknown;
55
+ ended: EndEvent;
56
+ failed: EndEvent;
57
+ newDTMF: {
58
+ originator: `${Originator}`;
59
+ };
60
+ newInfo: IncomingInfoEvent | OutgoingInfoEvent;
61
+ hold: unknown;
62
+ unhold: unknown;
63
+ muted: unknown;
64
+ unmuted: unknown;
65
+ reinvite: unknown;
66
+ update: unknown;
67
+ refer: unknown;
68
+ replaces: unknown;
69
+ sdp: unknown;
70
+ icecandidate: unknown;
71
+ getusermediafailed: unknown;
72
+ 'peerconnection:createofferfailed': unknown;
73
+ 'peerconnection:createanswerfailed': unknown;
74
+ 'peerconnection:setlocaldescriptionfailed': unknown;
75
+ 'peerconnection:setremotedescriptionfailed': unknown;
76
+ 'presentation:start': MediaStream;
77
+ 'presentation:started': MediaStream;
78
+ 'presentation:end': MediaStream;
79
+ 'presentation:ended': MediaStream;
80
+ 'presentation:failed': Error;
81
+ 'peerconnection:confirmed': RTCPeerConnection;
82
+ 'peerconnection:ontrack': RTCTrackEvent;
83
+ 'ended:fromserver': EndEvent;
84
+ };
85
+ export type TEvents = TypedEvents<TEventMap>;
@@ -1,6 +1,7 @@
1
1
  export { default as CallManager } from './@CallManager';
2
2
  export { ECallCause } from './causes';
3
- export { EEvent as ECallEvent, Originator } from './eventNames';
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';
@@ -1,8 +1,8 @@
1
1
  import { RTCSession, UA } from '@krivega/jssip';
2
2
  import { TContentHint } from '../PresentationManager';
3
3
  import { Originator } from './eventNames';
4
- export type TOntrack = (track: RTCTrackEvent) => void;
5
- export type TOnAddedTransceiver = (transceiver: RTCRtpTransceiver, track: MediaStreamTrack, stream: MediaStream) => Promise<void>;
4
+ export type TOntrack = (event: RTCTrackEvent) => void;
5
+ export type TOnAddedTransceiver = (transceiver: RTCRtpTransceiver, track: MediaStreamTrack, streams: MediaStream[]) => Promise<void>;
6
6
  export type TGetServerUrl = (id: string) => string;
7
7
  type TOptionsExtraHeaders = {
8
8
  extraHeaders?: string[];
@@ -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;
@@ -48,6 +48,7 @@ export interface ICallStrategy {
48
48
  getEstablishedRTCSession: () => RTCSession | undefined;
49
49
  getCallConfiguration: () => TCallConfiguration;
50
50
  getRemoteStreams: () => MediaStream[] | undefined;
51
+ addTransceiver: (kind: 'audio' | 'video', options?: RTCRtpTransceiverInit) => Promise<RTCRtpTransceiver>;
51
52
  replaceMediaStream: (mediaStream: MediaStream, options?: {
52
53
  deleteExisting?: boolean;
53
54
  addMissing?: boolean;
@@ -58,8 +59,8 @@ export interface ICallStrategy {
58
59
  onAddedTransceiver?: TOnAddedTransceiver;
59
60
  }) => Promise<void>;
60
61
  restartIce: (options?: {
61
- useUpdate?: boolean;
62
62
  extraHeaders?: string[];
63
+ useUpdate?: boolean;
63
64
  rtcOfferConstraints?: RTCOfferOptions;
64
65
  sendEncodings?: RTCRtpEncodingParameters[];
65
66
  degradationPreference?: RTCDegradationPreference;
@@ -1,2 +1,2 @@
1
- export type TOnAddedTransceiver = (transceiver: RTCRtpTransceiver, track: MediaStreamTrack, stream: MediaStream) => Promise<void>;
1
+ export type TOnAddedTransceiver = (transceiver: RTCRtpTransceiver, track: MediaStreamTrack, streams: MediaStream[]) => Promise<void>;
2
2
  export type TContentHint = 'motion' | 'detail' | 'text' | 'none';
@@ -6,6 +6,7 @@ import { ConnectionQueueManager } from '../ConnectionQueueManager';
6
6
  import { IncomingCallManager } from '../IncomingCallManager';
7
7
  import { PresentationManager, TContentHint, TOnAddedTransceiver } from '../PresentationManager';
8
8
  import { StatsManager } from '../StatsManager';
9
+ import { TransceiverManager } from '../TransceiverManager';
9
10
  import { VideoSendingBalancerManager } from '../VideoSendingBalancerManager';
10
11
  import { EVENT_NAMES, TEvent } from './eventNames';
11
12
  import { TGetServerUrl } from '../CallManager';
@@ -21,6 +22,7 @@ declare class SipConnector {
21
22
  readonly presentationManager: PresentationManager;
22
23
  readonly statsManager: StatsManager;
23
24
  readonly videoSendingBalancerManager: VideoSendingBalancerManager;
25
+ readonly transceiverManager: TransceiverManager;
24
26
  private readonly preferredMimeTypesVideoCodecs?;
25
27
  private readonly excludeMimeTypesVideoCodecs?;
26
28
  constructor({ JsSIP }: {
@@ -106,6 +108,7 @@ declare class SipConnector {
106
108
  askPermissionToEnableCam(...args: Parameters<ApiManager['askPermissionToEnableCam']>): Promise<void>;
107
109
  private setCodecPreferences;
108
110
  private subscribe;
109
- private readonly handleRestart;
111
+ private readonly bridgeEvents;
112
+ private readonly resolveHandleAddTransceiver;
110
113
  }
111
114
  export default SipConnector;
@@ -1,4 +1,4 @@
1
1
  import { Events } from 'events-constructor';
2
- export declare const EVENT_NAMES: readonly ("connection:connecting" | "connection:connected" | "connection:disconnected" | "connection:newRTCSession" | "connection:registered" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "call:peerconnection" | "call:connecting" | "call:sending" | "call:progress" | "call:accepted" | "call:confirmed" | "call:ended" | "call:failed" | "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" | "api:newDTMF" | "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-spectators" | "api:participant:move-request-to-participants" | "api:participant:move-request-to-spectators-over-sfu" | "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:restart" | "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")[];
2
+ export declare const EVENT_NAMES: readonly ("connection:connecting" | "connection:connected" | "connection:disconnected" | "connection:newRTCSession" | "connection:registered" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "call:newDTMF" | "call:peerconnection" | "call:connecting" | "call:sending" | "call:progress" | "call:accepted" | "call:confirmed" | "call:ended" | "call:failed" | "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" | "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-spectators" | "api:participant:move-request-to-participants" | "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" | "api:restart" | "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")[];
3
3
  export type TEvent = (typeof EVENT_NAMES)[number];
4
4
  export type TEvents = Events<typeof EVENT_NAMES>;
@@ -1 +1 @@
1
- export { default as SipConnectorFacade } from './SipConnectorFacade';
1
+ export { default as SipConnectorFacade } from './@SipConnectorFacade';
@@ -1,5 +1,5 @@
1
1
  export { EStatsTypes } from './constants';
2
2
  export type { TEventMap } from './eventNames';
3
- export { default as StatsPeerConnection } from './StatsPeerConnection';
3
+ export { default as StatsPeerConnection } from './@StatsPeerConnection';
4
4
  export type { TInboundStats, TOutboundStats } from './types';
5
5
  export { default as hasAvailableStats } from './utils/hasAvailableStats';
@@ -0,0 +1,70 @@
1
+ import { ApiManager, TRestartData } from '../ApiManager';
2
+ import { CallManager } from '../CallManager';
3
+ import { ITransceiverStorage } from './types';
4
+ /**
5
+ * Менеджер для управления RTCRtpTransceiver'ами
6
+ * Отвечает за хранение и классификацию transceiver'ов по типам:
7
+ * - mainAudio: основной transceiver для аудио (mid='0')
8
+ * - mainVideo: основной transceiver для видео (mid='1')
9
+ * - presentationVideo: transceiver для презентации видео (mid='2')
10
+ */
11
+ export declare class TransceiverManager {
12
+ /**
13
+ * Хранилище основных transceiver'ов
14
+ */
15
+ private readonly transceivers;
16
+ private readonly callManager;
17
+ private readonly apiManager;
18
+ constructor({ callManager, apiManager, }: {
19
+ callManager: CallManager;
20
+ apiManager: ApiManager;
21
+ });
22
+ /**
23
+ * Сохраняет transceiver в соответствующем хранилище в зависимости от типа трека и mid
24
+ */
25
+ storeTransceiver(transceiver: RTCRtpTransceiver, track: MediaStreamTrack): void;
26
+ /**
27
+ * Возвращает все сохраненные transceiver'ы
28
+ */
29
+ getTransceivers(): Readonly<ITransceiverStorage>;
30
+ /**
31
+ * Возвращает основной аудио transceiver
32
+ */
33
+ getMainAudioTransceiver(): RTCRtpTransceiver | undefined;
34
+ /**
35
+ * Возвращает основной видео transceiver
36
+ */
37
+ getMainVideoTransceiver(): RTCRtpTransceiver | undefined;
38
+ /**
39
+ * Возвращает презентационный видео transceiver
40
+ */
41
+ getPresentationVideoTransceiver(): RTCRtpTransceiver | undefined;
42
+ /**
43
+ * Проверяет, есть ли сохраненный transceiver для указанного типа
44
+ */
45
+ hasTransceiver(type: keyof ITransceiverStorage): boolean;
46
+ /**
47
+ * Очищает все сохраненные transceiver'ы
48
+ */
49
+ clear(): void;
50
+ /**
51
+ * Возвращает количество сохраненных transceiver'ов
52
+ */
53
+ getCount(): number;
54
+ /**
55
+ * Проверяет, пустое ли хранилище
56
+ */
57
+ isEmpty(): boolean;
58
+ /**
59
+ * Обрабатывает событие restart от ApiManager
60
+ */
61
+ readonly handleRestart: (restartData: TRestartData) => void;
62
+ /**
63
+ * Обновляет transceiver'ы в соответствии с данными restart
64
+ */
65
+ private readonly updateTransceivers;
66
+ private subscribe;
67
+ private readonly handleTrack;
68
+ private readonly handleEnded;
69
+ }
70
+ export default TransceiverManager;
@@ -0,0 +1 @@
1
+ export { default as TransceiverManager } from './@TransceiverManager';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Интерфейс для хранения основных transceiver'ов
3
+ */
4
+ export interface ITransceiverStorage {
5
+ /** Основной transceiver для видео */
6
+ mainVideo?: RTCRtpTransceiver;
7
+ /** Основной transceiver для аудио */
8
+ mainAudio?: RTCRtpTransceiver;
9
+ /** Transceiver для презентации видео */
10
+ presentationVideo?: RTCRtpTransceiver;
11
+ }
@@ -1,2 +1,2 @@
1
1
  export type { IBalancerOptions } from './types';
2
- export { resolveVideoSendingBalancer, default as VideoSendingBalancer, } from './VideoSendingBalancer';
2
+ export { resolveVideoSendingBalancer, default as VideoSendingBalancer, } from './@VideoSendingBalancer';
@@ -60,6 +60,7 @@ declare class RTCPeerConnectionMock implements RTCPeerConnectionDeprecated {
60
60
  dispatchEvent(_event: Event): boolean;
61
61
  getReceivers: () => RTCRtpReceiver[];
62
62
  getSenders: () => RTCRtpSender[];
63
- addTrack: (track: MediaStreamTrack) => RTCRtpSenderMock;
63
+ addTrack: (track: MediaStreamTrack, ..._streams: MediaStream[]) => RTCRtpSenderMock;
64
+ addTrackWithMid: (track: MediaStreamTrack, mid?: string) => RTCRtpSenderMock;
64
65
  }
65
66
  export default RTCPeerConnectionMock;
@@ -0,0 +1,16 @@
1
+ import { default as RTCRtpSenderMock } from './RTCRtpSenderMock';
2
+ /**
3
+ * Мок для RTCRtpTransceiver
4
+ */
5
+ export declare class RTCRtpTransceiverMock implements RTCRtpTransceiver {
6
+ readonly currentDirection: RTCRtpTransceiverDirection | null;
7
+ readonly direction: RTCRtpTransceiverDirection;
8
+ mid: string | null;
9
+ readonly receiver: RTCRtpReceiver;
10
+ readonly sender: RTCRtpSenderMock;
11
+ readonly stopped = false;
12
+ constructor(sender: RTCRtpSenderMock);
13
+ setCodecPreferences(_codecs: RTCRtpCodec[]): void;
14
+ stop(): void;
15
+ }
16
+ export default RTCRtpTransceiverMock;
@@ -2,7 +2,7 @@ export declare const UA_SYNTHETICS_EVENT_NAMES: readonly ["incomingCall", "decli
2
2
  export declare const UA_JSSIP_EVENT_NAMES: readonly ["connecting", "connected", "disconnected", "newRTCSession", "registered", "unregistered", "registrationFailed", "newMessage", "sipEvent"];
3
3
  export declare const SESSION_SYNTHETICS_EVENT_NAMES: readonly ["availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "shareState", "enterRoom", "useLicense", "peerconnection:confirmed", "peerconnection:ontrack", "channels", "ended:fromserver", "main-cam-control", "admin-start-main-cam", "admin-stop-main-cam", "admin-stop-mic", "admin-start-mic", "admin-force-sync-media-state", "participant:move-request-to-spectators", "participant:move-request-to-participants"];
4
4
  export declare const SESSION_JSSIP_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed"];
5
- export declare const UA_EVENT_NAMES: ("connecting" | "channels:notify" | "participant:added-to-list-moderators" | "participant:removed-from-list-moderators" | "participant:move-request-to-stream" | "participation:accepting-word-request" | "participation:cancelling-word-request" | "webcast:started" | "webcast:stopped" | "account:changed" | "account:deleted" | "conference:participant-token-issued" | "connected" | "disconnected" | "newRTCSession" | "registered" | "unregistered" | "registrationFailed" | "newMessage" | "sipEvent" | "incomingCall" | "declinedIncomingCall" | "terminatedIncomingCall" | "failedIncomingCall")[];
5
+ export declare const UA_EVENT_NAMES: ("channels:notify" | "participant:added-to-list-moderators" | "participant:removed-from-list-moderators" | "participant:move-request-to-stream" | "participation:accepting-word-request" | "participation:cancelling-word-request" | "webcast:started" | "webcast:stopped" | "account:changed" | "account:deleted" | "conference:participant-token-issued" | "connecting" | "connected" | "disconnected" | "newRTCSession" | "registered" | "unregistered" | "registrationFailed" | "newMessage" | "sipEvent" | "incomingCall" | "declinedIncomingCall" | "terminatedIncomingCall" | "failedIncomingCall")[];
6
6
  export declare const SESSION_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "shareState", "enterRoom", "useLicense", "peerconnection:confirmed", "peerconnection:ontrack", "channels", "ended:fromserver", "main-cam-control", "admin-start-main-cam", "admin-stop-main-cam", "admin-stop-mic", "admin-start-mic", "admin-force-sync-media-state", "participant:move-request-to-spectators", "participant:move-request-to-participants"];
7
7
  export type TEventUA = (typeof UA_EVENT_NAMES)[number];
8
8
  export type TEventSession = (typeof SESSION_EVENT_NAMES)[number];
package/dist/doMock.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("node:events"),V=require("@krivega/jssip/lib/NameAddrHeader"),k=require("@krivega/jssip/lib/URI"),U=require("@krivega/jssip/lib/SIPMessage"),a=require("@krivega/jssip"),f=require("webrtc-mock"),S=require("events-constructor"),P=require("./@SipConnector-B5FFHZzJ.cjs");class N extends U.IncomingRequest{headers;constructor(e){super(),this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)??""}}const H="incomingCall",q="declinedIncomingCall",G="failedIncomingCall",x="terminatedIncomingCall",v="connecting",z="connected",j="disconnected",Y="newRTCSession",B="registered",K="unregistered",J="registrationFailed",$="newMessage",Q="sipEvent",X="availableSecondRemoteStream",Z="notAvailableSecondRemoteStream",ee="mustStopPresentation",te="shareState",re="enterRoom",ne="useLicense",oe="peerconnection:confirmed",ie="peerconnection:ontrack",se="channels",ae="channels:notify",ce="ended:fromserver",de="main-cam-control",Ee="admin-stop-main-cam",he="admin-start-main-cam",ue="admin-stop-mic",me="admin-start-mic",le="admin-force-sync-media-state",pe="participant:added-to-list-moderators",ge="participant:removed-from-list-moderators",_e="participant:move-request-to-stream",Te="participant:move-request-to-spectators",Ie="participant:move-request-to-participants",Se="participation:accepting-word-request",Ne="participation:cancelling-word-request",we="webcast:started",Ce="webcast:stopped",Re="account:changed",fe="account:deleted",Ae="conference:participant-token-issued",Me="ended",Oe="sending",Pe="reinvite",ve="replaces",De="refer",ye="progress",Le="accepted",Fe="confirmed",We="peerconnection",be="failed",Ve="muted",ke="unmuted",Ue="newDTMF",He="newInfo",qe="hold",Ge="unhold",xe="update",ze="sdp",je="icecandidate",Ye="getusermediafailed",Be="peerconnection:createofferfailed",Ke="peerconnection:createanswerfailed",Je="peerconnection:setlocaldescriptionfailed",$e="peerconnection:setremotedescriptionfailed",Qe="presentation:start",Xe="presentation:started",Ze="presentation:end",et="presentation:ended",tt="presentation:failed",rt=[H,q,x,G,Se,Ne,_e,ae,Ae,Re,fe,we,Ce,pe,ge],D=[v,z,j,Y,B,K,J,$,Q],nt=[X,Z,ee,te,re,ne,oe,ie,se,ce,de,he,Ee,ue,me,le,Te,Ie],_=[Me,v,Oe,Pe,ve,De,ye,Le,Fe,We,be,Ve,ke,Ue,He,qe,Ge,xe,ze,je,Ye,Be,Ke,Je,$e,Qe,Xe,Ze,et,tt];[...D,...rt];[..._,...nt];class ot{originator;connection;events;remote_identity;mutedOptions={audio:!1,video:!1};constructor({originator:e="local",eventHandlers:t,remoteIdentity:r}){this.originator=e,this.events=new S.Events(_),this.initEvents(t),this.remote_identity=r}get contact(){throw new Error("Method not implemented.")}get direction(){throw new Error("Method not implemented.")}get local_identity(){throw new Error("Method not implemented.")}get start_time(){throw new Error("Method not implemented.")}get end_time(){throw new Error("Method not implemented.")}get status(){throw new Error("Method not implemented.")}get C(){throw new Error("Method not implemented.")}get causes(){throw new Error("Method not implemented.")}get id(){throw new Error("Method not implemented.")}get data(){throw new Error("Method not implemented.")}set data(e){throw new Error("Method not implemented.")}isInProgress(){throw new Error("Method not implemented.")}isEnded(){throw new Error("Method not implemented.")}isReadyToReOffer(){throw new Error("Method not implemented.")}answer(e){throw new Error("Method not implemented.")}terminate(e){throw new Error("Method not implemented.")}async sendInfo(e,t,r){throw new Error("Method not implemented.")}hold(e,t){throw new Error("Method not implemented.")}unhold(e,t){throw new Error("Method not implemented.")}async renegotiate(e,t){throw new Error("Method not implemented.")}isOnHold(){throw new Error("Method not implemented.")}mute(e){throw new Error("Method not implemented.")}unmute(e){throw new Error("Method not implemented.")}isMuted(){throw new Error("Method not implemented.")}refer(e,t){throw new Error("Method not implemented.")}resetLocalMedia(){throw new Error("Method not implemented.")}async replaceMediaStream(e,t){throw new Error("Method not implemented.")}addListener(e,t){throw new Error("Method not implemented.")}once(e,t){throw new Error("Method not implemented.")}removeListener(e,t){throw new Error("Method not implemented.")}off(e,t){return this.events.off(e,t),this}removeAllListeners(e){return console.warn("Method not implemented. Event:",e),this}setMaxListeners(e){throw new Error("Method not implemented.")}getMaxListeners(){throw new Error("Method not implemented.")}listeners(e){throw new Error("Method not implemented.")}rawListeners(e){throw new Error("Method not implemented.")}emit(e,...t){throw new Error("Method not implemented.")}listenerCount(e){throw new Error("Method not implemented.")}prependListener(e,t){throw new Error("Method not implemented.")}prependOnceListener(e,t){throw new Error("Method not implemented.")}eventNames(){throw new Error("Method not implemented.")}initEvents(e){e&&Object.entries(e).forEach(([t,r])=>{this.on(t,r)})}on(e,t){return _.includes(e)&&this.events.on(e,t),this}trigger(e,t){this.events.trigger(e,t)}sendDTMF(){this.trigger("newDTMF",{originator:this.originator})}async startPresentation(e){return this.trigger("presentation:start",e),this.trigger("presentation:started",e),e}async stopPresentation(e){return this.trigger("presentation:end",e),this.trigger("presentation:ended",e),e}isEstablished(){return!0}}class it{stats=new Map().set("codec",{mimeType:"video/h264"});dtmf=null;track=null;transport=null;transform=null;parameters={encodings:[{}],transactionId:"0",codecs:[],headerExtensions:[],rtcp:{}};parametersGets;constructor({track:e}={}){this.track=e??null}async getStats(){return this.stats}async replaceTrack(e){this.track=e??null}async setParameters(e){if(e!==this.parametersGets)throw new Error("Failed to execute 'setParameters' on 'RTCRtpSender': Read-only field modified in setParameters().");const{transactionId:t}=this.parameters;this.parameters={...this.parameters,...e,transactionId:`${Number(t)+1}`}}getParameters(){return this.parametersGets={...this.parameters},this.parametersGets}setStreams(){throw new Error("Method not implemented.")}}const st=["track"];class at{senders=[];receivers=[];canTrickleIceCandidates;connectionState;currentLocalDescription;currentRemoteDescription;iceConnectionState;iceGatheringState;idpErrorInfo;idpLoginUrl;localDescription;onconnectionstatechange;ondatachannel;onicecandidate;onicecandidateerror=null;oniceconnectionstatechange;onicegatheringstatechange;onnegotiationneeded;onsignalingstatechange;ontrack;peerIdentity=void 0;pendingLocalDescription;pendingRemoteDescription;remoteDescription;sctp=null;signalingState;events;constructor(e,t){this.events=new S.Events(st),this.receivers=t.map(r=>({track:r}))}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(e){throw new Error("Method not implemented.")}addTransceiver(e,t){throw new Error("Method not implemented.")}close(){throw new Error("Method not implemented.")}restartIce(){throw new Error("Method not implemented.")}async createAnswer(e,t){throw new Error("Method not implemented.")}createDataChannel(e,t){throw new Error("Method not implemented.")}async createOffer(e,t,r){throw new Error("Method not implemented.")}getConfiguration(){throw new Error("Method not implemented.")}async getIdentityAssertion(){throw new Error("Method not implemented.")}async getStats(e){throw new Error("Method not implemented.")}getTransceivers(){throw new Error("Method not implemented.")}removeTrack(e){throw new Error("Method not implemented.")}setConfiguration(e){throw new Error("Method not implemented.")}async setLocalDescription(e){throw new Error("Method not implemented.")}async setRemoteDescription(e){throw new Error("Method not implemented.")}addEventListener(e,t,r){this.events.on(e,t)}removeEventListener(e,t,r){this.events.off(e,t)}dispatchEvent(e){throw new Error("Method not implemented.")}getReceivers=()=>this.receivers;getSenders=()=>this.senders;addTrack=e=>{const t=new it({track:e});return this.senders.push(t),this.events.trigger("track",{track:e}),t}}function ct(n){const e=n.match(/(purgatory)|[\d.]+/g);if(!e)throw new Error("wrong sip url");return e[0]}const A=400,y="777",dt=n=>n.getVideoTracks().length>0;class s extends ot{static presentationError;static startPresentationError;static countStartPresentationError=Number.POSITIVE_INFINITY;static countStartsPresentation=0;url;status_code;answer=jest.fn(({mediaStream:e})=>{if(this.originator!=="remote")throw new Error("answer available only for remote sessions");this.initPeerconnection(e),setTimeout(()=>{this.trigger("connecting"),setTimeout(()=>{this.trigger("accepted")},100),setTimeout(()=>{this.trigger("confirmed")},200)},A)});replaceMediaStream=jest.fn(async e=>{});restartIce=jest.fn(async e=>!0);isEndedInner=!1;delayStartPresentation=0;timeoutStartPresentation;timeoutConnect;timeoutNewInfo;timeoutAccepted;timeoutConfirmed;constructor({eventHandlers:e,originator:t,remoteIdentity:r=new a.NameAddrHeader(new a.URI("sip","caller1","test1.com",5060),"Test Caller 1"),delayStartPresentation:i=0}){super({originator:t,eventHandlers:e,remoteIdentity:r}),this.delayStartPresentation=i}static setPresentationError(e){this.presentationError=e}static resetPresentationError(){this.presentationError=void 0}static setStartPresentationError(e,{count:t=Number.POSITIVE_INFINITY}={}){this.startPresentationError=e,this.countStartPresentationError=t}static resetStartPresentationError(){this.startPresentationError=void 0,this.countStartPresentationError=Number.POSITIVE_INFINITY,this.countStartsPresentation=0}startPresentation=async e=>(s.countStartsPresentation+=1,new Promise((t,r)=>{this.timeoutStartPresentation=setTimeout(()=>{if(s.presentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.presentationError);return}if(s.startPresentationError&&s.countStartsPresentation<s.countStartPresentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.startPresentationError);return}t(super.startPresentation(e))},this.delayStartPresentation)}));stopPresentation=async e=>{if(s.presentationError)throw this.trigger("presentation:end",e),this.trigger("presentation:failed",e),s.presentationError;return super.stopPresentation(e)};initPeerconnection(e){return e?(this.createPeerconnection(e),!0):!1}createPeerconnection(e){const t=f.createAudioMediaStreamTrackMock();t.id="mainaudio1";const r=[t];if(dt(e)){const c=f.createVideoMediaStreamTrackMock();c.id="mainvideo1",r.push(c)}this.connection=new at(void 0,r),this.addStream(e),this.trigger("peerconnection",{peerconnection:this.connection})}connect(e,{mediaStream:t}={}){const r=ct(e);return this.initPeerconnection(t),this.timeoutConnect=setTimeout(()=>{e.includes(y)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:"Rejected"}):(this.trigger("connecting"),this.timeoutNewInfo=setTimeout(()=>{this.newInfo({originator:P.Originator.REMOTE,request:{getHeader:i=>i==="content-type"?"application/vinteo.webrtc.roomname":i==="x-webrtc-enter-room"?r:i==="x-webrtc-participant-name"?"Test Caller 1":""}})},100),this.timeoutAccepted=setTimeout(()=>{this.trigger("accepted")},200),this.timeoutConfirmed=setTimeout(()=>{this.trigger("confirmed")},300))},A),this.connection}terminate({status_code:e,cause:t}={}){return this.status_code=e,this.trigger("ended",{status_code:e,cause:t,originator:"local"}),this.isEndedInner=!1,this}async terminateAsync({status_code:e,cause:t}={}){this.terminate({status_code:e,cause:t})}terminateRemote({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e,originator:"remote"}),this}addStream(e,t="getTracks"){e[t]().forEach(r=>this.connection.addTrack(r))}forEachSenders(e){const t=this.connection.getSenders();for(const r of t)e(r);return t}toggleMuteAudio(e){this.forEachSenders(({track:t})=>{t&&t.kind==="audio"&&(t.enabled=!e)})}toggleMuteVideo(e){this.forEachSenders(({track:t})=>{t&&t.kind==="video"&&(t.enabled=!e)})}mute(e){e.audio&&(this.mutedOptions.audio=!0,this.toggleMuteAudio(this.mutedOptions.audio)),e.video&&(this.mutedOptions.video=!0,this.toggleMuteVideo(this.mutedOptions.video)),this.onmute(e)}unmute(e){e.audio&&(this.mutedOptions.audio=!1),e.video&&(this.mutedOptions.video=!1),this.trigger("unmuted",e)}isMuted(){return this.mutedOptions}onmute({audio:e,video:t}){this.trigger("muted",{audio:e,video:t})}async sendInfo(){}isEnded(){return this.isEndedInner}newInfo(e){this.trigger("newInfo",e)}clear(){clearTimeout(this.timeoutStartPresentation),clearTimeout(this.timeoutConnect),clearTimeout(this.timeoutNewInfo),clearTimeout(this.timeoutAccepted),clearTimeout(this.timeoutConfirmed)}}class Et{extraHeaders=[];setExtraHeaders(e){this.extraHeaders=e}setExtraContactParams(){}}const d="PASSWORD_CORRECT",T="PASSWORD_CORRECT_2",L="NAME_INCORRECT",h=400,g={url:"wss://sipServerUrl/webrtc/wss/",sip_uri:"sip:sipServerUrl;transport=ws",via_transport:"WSS"},M={status_code:200,reason_phrase:"OK"},O={status_code:401,reason_phrase:"Unauthorized"};class o{static isAvailableTelephony=!0;static startError;static countStartError=Number.POSITIVE_INFINITY;static countStarts=0;events;registratorInner;call=jest.fn((e,t)=>{const{mediaStream:r,eventHandlers:i}=t;return this.session=new s({eventHandlers:i,originator:"local"}),this.session.connect(e,{mediaStream:r}),this.session});sendOptions=jest.fn((e,t,r)=>{console.log("sendOptions",e,t,r)});start=jest.fn(()=>{if(o.countStarts+=1,o.startError&&o.countStarts<o.countStartError){this.trigger("disconnected",o.startError);return}this.register()});stop=jest.fn(()=>{this.startedTimeout&&clearTimeout(this.startedTimeout),this.stopedTimeout&&clearTimeout(this.stopedTimeout),this.unregister(),this.isStarted()?this.stopedTimeout=setTimeout(()=>{this.trigger("disconnected",{error:!0,socket:g})},h):this.trigger("disconnected",{error:!0,socket:g})});removeAllListeners=jest.fn(()=>(this.events.removeEventHandlers(),this));once=jest.fn((e,t)=>(this.events.once(e,t),this));startedTimeout;stopedTimeout;session;isRegisteredInner;isConnectedInner;configuration;constructor(e){this.events=new S.Events(D);const[t,r]=e.uri.split(":"),[i,c]=r.split("@"),p={...e,uri:new a.URI(t,i,c)};this.configuration=p,this.registratorInner=new Et}static setStartError(e,{count:t=Number.POSITIVE_INFINITY}={}){o.startError=e,o.countStartError=t}static resetStartError(){o.startError=void 0,o.countStartError=Number.POSITIVE_INFINITY,o.countStarts=0}static setAvailableTelephony(){o.isAvailableTelephony=!0}static setNotAvailableTelephony(){o.isAvailableTelephony=!1}static reset(){o.resetStartError(),o.setAvailableTelephony()}on(e,t){return this.events.on(e,t),this}off(e,t){return this.events.off(e,t),this}trigger(e,t){this.events.trigger(e,t)}terminateSessions(){this.session?.terminate()}set(e,t){return this.configuration[e]=t,!0}register(){this.startedTimeout&&clearTimeout(this.startedTimeout);const{password:e,register:t,uri:r}=this.configuration;t===!0&&r.user.includes(L)?(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:O,cause:a.C.causes.REJECTED})},h)):!this.isRegistered()&&t===!0&&(e===d||e===T)?(this.isRegisteredInner=!0,this.startedTimeout=setTimeout(()=>{this.trigger("registered",{response:M})},h)):t===!0&&e!==d&&e!==T&&(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:O,cause:a.C.causes.REJECTED})},h)),o.isAvailableTelephony?(this.trigger("connected",{socket:g}),this.isConnectedInner=!0):this.stop()}unregister(){this.isRegisteredInner=!1,this.isConnectedInner=!1,this.trigger("unregistered",{response:M})}isRegistered(){return this.isRegisteredInner===!0}isConnected(){return this.isConnectedInner===!0}isStarted(){return this.configuration.register===!0&&this.isRegisteredInner===!0||this.configuration.register!==!0&&this.isConnectedInner===!0}newSipEvent(e){this.trigger("sipEvent",e)}registrator(){return this.registratorInner}}class ht{url;constructor(e){this.url=e}}class ut extends b.EventEmitter{contentType;body;constructor(e,t){super(),this.contentType=e,this.body=t}}const I="remote",mt=(n,e)=>{const t=new N(e),r={originator:I,request:t,info:new ut("","")};n.newInfo(r)},lt=(n,e)=>{const r={event:"sipEvent",request:new N(e)};n.newSipEvent(r)},pt=(n,{incomingNumber:e="1234",displayName:t,host:r})=>{const i=new s({originator:I,eventHandlers:{}}),c=new k("sip",e,r);i.remote_identity=new V(c,t);const p=new N([]);n.trigger("newRTCSession",{originator:I,session:i,request:p})},gt=(n,e)=>{e?n.trigger("failed",e):n.trigger("failed",n)},w={triggerNewInfo:mt,triggerNewSipEvent:lt,triggerIncomingSession:pt,triggerFailIncomingSession:gt,WebSocketInterface:ht,UA:o,C:{INVITE:"INVITE"}},u="user",E="displayName",m="SIP_SERVER_URL",C="SIP_WEB_SOCKET_SERVER_URL",_t=new w.WebSocketInterface(C),R={userAgent:"Chrome",sipServerUrl:m,sipWebSocketServerURL:C},Tt={...R},F={...R,user:u,password:d,register:!0},It={...F,displayName:E},St={...R,displayName:E,register:!1},l={session_timers:!1,sockets:[_t],user_agent:"Chrome",sdpSemantics:"unified-plan",register_expires:300,connection_recovery_max_interval:6,connection_recovery_min_interval:2},Nt={...l,password:d,uri:new a.URI("sip",u,m),display_name:"",register:!0},wt={...l,password:d,uri:new a.URI("sip",u,m),display_name:E,register:!0},Ct={...l,display_name:E,register:!1},Rt={...l,display_name:"",register:!1},W="10.10.10.10",ft=[`X-Vinteo-Remote: ${W}`],At=()=>new P.SipConnector({JsSIP:w});exports.FAILED_CONFERENCE_NUMBER=y;exports.JsSIP=w;exports.NAME_INCORRECT=L;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=T;exports.SIP_SERVER_URL=m;exports.SIP_WEB_SOCKET_SERVER_URL=C;exports.dataForConnectionWithAuthorization=F;exports.dataForConnectionWithAuthorizationWithDisplayName=It;exports.dataForConnectionWithoutAuthorization=St;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=Tt;exports.displayName=E;exports.doMockSipConnector=At;exports.extraHeadersRemoteAddress=ft;exports.remoteAddress=W;exports.uaConfigurationWithAuthorization=Nt;exports.uaConfigurationWithAuthorizationWithDisplayName=wt;exports.uaConfigurationWithoutAuthorization=Ct;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=Rt;exports.user=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("node:events"),U=require("@krivega/jssip/lib/NameAddrHeader"),H=require("@krivega/jssip/lib/URI"),q=require("@krivega/jssip/lib/SIPMessage"),a=require("@krivega/jssip"),f=require("webrtc-mock"),S=require("events-constructor"),D=require("./@SipConnector-CFYT0HQB.cjs");class w extends q.IncomingRequest{headers;constructor(e){super(),this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)??""}}const G="incomingCall",x="declinedIncomingCall",z="failedIncomingCall",j="terminatedIncomingCall",y="connecting",Y="connected",B="disconnected",K="newRTCSession",J="registered",$="unregistered",Q="registrationFailed",X="newMessage",Z="sipEvent",ee="availableSecondRemoteStream",te="notAvailableSecondRemoteStream",re="mustStopPresentation",ne="shareState",oe="enterRoom",ie="useLicense",se="peerconnection:confirmed",ae="peerconnection:ontrack",ce="channels",de="channels:notify",he="ended:fromserver",Ee="main-cam-control",ue="admin-stop-main-cam",me="admin-start-main-cam",le="admin-stop-mic",pe="admin-start-mic",ge="admin-force-sync-media-state",_e="participant:added-to-list-moderators",Te="participant:removed-from-list-moderators",Ie="participant:move-request-to-stream",Se="participant:move-request-to-spectators",we="participant:move-request-to-participants",Ne="participation:accepting-word-request",Ce="participation:cancelling-word-request",Re="webcast:started",fe="webcast:stopped",Ae="account:changed",Me="account:deleted",Oe="conference:participant-token-issued",Pe="ended",ve="sending",De="reinvite",ye="replaces",Le="refer",Fe="progress",We="accepted",be="confirmed",ke="peerconnection",Ve="failed",Ue="muted",He="unmuted",qe="newDTMF",Ge="newInfo",xe="hold",ze="unhold",je="update",Ye="sdp",Be="icecandidate",Ke="getusermediafailed",Je="peerconnection:createofferfailed",$e="peerconnection:createanswerfailed",Qe="peerconnection:setlocaldescriptionfailed",Xe="peerconnection:setremotedescriptionfailed",Ze="presentation:start",et="presentation:started",tt="presentation:end",rt="presentation:ended",nt="presentation:failed",ot=[G,x,j,z,Ne,Ce,Ie,de,Oe,Ae,Me,Re,fe,_e,Te],L=[y,Y,B,K,J,$,Q,X,Z],it=[ee,te,re,ne,oe,ie,se,ae,ce,he,Ee,me,ue,le,pe,ge,Se,we],_=[Pe,y,ve,De,ye,Le,Fe,We,be,ke,Ve,Ue,He,qe,Ge,xe,ze,je,Ye,Be,Ke,Je,$e,Qe,Xe,Ze,et,tt,rt,nt];[...L,...ot];[..._,...it];class st{originator;connection;events;remote_identity;mutedOptions={audio:!1,video:!1};constructor({originator:e="local",eventHandlers:t,remoteIdentity:r}){this.originator=e,this.events=new S.Events(_),this.initEvents(t),this.remote_identity=r}get contact(){throw new Error("Method not implemented.")}get direction(){throw new Error("Method not implemented.")}get local_identity(){throw new Error("Method not implemented.")}get start_time(){throw new Error("Method not implemented.")}get end_time(){throw new Error("Method not implemented.")}get status(){throw new Error("Method not implemented.")}get C(){throw new Error("Method not implemented.")}get causes(){throw new Error("Method not implemented.")}get id(){throw new Error("Method not implemented.")}get data(){throw new Error("Method not implemented.")}set data(e){throw new Error("Method not implemented.")}isInProgress(){throw new Error("Method not implemented.")}isEnded(){throw new Error("Method not implemented.")}isReadyToReOffer(){throw new Error("Method not implemented.")}answer(e){throw new Error("Method not implemented.")}terminate(e){throw new Error("Method not implemented.")}async sendInfo(e,t,r){throw new Error("Method not implemented.")}hold(e,t){throw new Error("Method not implemented.")}unhold(e,t){throw new Error("Method not implemented.")}async renegotiate(e,t){throw new Error("Method not implemented.")}isOnHold(){throw new Error("Method not implemented.")}mute(e){throw new Error("Method not implemented.")}unmute(e){throw new Error("Method not implemented.")}isMuted(){throw new Error("Method not implemented.")}refer(e,t){throw new Error("Method not implemented.")}resetLocalMedia(){throw new Error("Method not implemented.")}async replaceMediaStream(e,t){throw new Error("Method not implemented.")}addListener(e,t){throw new Error("Method not implemented.")}once(e,t){throw new Error("Method not implemented.")}removeListener(e,t){throw new Error("Method not implemented.")}off(e,t){return this.events.off(e,t),this}removeAllListeners(e){return console.warn("Method not implemented. Event:",e),this}setMaxListeners(e){throw new Error("Method not implemented.")}getMaxListeners(){throw new Error("Method not implemented.")}listeners(e){throw new Error("Method not implemented.")}rawListeners(e){throw new Error("Method not implemented.")}emit(e,...t){throw new Error("Method not implemented.")}listenerCount(e){throw new Error("Method not implemented.")}prependListener(e,t){throw new Error("Method not implemented.")}prependOnceListener(e,t){throw new Error("Method not implemented.")}eventNames(){throw new Error("Method not implemented.")}initEvents(e){e&&Object.entries(e).forEach(([t,r])=>{this.on(t,r)})}on(e,t){return _.includes(e)&&this.events.on(e,t),this}trigger(e,t){this.events.trigger(e,t)}sendDTMF(){this.trigger("newDTMF",{originator:this.originator})}async startPresentation(e){return this.trigger("presentation:start",e),this.trigger("presentation:started",e),e}async stopPresentation(e){return this.trigger("presentation:end",e),this.trigger("presentation:ended",e),e}isEstablished(){return!0}}class A{stats=new Map().set("codec",{mimeType:"video/h264"});dtmf=null;track=null;transport=null;transform=null;parameters={encodings:[{}],transactionId:"0",codecs:[],headerExtensions:[],rtcp:{}};parametersGets;constructor({track:e}={}){this.track=e??null}async getStats(){return this.stats}async replaceTrack(e){this.track=e??null}async setParameters(e){if(e!==this.parametersGets)throw new Error("Failed to execute 'setParameters' on 'RTCRtpSender': Read-only field modified in setParameters().");const{transactionId:t}=this.parameters;this.parameters={...this.parameters,...e,transactionId:`${Number(t)+1}`}}getParameters(){return this.parametersGets={...this.parameters},this.parametersGets}setStreams(){throw new Error("Method not implemented.")}}class M{currentDirection="sendrecv";direction="sendrecv";mid=null;receiver;sender;stopped=!1;constructor(e){this.sender=e}setCodecPreferences(e){}stop(){}}const at=["track"];class ct{senders=[];receivers=[];canTrickleIceCandidates;connectionState;currentLocalDescription;currentRemoteDescription;iceConnectionState;iceGatheringState;idpErrorInfo;idpLoginUrl;localDescription;onconnectionstatechange;ondatachannel;onicecandidate;onicecandidateerror=null;oniceconnectionstatechange;onicegatheringstatechange;onnegotiationneeded;onsignalingstatechange;ontrack;peerIdentity=void 0;pendingLocalDescription;pendingRemoteDescription;remoteDescription;sctp=null;signalingState;events;constructor(e,t){this.events=new S.Events(at),this.receivers=t.map(r=>({track:r}))}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(e){throw new Error("Method not implemented.")}addTransceiver(e,t){throw new Error("Method not implemented.")}close(){throw new Error("Method not implemented.")}restartIce(){throw new Error("Method not implemented.")}async createAnswer(e,t){throw new Error("Method not implemented.")}createDataChannel(e,t){throw new Error("Method not implemented.")}async createOffer(e,t,r){throw new Error("Method not implemented.")}getConfiguration(){throw new Error("Method not implemented.")}async getIdentityAssertion(){throw new Error("Method not implemented.")}async getStats(e){throw new Error("Method not implemented.")}getTransceivers(){throw new Error("Method not implemented.")}removeTrack(e){throw new Error("Method not implemented.")}setConfiguration(e){throw new Error("Method not implemented.")}async setLocalDescription(e){throw new Error("Method not implemented.")}async setRemoteDescription(e){throw new Error("Method not implemented.")}addEventListener(e,t,r){this.events.on(e,t)}removeEventListener(e,t,r){this.events.off(e,t)}dispatchEvent(e){throw new Error("Method not implemented.")}getReceivers=()=>this.receivers;getSenders=()=>this.senders;addTrack=(e,...t)=>{const r=new A({track:e}),n=new M(r);return n.mid=e.kind==="audio"?"0":"1",this.senders.push(r),this.events.trigger("track",{track:e,transceiver:n}),r};addTrackWithMid=(e,t)=>{const r=new A({track:e}),n=new M(r);return t===void 0?n.mid=e.kind==="audio"?"0":"1":n.mid=t,this.senders.push(r),this.events.trigger("track",{track:e,transceiver:n}),r}}function dt(o){const e=o.match(/(purgatory)|[\d.]+/g);if(!e)throw new Error("wrong sip url");return e[0]}const O=400,F="777",ht=o=>o.getVideoTracks().length>0;class s extends st{static presentationError;static startPresentationError;static countStartPresentationError=Number.POSITIVE_INFINITY;static countStartsPresentation=0;url;status_code;answer=jest.fn(({mediaStream:e})=>{if(this.originator!=="remote")throw new Error("answer available only for remote sessions");this.initPeerconnection(e),setTimeout(()=>{this.trigger("connecting"),setTimeout(()=>{this.trigger("accepted")},100),setTimeout(()=>{this.trigger("confirmed")},200)},O)});replaceMediaStream=jest.fn(async e=>{});restartIce=jest.fn(async e=>!0);isEndedInner=!1;delayStartPresentation=0;timeoutStartPresentation;timeoutConnect;timeoutNewInfo;timeoutAccepted;timeoutConfirmed;constructor({eventHandlers:e,originator:t,remoteIdentity:r=new a.NameAddrHeader(new a.URI("sip","caller1","test1.com",5060),"Test Caller 1"),delayStartPresentation:n=0}){super({originator:t,eventHandlers:e,remoteIdentity:r}),this.delayStartPresentation=n}static setPresentationError(e){this.presentationError=e}static resetPresentationError(){this.presentationError=void 0}static setStartPresentationError(e,{count:t=Number.POSITIVE_INFINITY}={}){this.startPresentationError=e,this.countStartPresentationError=t}static resetStartPresentationError(){this.startPresentationError=void 0,this.countStartPresentationError=Number.POSITIVE_INFINITY,this.countStartsPresentation=0}startPresentation=async e=>(s.countStartsPresentation+=1,new Promise((t,r)=>{this.timeoutStartPresentation=setTimeout(()=>{if(s.presentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.presentationError);return}if(s.startPresentationError&&s.countStartsPresentation<s.countStartPresentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.startPresentationError);return}t(super.startPresentation(e))},this.delayStartPresentation)}));stopPresentation=async e=>{if(s.presentationError)throw this.trigger("presentation:end",e),this.trigger("presentation:failed",e),s.presentationError;return super.stopPresentation(e)};initPeerconnection(e){return e?(this.createPeerconnection(e),!0):!1}createPeerconnection(e){const t=f.createAudioMediaStreamTrackMock();t.id="mainaudio1";const r=[t];if(ht(e)){const c=f.createVideoMediaStreamTrackMock();c.id="mainvideo1",r.push(c)}this.connection=new ct(void 0,r),this.addStream(e),this.trigger("peerconnection",{peerconnection:this.connection})}connect(e,{mediaStream:t}={}){const r=dt(e);return this.initPeerconnection(t),this.timeoutConnect=setTimeout(()=>{e.includes(F)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:"Rejected"}):(this.trigger("connecting"),this.timeoutNewInfo=setTimeout(()=>{this.newInfo({originator:D.Originator.REMOTE,request:{getHeader:n=>n==="content-type"?"application/vinteo.webrtc.roomname":n==="x-webrtc-enter-room"?r:n==="x-webrtc-participant-name"?"Test Caller 1":""}})},100),this.timeoutAccepted=setTimeout(()=>{this.trigger("accepted")},200),this.timeoutConfirmed=setTimeout(()=>{this.trigger("confirmed")},300))},O),this.connection}terminate({status_code:e,cause:t}={}){return this.status_code=e,this.trigger("ended",{status_code:e,cause:t,originator:"local"}),this.isEndedInner=!1,this}async terminateAsync({status_code:e,cause:t}={}){this.terminate({status_code:e,cause:t})}terminateRemote({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e,originator:"remote"}),this}addStream(e,t="getTracks"){e[t]().forEach(r=>this.connection.addTrack(r))}forEachSenders(e){const t=this.connection.getSenders();for(const r of t)e(r);return t}toggleMuteAudio(e){this.forEachSenders(({track:t})=>{t&&t.kind==="audio"&&(t.enabled=!e)})}toggleMuteVideo(e){this.forEachSenders(({track:t})=>{t&&t.kind==="video"&&(t.enabled=!e)})}mute(e){e.audio&&(this.mutedOptions.audio=!0,this.toggleMuteAudio(this.mutedOptions.audio)),e.video&&(this.mutedOptions.video=!0,this.toggleMuteVideo(this.mutedOptions.video)),this.onmute(e)}unmute(e){e.audio&&(this.mutedOptions.audio=!1),e.video&&(this.mutedOptions.video=!1),this.trigger("unmuted",e)}isMuted(){return this.mutedOptions}onmute({audio:e,video:t}){this.trigger("muted",{audio:e,video:t})}async sendInfo(){}isEnded(){return this.isEndedInner}newInfo(e){this.trigger("newInfo",e)}clear(){clearTimeout(this.timeoutStartPresentation),clearTimeout(this.timeoutConnect),clearTimeout(this.timeoutNewInfo),clearTimeout(this.timeoutAccepted),clearTimeout(this.timeoutConfirmed)}}class Et{extraHeaders=[];setExtraHeaders(e){this.extraHeaders=e}setExtraContactParams(){}}const d="PASSWORD_CORRECT",T="PASSWORD_CORRECT_2",W="NAME_INCORRECT",E=400,g={url:"wss://sipServerUrl/webrtc/wss/",sip_uri:"sip:sipServerUrl;transport=ws",via_transport:"WSS"},P={status_code:200,reason_phrase:"OK"},v={status_code:401,reason_phrase:"Unauthorized"};class i{static isAvailableTelephony=!0;static startError;static countStartError=Number.POSITIVE_INFINITY;static countStarts=0;events;registratorInner;call=jest.fn((e,t)=>{const{mediaStream:r,eventHandlers:n}=t;return this.session=new s({eventHandlers:n,originator:"local"}),this.session.connect(e,{mediaStream:r}),this.session});sendOptions=jest.fn((e,t,r)=>{console.log("sendOptions",e,t,r)});start=jest.fn(()=>{if(i.countStarts+=1,i.startError&&i.countStarts<i.countStartError){this.trigger("disconnected",i.startError);return}this.register()});stop=jest.fn(()=>{this.startedTimeout&&clearTimeout(this.startedTimeout),this.stopedTimeout&&clearTimeout(this.stopedTimeout),this.unregister(),this.isStarted()?this.stopedTimeout=setTimeout(()=>{this.trigger("disconnected",{error:!0,socket:g})},E):this.trigger("disconnected",{error:!0,socket:g})});removeAllListeners=jest.fn(()=>(this.events.removeEventHandlers(),this));once=jest.fn((e,t)=>(this.events.once(e,t),this));startedTimeout;stopedTimeout;session;isRegisteredInner;isConnectedInner;configuration;constructor(e){this.events=new S.Events(L);const[t,r]=e.uri.split(":"),[n,c]=r.split("@"),p={...e,uri:new a.URI(t,n,c)};this.configuration=p,this.registratorInner=new Et}static setStartError(e,{count:t=Number.POSITIVE_INFINITY}={}){i.startError=e,i.countStartError=t}static resetStartError(){i.startError=void 0,i.countStartError=Number.POSITIVE_INFINITY,i.countStarts=0}static setAvailableTelephony(){i.isAvailableTelephony=!0}static setNotAvailableTelephony(){i.isAvailableTelephony=!1}static reset(){i.resetStartError(),i.setAvailableTelephony()}on(e,t){return this.events.on(e,t),this}off(e,t){return this.events.off(e,t),this}trigger(e,t){this.events.trigger(e,t)}terminateSessions(){this.session?.terminate()}set(e,t){return this.configuration[e]=t,!0}register(){this.startedTimeout&&clearTimeout(this.startedTimeout);const{password:e,register:t,uri:r}=this.configuration;t===!0&&r.user.includes(W)?(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:v,cause:a.C.causes.REJECTED})},E)):!this.isRegistered()&&t===!0&&(e===d||e===T)?(this.isRegisteredInner=!0,this.startedTimeout=setTimeout(()=>{this.trigger("registered",{response:P})},E)):t===!0&&e!==d&&e!==T&&(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:v,cause:a.C.causes.REJECTED})},E)),i.isAvailableTelephony?(this.trigger("connected",{socket:g}),this.isConnectedInner=!0):this.stop()}unregister(){this.isRegisteredInner=!1,this.isConnectedInner=!1,this.trigger("unregistered",{response:P})}isRegistered(){return this.isRegisteredInner===!0}isConnected(){return this.isConnectedInner===!0}isStarted(){return this.configuration.register===!0&&this.isRegisteredInner===!0||this.configuration.register!==!0&&this.isConnectedInner===!0}newSipEvent(e){this.trigger("sipEvent",e)}registrator(){return this.registratorInner}}class ut{url;constructor(e){this.url=e}}class mt extends V.EventEmitter{contentType;body;constructor(e,t){super(),this.contentType=e,this.body=t}}const I="remote",lt=(o,e)=>{const t=new w(e),r={originator:I,request:t,info:new mt("","")};o.newInfo(r)},pt=(o,e)=>{const r={event:"sipEvent",request:new w(e)};o.newSipEvent(r)},gt=(o,{incomingNumber:e="1234",displayName:t,host:r})=>{const n=new s({originator:I,eventHandlers:{}}),c=new H("sip",e,r);n.remote_identity=new U(c,t);const p=new w([]);o.trigger("newRTCSession",{originator:I,session:n,request:p})},_t=(o,e)=>{e?o.trigger("failed",e):o.trigger("failed",o)},N={triggerNewInfo:lt,triggerNewSipEvent:pt,triggerIncomingSession:gt,triggerFailIncomingSession:_t,WebSocketInterface:ut,UA:i,C:{INVITE:"INVITE"}},u="user",h="displayName",m="SIP_SERVER_URL",C="SIP_WEB_SOCKET_SERVER_URL",Tt=new N.WebSocketInterface(C),R={userAgent:"Chrome",sipServerUrl:m,sipWebSocketServerURL:C},It={...R},b={...R,user:u,password:d,register:!0},St={...b,displayName:h},wt={...R,displayName:h,register:!1},l={session_timers:!1,sockets:[Tt],user_agent:"Chrome",sdpSemantics:"unified-plan",register_expires:300,connection_recovery_max_interval:6,connection_recovery_min_interval:2},Nt={...l,password:d,uri:new a.URI("sip",u,m),display_name:"",register:!0},Ct={...l,password:d,uri:new a.URI("sip",u,m),display_name:h,register:!0},Rt={...l,display_name:h,register:!1},ft={...l,display_name:"",register:!1},k="10.10.10.10",At=[`X-Vinteo-Remote: ${k}`],Mt=()=>new D.SipConnector({JsSIP:N});exports.FAILED_CONFERENCE_NUMBER=F;exports.JsSIP=N;exports.NAME_INCORRECT=W;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=T;exports.SIP_SERVER_URL=m;exports.SIP_WEB_SOCKET_SERVER_URL=C;exports.dataForConnectionWithAuthorization=b;exports.dataForConnectionWithAuthorizationWithDisplayName=St;exports.dataForConnectionWithoutAuthorization=wt;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=It;exports.displayName=h;exports.doMockSipConnector=Mt;exports.extraHeadersRemoteAddress=At;exports.remoteAddress=k;exports.uaConfigurationWithAuthorization=Nt;exports.uaConfigurationWithAuthorizationWithDisplayName=Ct;exports.uaConfigurationWithoutAuthorization=Rt;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=ft;exports.user=u;