sip-connector 14.0.0 → 14.0.1-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 (96) hide show
  1. package/dist/SipConnector-CJN8qKAC.js +1316 -0
  2. package/dist/SipConnector-DO0YvSq6.cjs +1 -0
  3. package/dist/doMock.cjs +1 -1
  4. package/dist/doMock.js +379 -390
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +510 -518
  7. package/dist/{SipConnector.d.ts → src/SipConnector.d.ts} +64 -77
  8. package/dist/{__fixtures__ → src/__fixtures__}/BaseSession.mock.d.ts +19 -31
  9. package/dist/{__fixtures__ → src/__fixtures__}/RTCPeerConnectionMock.d.ts +14 -14
  10. package/dist/{__fixtures__ → src/__fixtures__}/RTCRtpSenderMock.d.ts +2 -2
  11. package/dist/{__fixtures__ → src/__fixtures__}/RTCSessionMock.d.ts +23 -27
  12. package/dist/{__fixtures__ → src/__fixtures__}/UA.mock.d.ts +24 -43
  13. package/dist/{__fixtures__ → src/__fixtures__}/channelsNotify.d.ts +2 -2
  14. package/dist/{__fixtures__ → src/__fixtures__}/jssip.mock.d.ts +1 -1
  15. package/dist/{__fixtures__ → src/__fixtures__}/participantNotify.d.ts +2 -2
  16. package/dist/{constants.d.ts → src/constants.d.ts} +5 -0
  17. package/dist/{types.d.ts → src/types.d.ts} +2 -1
  18. package/package.json +35 -35
  19. package/dist/SipConnector-Cc1z-VjV.js +0 -1335
  20. package/dist/SipConnector-K7IHfEEm.cjs +0 -1
  21. package/dist/utils.d.ts +0 -4
  22. /package/dist/{SipConnectorFacade → src/SipConnectorFacade}/SipConnectorFacade.d.ts +0 -0
  23. /package/dist/{SipConnectorFacade → src/SipConnectorFacade}/index.d.ts +0 -0
  24. /package/dist/{__fixtures__ → src/__fixtures__}/Registrator.mock.d.ts +0 -0
  25. /package/dist/{__fixtures__ → src/__fixtures__}/Request.mock.d.ts +0 -0
  26. /package/dist/{__fixtures__ → src/__fixtures__}/WebSocketInterface.mock.d.ts +0 -0
  27. /package/dist/{__fixtures__ → src/__fixtures__}/accountNotify.d.ts +0 -0
  28. /package/dist/{__fixtures__ → src/__fixtures__}/channels.d.ts +0 -0
  29. /package/dist/{__fixtures__ → src/__fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
  30. /package/dist/{__fixtures__ → src/__fixtures__}/delayPromise.d.ts +0 -0
  31. /package/dist/{__fixtures__ → src/__fixtures__}/enterRoom.d.ts +0 -0
  32. /package/dist/{__fixtures__ → src/__fixtures__}/index.d.ts +0 -0
  33. /package/dist/{__fixtures__ → src/__fixtures__}/mediaState.d.ts +0 -0
  34. /package/dist/{__fixtures__ → src/__fixtures__}/participantMoveRequests.d.ts +0 -0
  35. /package/dist/{__fixtures__ → src/__fixtures__}/remoteCallerData.d.ts +0 -0
  36. /package/dist/{__fixtures__ → src/__fixtures__}/utils.d.ts +0 -0
  37. /package/dist/{__fixtures__ → src/__fixtures__}/webcastNotify.d.ts +0 -0
  38. /package/dist/{causes.d.ts → src/causes.d.ts} +0 -0
  39. /package/dist/{doMock.d.ts → src/doMock.d.ts} +0 -0
  40. /package/dist/{eventNames.d.ts → src/eventNames.d.ts} +0 -0
  41. /package/dist/{getExtraHeadersRemoteAddress.d.ts → src/getExtraHeadersRemoteAddress.d.ts} +0 -0
  42. /package/dist/{headers.d.ts → src/headers.d.ts} +0 -0
  43. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  44. /package/dist/{logger.d.ts → src/logger.d.ts} +0 -0
  45. /package/dist/{setParametersToSender → src/setParametersToSender}/configureDegradationPreference.d.ts +0 -0
  46. /package/dist/{setParametersToSender → src/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
  47. /package/dist/{setParametersToSender → src/setParametersToSender}/configureEncodings.d.ts +0 -0
  48. /package/dist/{setParametersToSender → src/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
  49. /package/dist/{setParametersToSender → src/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
  50. /package/dist/{setParametersToSender → src/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
  51. /package/dist/{setParametersToSender → src/setParametersToSender}/index.d.ts +0 -0
  52. /package/dist/{setParametersToSender → src/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
  53. /package/dist/{setParametersToSender → src/setParametersToSender}/setParametersToSender.d.ts +0 -0
  54. /package/dist/{tools → src/tools}/__fixtures__/call.d.ts +0 -0
  55. /package/dist/{tools → src/tools}/__fixtures__/connectToServer.d.ts +0 -0
  56. /package/dist/{tools → src/tools}/__fixtures__/hasValidUri.d.ts +0 -0
  57. /package/dist/{tools → src/tools}/__fixtures__/permissions.d.ts +0 -0
  58. /package/dist/{tools → src/tools}/__fixtures__/processRequest.d.ts +0 -0
  59. /package/dist/{tools → src/tools}/__tests-utils__/parseObject.d.ts +0 -0
  60. /package/dist/{tools → src/tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
  61. /package/dist/{tools → src/tools}/error/getLinkError.d.ts +0 -0
  62. /package/dist/{tools → src/tools}/error/getTypeFromError.d.ts +0 -0
  63. /package/dist/{tools → src/tools}/error/getValuesFromError.d.ts +0 -0
  64. /package/dist/{tools → src/tools}/error/index.d.ts +0 -0
  65. /package/dist/{tools → src/tools}/error/stringifyMessage.d.ts +0 -0
  66. /package/dist/{tools → src/tools}/generateSimulcastEncodings.d.ts +0 -0
  67. /package/dist/{tools → src/tools}/getExtraHeaders.d.ts +0 -0
  68. /package/dist/{tools → src/tools}/getUserAgent.d.ts +0 -0
  69. /package/dist/{tools → src/tools}/hasPurgatory.d.ts +0 -0
  70. /package/dist/{tools → src/tools}/index.d.ts +0 -0
  71. /package/dist/{tools → src/tools}/prepareMediaStream.d.ts +0 -0
  72. /package/dist/{tools → src/tools}/resolveUpdateTransceiver.d.ts +0 -0
  73. /package/dist/{tools → src/tools}/sendDTMFAccumulated.d.ts +0 -0
  74. /package/dist/{tools → src/tools}/setVideoTrackContentHints.d.ts +0 -0
  75. /package/dist/{tools → src/tools}/syncMediaState/index.d.ts +0 -0
  76. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMainCam.d.ts +0 -0
  77. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMic.d.ts +0 -0
  78. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMainCam.d.ts +0 -0
  79. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMic.d.ts +0 -0
  80. /package/dist/{utils → src/utils}/errors.d.ts +0 -0
  81. /package/dist/{utils → src/utils}/findSenderByStream.d.ts +0 -0
  82. /package/dist/{utils → src/utils}/findVideoSender.d.ts +0 -0
  83. /package/dist/{utils → src/utils}/findVideoTrack.d.ts +0 -0
  84. /package/dist/{utils → src/utils}/getCodecFromSender.d.ts +0 -0
  85. /package/dist/{utils → src/utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
  86. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/balance.d.ts +0 -0
  87. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
  88. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
  89. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
  90. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasIncludesString.d.ts +0 -0
  91. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/index.d.ts +0 -0
  92. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/processSender.d.ts +0 -0
  93. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleBitrate.d.ts +0 -0
  94. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
  95. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
  96. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import { IncomingInfoEvent, IncomingRTCSessionEvent, IncomingRequest, OutgoingInfoEvent, RTCSession, RegisteredEvent, UA, UAConfigurationParams, URI, UnRegisteredEvent, WebSocketInterface } from '@krivega/jssip';
2
2
  import { TEventSession, TEventUA } from './eventNames';
3
3
  import { TContentHint, TCustomError, TJsSIP, TOnAddedTransceiver } from './types';
4
- export declare const hasCanceledCallError: (error?: TCustomError) => boolean;
4
+ export declare const hasCanceledCallError: (error: unknown) => boolean;
5
5
  type TChannels = {
6
6
  inputChannels: string;
7
7
  outputChannels: string;
@@ -127,44 +127,34 @@ type TParametersCall = TParametersAnswerToIncomingCall & {
127
127
  number: string;
128
128
  };
129
129
  type TCall = (parameters: TParametersCall) => Promise<RTCPeerConnection>;
130
- type TDisconnect = () => Promise<void>;
131
130
  type TAnswerToIncomingCall = (parameters: TParametersAnswerToIncomingCall) => Promise<RTCPeerConnection>;
132
131
  type TSendDTMF = (tone: number | string) => Promise<void>;
133
132
  type THangUp = () => Promise<void>;
134
133
  export default class SipConnector {
135
- private _isRegisterConfig;
136
- private _connectionConfiguration;
137
- private _remoteStreams;
134
+ private isRegisterConfigInner;
135
+ private connectionConfiguration;
136
+ private remoteStreams;
138
137
  private readonly JsSIP;
139
- private readonly _sessionEvents;
140
- private readonly _uaEvents;
141
- private readonly _cancelableConnect;
142
- private _cancelableConnectWithRepeatedCalls;
143
- private _cancelableSendPresentationWithRepeatedCalls;
144
- private readonly _cancelableInitUa;
145
- private readonly _cancelableDisconnect;
146
- private readonly _cancelableSet;
147
- private readonly _cancelableCall;
148
- private readonly _cancelableAnswer;
149
- private readonly _cancelableSendDTMF;
138
+ private readonly sessionEvents;
139
+ private readonly uaEvents;
150
140
  private getSipServerUrl;
141
+ private cancelableConnectWithRepeatedCalls;
142
+ private cancelableSendPresentationWithRepeatedCalls;
143
+ private isPendingConnect;
144
+ private isPendingInitUa;
145
+ private isPendingCall;
146
+ private isPendingAnswer;
151
147
  promisePendingStartPresentation?: Promise<MediaStream>;
152
148
  promisePendingStopPresentation?: Promise<MediaStream | void>;
153
149
  ua?: UA;
154
150
  rtcSession?: RTCSession;
155
151
  incomingRTCSession?: RTCSession;
156
- _streamPresentationCurrent?: MediaStream;
152
+ streamPresentationCurrent?: MediaStream;
157
153
  socket?: WebSocketInterface;
158
154
  constructor({ JsSIP }: {
159
155
  JsSIP: TJsSIP;
160
156
  });
161
157
  connect: TConnect;
162
- initUa: TInitUa;
163
- set: TSet;
164
- call: TCall;
165
- disconnect: TDisconnect;
166
- answerToIncomingCall: TAnswerToIncomingCall;
167
- sendDTMF: TSendDTMF;
168
158
  hangUp: THangUp;
169
159
  register(): Promise<RegisteredEvent>;
170
160
  unregister(): Promise<UnRegisteredEvent>;
@@ -187,11 +177,11 @@ export default class SipConnector {
187
177
  removeIncomingSession: () => void;
188
178
  askPermissionToEnableCam(options?: TOptionsInfoMediaState): Promise<void>;
189
179
  get isPendingPresentation(): boolean;
190
- private readonly _connectWithDuplicatedCalls;
191
- private _sendPresentationWithDuplicatedCalls;
180
+ private readonly connectWithDuplicatedCalls;
181
+ private sendPresentationWithDuplicatedCalls;
192
182
  private hasEqualConnectionConfiguration;
193
183
  private createUaConfiguration;
194
- private _sendPresentation;
184
+ private sendPresentation;
195
185
  startPresentation(stream: MediaStream, { isNeedReinvite, isP2P, maxBitrate, contentHint, sendEncodings, onAddedTransceiver, }?: {
196
186
  isNeedReinvite?: boolean;
197
187
  isP2P?: boolean;
@@ -213,11 +203,11 @@ export default class SipConnector {
213
203
  sendEncodings?: RTCRtpEncodingParameters[];
214
204
  onAddedTransceiver?: TOnAddedTransceiver;
215
205
  }): Promise<MediaStream | void>;
216
- _removeStreamPresentationCurrent(): void;
217
- _resetPresentation(): void;
218
- _cancelRequestsAndResetPresentation(): void;
206
+ removeStreamPresentationCurrent(): void;
207
+ resetPresentation(): void;
208
+ cancelRequestsAndResetPresentation(): void;
219
209
  handleNewRTCSession: ({ originator, session: rtcSession }: IncomingRTCSessionEvent) => void;
220
- on<T = void>(eventName: TEventUA, handler: (data: T) => void): () => void;
210
+ on<T>(eventName: TEventUA, handler: (data: T) => void): () => void;
221
211
  once<T>(eventName: TEventUA, handler: (data: T) => void): () => void;
222
212
  onceRace<T>(eventNames: TEventUA[], handler: (data: T, eventName: string) => void): () => void;
223
213
  wait<T>(eventName: TEventUA): Promise<T>;
@@ -251,64 +241,61 @@ export default class SipConnector {
251
241
  get isRegisterConfig(): boolean;
252
242
  get isCallActive(): boolean;
253
243
  get isAvailableIncomingCall(): boolean;
254
- _connect: TConnect;
255
- _initUa: TInitUa;
256
- _createUa: TCreateUa;
257
- _start: TStart;
258
- _set: TSet;
259
- _disconnectWithoutCancelRequests: TDisconnect;
260
- _disconnect: () => Promise<void>;
261
- _call: TCall;
262
- _answer: TAnswerToIncomingCall;
263
- _handleCall: ({ ontrack }: {
244
+ connectInner: TConnect;
245
+ initUa: TInitUa;
246
+ createUa: TCreateUa;
247
+ start: TStart;
248
+ set: TSet;
249
+ disconnect: () => Promise<void>;
250
+ call: TCall;
251
+ answerToIncomingCall: TAnswerToIncomingCall;
252
+ handleCall: ({ ontrack }: {
264
253
  ontrack?: TOntrack;
265
254
  }) => Promise<RTCPeerConnection>;
266
- _restoreSession: () => void;
267
- _sendDTMF: TSendDTMF;
268
- _generateStream(videoTrack: MediaStreamTrack, audioTrack?: MediaStreamTrack): MediaStream;
269
- _generateAudioStream(audioTrack: MediaStreamTrack): MediaStream;
270
- _generateStreams(remoteTracks: MediaStreamTrack[]): MediaStream[];
271
- _generateAudioStreams(remoteTracks: MediaStreamTrack[]): MediaStream[];
272
- _hangUpWithoutCancelRequests: THangUp;
273
- _cancelRequests(): void;
274
- _cancelConnectWithRepeatedCalls(): void;
275
- _cancelSendPresentationWithRepeatedCalls(): void;
276
- _cancelCallRequests(): void;
277
- _cancelActionsRequests(): void;
278
- _handleShareState: (eventName: string) => void;
279
- _maybeTriggerChannels: (request: IncomingRequest) => void;
280
- _handleNotify: (header: TInfoNotify) => void;
281
- _triggerRemovedFromListModeratorsNotify: ({ conference, }: TRemovedFromListModeratorsInfoNotify) => void;
282
- _triggerAddedToListModeratorsNotify: ({ conference }: TAddedToListModeratorsInfoNotify) => void;
283
- _triggerWebcastStartedNotify: ({ body: { conference, type } }: TWebcastInfoNotify) => void;
284
- _triggerWebcastStoppedNotify: ({ body: { conference, type } }: TWebcastInfoNotify) => void;
285
- _triggerAccountChangedNotify: () => void;
286
- _triggerAccountDeletedNotify: () => void;
287
- _triggerConferenceParticipantTokenIssued: ({ body: { conference, participant, jwt }, }: TConferenceParticipantTokenIssued) => void;
288
- _triggerChannelsNotify: (channelsInfo: TChannelsInfoNotify) => void;
289
- _triggerParticipationAcceptingWordRequest: ({ body: { conference }, }: TAcceptingWordRequestInfoNotify) => void;
290
- _triggerParticipationCancellingWordRequest: ({ body: { conference }, }: TCancellingWordRequestInfoNotify) => void;
291
- _triggerParticipantMoveRequestToStream: ({ body: { conference }, }: TMoveRequestToStreamInfoNotify) => void;
292
- _triggerEnterRoom: (request: IncomingRequest) => void;
293
- _triggerShareState: (request: IncomingRequest) => void;
294
- _maybeTriggerParticipantMoveRequest: (request: IncomingRequest) => void;
295
- _triggerMainCamControl: (request: IncomingRequest) => void;
296
- _triggerMicControl: (request: IncomingRequest) => void;
297
- _triggerUseLicense: (request: IncomingRequest) => void;
298
- _handleNewInfo: (info: IncomingInfoEvent | OutgoingInfoEvent) => void;
299
- _handleSipEvent: ({ request }: {
255
+ restoreSession: () => void;
256
+ sendDTMF: TSendDTMF;
257
+ generateStream(videoTrack: MediaStreamTrack, audioTrack?: MediaStreamTrack): MediaStream;
258
+ generateAudioStream(audioTrack: MediaStreamTrack): MediaStream;
259
+ generateStreams(remoteTracks: MediaStreamTrack[]): MediaStream[];
260
+ generateAudioStreams(remoteTracks: MediaStreamTrack[]): MediaStream[];
261
+ hangUpWithoutCancelRequests: THangUp;
262
+ cancelRequests(): void;
263
+ cancelConnectWithRepeatedCalls(): void;
264
+ cancelSendPresentationWithRepeatedCalls(): void;
265
+ handleShareState: (eventName: string) => void;
266
+ maybeTriggerChannels: (request: IncomingRequest) => void;
267
+ handleNotify: (header: TInfoNotify) => void;
268
+ triggerRemovedFromListModeratorsNotify: ({ conference, }: TRemovedFromListModeratorsInfoNotify) => void;
269
+ triggerAddedToListModeratorsNotify: ({ conference }: TAddedToListModeratorsInfoNotify) => void;
270
+ triggerWebcastStartedNotify: ({ body: { conference, type } }: TWebcastInfoNotify) => void;
271
+ triggerWebcastStoppedNotify: ({ body: { conference, type } }: TWebcastInfoNotify) => void;
272
+ triggerAccountChangedNotify: () => void;
273
+ triggerAccountDeletedNotify: () => void;
274
+ triggerConferenceParticipantTokenIssued: ({ body: { conference, participant, jwt }, }: TConferenceParticipantTokenIssued) => void;
275
+ triggerChannelsNotify: (channelsInfo: TChannelsInfoNotify) => void;
276
+ triggerParticipationAcceptingWordRequest: ({ body: { conference }, }: TAcceptingWordRequestInfoNotify) => void;
277
+ triggerParticipationCancellingWordRequest: ({ body: { conference }, }: TCancellingWordRequestInfoNotify) => void;
278
+ triggerParticipantMoveRequestToStream: ({ body: { conference }, }: TMoveRequestToStreamInfoNotify) => void;
279
+ triggerEnterRoom: (request: IncomingRequest) => void;
280
+ triggerShareState: (request: IncomingRequest) => void;
281
+ maybeTriggerParticipantMoveRequest: (request: IncomingRequest) => void;
282
+ triggerMainCamControl: (request: IncomingRequest) => void;
283
+ triggerMicControl: (request: IncomingRequest) => void;
284
+ triggerUseLicense: (request: IncomingRequest) => void;
285
+ handleNewInfo: (info: IncomingInfoEvent | OutgoingInfoEvent) => void;
286
+ handleSipEvent: ({ request }: {
300
287
  request: IncomingRequest;
301
288
  }) => void;
302
- _maybeHandleNotify: (request: IncomingRequest) => void;
289
+ maybeHandleNotify: (request: IncomingRequest) => void;
303
290
  waitChannels(): Promise<TChannels>;
304
291
  waitSyncMediaState(): Promise<{
305
292
  isSyncForced: boolean;
306
293
  }>;
307
294
  sendChannels({ inputChannels, outputChannels }: TChannels): Promise<void>;
308
295
  sendMediaState({ cam, mic }: TMediaState, options?: TOptionsInfoMediaState): Promise<void>;
309
- _sendRefusalToTurnOn(type: 'cam' | 'mic', options?: TOptionsInfoMediaState): Promise<void>;
296
+ sendRefusalToTurnOn(type: 'cam' | 'mic', options?: TOptionsInfoMediaState): Promise<void>;
310
297
  sendRefusalToTurnOnMic(options?: TOptionsInfoMediaState): Promise<void>;
311
298
  sendRefusalToTurnOnCam(options?: TOptionsInfoMediaState): Promise<void>;
312
- _handleEnded: (error: TCustomError) => void;
299
+ handleEnded: (error: TCustomError) => void;
313
300
  }
314
301
  export {};
@@ -1,33 +1,28 @@
1
1
  import { AnswerOptions, ExtraHeaders, HoldOptions, MediaStreamTypes, NameAddrHeader, OnHoldResult, RTCPeerConnectionDeprecated, RTCSession, ReferOptions, RenegotiateOptions, SessionDirection, SessionStatus, TerminateOptions, URI, C as constants } from '@krivega/jssip';
2
2
  import { default as Events } from 'events-constructor';
3
3
  import { TEventSession, SESSION_EVENT_NAMES } from '../eventNames';
4
- /**
5
- * BaseSession
6
- * @class
7
- */
4
+ export type TEventHandlers = Record<string, (data: unknown) => void>;
8
5
  declare class BaseSession implements RTCSession {
9
6
  originator: string;
10
- _connection: RTCPeerConnectionDeprecated;
11
- _events: Events<typeof SESSION_EVENT_NAMES>;
12
- _remote_identity: NameAddrHeader;
13
- _mutedOptions: {
7
+ connection: RTCPeerConnectionDeprecated;
8
+ events: Events<typeof SESSION_EVENT_NAMES>;
9
+ remote_identity: NameAddrHeader;
10
+ mutedOptions: {
14
11
  audio: boolean;
15
12
  video: boolean;
16
13
  };
17
- constructor({ originator, eventHandlers }: {
18
- originator?: string | undefined;
19
- eventHandlers: any;
14
+ constructor({ originator, eventHandlers, }: {
15
+ originator?: string;
16
+ eventHandlers: TEventHandlers;
20
17
  });
21
18
  get C(): SessionStatus;
22
19
  get causes(): constants.causes;
23
20
  get id(): string;
24
- set data(_data: any);
25
- get data(): any;
26
- get connection(): RTCPeerConnectionDeprecated;
21
+ set data(_data: unknown);
22
+ get data(): unknown;
27
23
  get contact(): string;
28
24
  get direction(): SessionDirection;
29
25
  get local_identity(): NameAddrHeader;
30
- get remote_identity(): NameAddrHeader;
31
26
  get start_time(): Date;
32
27
  get end_time(): Date;
33
28
  get status(): SessionStatus;
@@ -50,30 +45,23 @@ declare class BaseSession implements RTCSession {
50
45
  deleteExisting: boolean;
51
46
  addMissing: boolean;
52
47
  }): Promise<void>;
53
- addListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
54
- once(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
55
- removeListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
56
- off(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
48
+ addListener(_event: string | symbol, _listener: (...arguments_: unknown[]) => void): this;
49
+ once(_event: string | symbol, _listener: (...arguments_: unknown[]) => void): this;
50
+ removeListener(_event: string | symbol, _listener: (...arguments_: unknown[]) => void): this;
51
+ off(_event: string | symbol, _listener: (...arguments_: unknown[]) => void): this;
57
52
  removeAllListeners(_event?: string | symbol): this;
58
53
  setMaxListeners(_n: number): this;
59
54
  getMaxListeners(): number;
60
55
  listeners(_event: string | symbol): (() => void)[];
61
56
  rawListeners(_event: string | symbol): (() => void)[];
62
- emit(_event: string | symbol, ..._arguments_: any[]): boolean;
57
+ emit(_event: string | symbol, ..._arguments_: unknown[]): boolean;
63
58
  listenerCount(_event: string | symbol): number;
64
- prependListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
65
- prependOnceListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
59
+ prependListener(_event: string | symbol, _listener: (...arguments_: unknown[]) => void): this;
60
+ prependOnceListener(_event: string | symbol, _listener: (...arguments_: unknown[]) => void): this;
66
61
  eventNames(): (string | symbol)[];
67
- /**
68
- * initEvents
69
- *
70
- * @param {Array} [eventHandlers=[] - ] The event handlers
71
- *
72
- * @returns {undefined}
73
- */
74
- initEvents(eventHandlers?: never[]): void;
62
+ initEvents(eventHandlers: TEventHandlers): void;
75
63
  on<T>(eventName: string, handler: (data: T) => void): this;
76
- trigger(eventName: TEventSession, data?: any): void;
64
+ trigger(eventName: TEventSession, data?: unknown): void;
77
65
  /**
78
66
  * sendDTMF
79
67
  *
@@ -2,8 +2,8 @@ import { RTCPeerConnectionDeprecated } from '@krivega/jssip';
2
2
  import { MediaStreamTrackMock } from 'webrtc-mock';
3
3
  import { default as RTCRtpSenderMock } from './RTCRtpSenderMock';
4
4
  declare class RTCPeerConnectionMock implements RTCPeerConnectionDeprecated {
5
- _senders: RTCRtpSender[];
6
- _receivers: any[];
5
+ senders: RTCRtpSender[];
6
+ receivers: RTCRtpReceiver[];
7
7
  constructor(_configuration?: RTCConfiguration, tracks: MediaStreamTrackMock[]);
8
8
  canTrickleIceCandidates: boolean | null;
9
9
  connectionState: RTCPeerConnectionState;
@@ -14,15 +14,15 @@ declare class RTCPeerConnectionMock implements RTCPeerConnectionDeprecated {
14
14
  idpErrorInfo: string | null;
15
15
  idpLoginUrl: string | null;
16
16
  localDescription: RTCSessionDescription | null;
17
- onconnectionstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
18
- ondatachannel: ((this: RTCPeerConnection, event_: RTCDataChannelEvent) => any) | null;
19
- onicecandidate: ((this: RTCPeerConnection, event_: RTCPeerConnectionIceEvent) => any) | null;
20
- onicecandidateerror: ((this: RTCPeerConnection, event_: Event) => any) | null;
21
- oniceconnectionstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
22
- onicegatheringstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
23
- onnegotiationneeded: ((this: RTCPeerConnection, event_: Event) => any) | null;
24
- onsignalingstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
25
- ontrack: ((this: RTCPeerConnection, event_: RTCTrackEvent) => any) | null;
17
+ onconnectionstatechange: ((this: RTCPeerConnection, event_: Event) => unknown) | null;
18
+ ondatachannel: ((this: RTCPeerConnection, event_: RTCDataChannelEvent) => unknown) | null;
19
+ onicecandidate: ((this: RTCPeerConnection, event_: RTCPeerConnectionIceEvent) => unknown) | null;
20
+ onicecandidateerror: ((this: RTCPeerConnection, event_: Event) => unknown) | null;
21
+ oniceconnectionstatechange: ((this: RTCPeerConnection, event_: Event) => unknown) | null;
22
+ onicegatheringstatechange: ((this: RTCPeerConnection, event_: Event) => unknown) | null;
23
+ onnegotiationneeded: ((this: RTCPeerConnection, event_: Event) => unknown) | null;
24
+ onsignalingstatechange: ((this: RTCPeerConnection, event_: Event) => unknown) | null;
25
+ ontrack: ((this: RTCPeerConnection, event_: RTCTrackEvent) => unknown) | null;
26
26
  peerIdentity: undefined;
27
27
  pendingLocalDescription: RTCSessionDescription | null;
28
28
  pendingRemoteDescription: RTCSessionDescription | null;
@@ -47,12 +47,12 @@ declare class RTCPeerConnectionMock implements RTCPeerConnectionDeprecated {
47
47
  setConfiguration(_configuration: RTCConfiguration): void;
48
48
  setLocalDescription(_description: RTCSessionDescriptionInit): Promise<void>;
49
49
  setRemoteDescription(_description: RTCSessionDescriptionInit): Promise<void>;
50
- addEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) => any, options?: AddEventListenerOptions | boolean): void;
50
+ addEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) => unknown, options?: AddEventListenerOptions | boolean): void;
51
51
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
52
- removeEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) => any, options?: EventListenerOptions | boolean): void;
52
+ removeEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) => unknown, options?: EventListenerOptions | boolean): void;
53
53
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: EventListenerOptions | boolean): void;
54
54
  dispatchEvent(_event: Event): boolean;
55
- getReceivers: () => any[];
55
+ getReceivers: () => RTCRtpReceiver[];
56
56
  getSenders: () => RTCRtpSender[];
57
57
  addTrack: (track: MediaStreamTrack) => RTCRtpSenderMock;
58
58
  }
@@ -3,8 +3,8 @@ declare class RTCRtpSenderMock implements RTCRtpSender {
3
3
  track: MediaStreamTrack | null;
4
4
  transport: RTCDtlsTransport | null;
5
5
  transform: RTCRtpTransform | null;
6
- private _parameters;
7
- private _parametersGets?;
6
+ private parameters;
7
+ private parametersGets?;
8
8
  constructor({ track }?: {
9
9
  track?: MediaStreamTrack;
10
10
  });
@@ -1,18 +1,18 @@
1
1
  import { IncomingInfoEvent } from '@krivega/jssip';
2
- import { default as BaseSession } from './BaseSession.mock';
2
+ import { TEventHandlers, default as BaseSession } from './BaseSession.mock';
3
3
  export declare const FAILED_CONFERENCE_NUMBER = "777";
4
4
  export declare const createDeclineStartPresentationError: () => Error;
5
5
  declare class RTCSessionMock extends BaseSession {
6
6
  url: string;
7
7
  status_code?: number;
8
- private _isEnded;
8
+ private isEndedInner;
9
9
  private static startPresentationError?;
10
10
  private static countStartPresentationError;
11
11
  private static countStartsPresentation;
12
12
  constructor({ url, mediaStream, eventHandlers, originator, }: {
13
13
  url?: string;
14
- mediaStream?: any;
15
- eventHandlers?: any;
14
+ mediaStream?: MediaStream;
15
+ eventHandlers: TEventHandlers;
16
16
  originator: string;
17
17
  });
18
18
  static setStartPresentationError(startPresentationError: Error, { count }?: {
@@ -20,8 +20,8 @@ declare class RTCSessionMock extends BaseSession {
20
20
  }): void;
21
21
  static resetStartPresentationError(): void;
22
22
  startPresentation(stream: MediaStream): Promise<MediaStream>;
23
- initPeerconnection(mediaStream: any): boolean;
24
- createPeerconnection(sendedStream: any): void;
23
+ initPeerconnection(mediaStream: MediaStream | undefined): boolean;
24
+ createPeerconnection(sendedStream: MediaStream): void;
25
25
  connect(target: string): void;
26
26
  /**
27
27
  * answer
@@ -32,42 +32,38 @@ declare class RTCSessionMock extends BaseSession {
32
32
 
33
33
  * @returns {undefined}
34
34
  */
35
- answer: jest.Mock<void, [any], any>;
36
- terminate({ status_code }?: {
35
+ answer: jest.Mock<void, [{
36
+ mediaStream: MediaStream;
37
+ }], any>;
38
+ terminate({ status_code, cause }?: {
37
39
  status_code?: number;
40
+ cause?: string;
38
41
  }): this;
39
- terminateAsync({ status_code }?: {
42
+ terminateAsync({ status_code, cause }?: {
40
43
  status_code?: number;
44
+ cause?: string;
41
45
  }): Promise<void>;
42
46
  terminateRemote({ status_code }?: {
43
47
  status_code?: number;
44
48
  }): this;
45
- _addStream(stream: Record<string, () => any[]>, action?: string): void;
46
- _forEachSenders(callback: {
47
- ({ track }: {
48
- track: any;
49
- }): void;
50
- ({ track }: {
51
- track: any;
52
- }): void;
53
- (argument0: any): void;
54
- }): RTCRtpSender[];
55
- _toggleMuteAudio(mute: boolean): void;
56
- _toggleMuteVideo(mute: boolean): void;
49
+ addStream(stream: MediaStream, action?: 'getTracks' | 'getAudioTracks' | 'getVideoTracks'): void;
50
+ forEachSenders(callback: (sender: RTCRtpSender) => void): RTCRtpSender[];
51
+ toggleMuteAudio(mute: boolean): void;
52
+ toggleMuteVideo(mute: boolean): void;
57
53
  mute(options: {
58
- audio: any;
59
- video: any;
54
+ audio: boolean;
55
+ video: boolean;
60
56
  }): void;
61
57
  unmute(options: {
62
- audio: any;
63
- video: any;
58
+ audio: boolean;
59
+ video: boolean;
64
60
  }): void;
65
61
  isMuted(): {
66
62
  audio: boolean;
67
63
  video: boolean;
68
64
  };
69
- replaceMediaStream(mediaStream: any): Promise<any>;
70
- _onmute({ audio, video }: {
65
+ replaceMediaStream(_mediaStream: MediaStream): Promise<void>;
66
+ onmute({ audio, video }: {
71
67
  audio: boolean;
72
68
  video: boolean;
73
69
  }): void;
@@ -1,43 +1,32 @@
1
- import { UA as IUA, IncomingRequest, UAConfiguration, UAConfigurationParams } from '@krivega/jssip';
1
+ import { DisconnectEvent, UA as IUA, IncomingRequest, UAConfiguration, UAConfigurationParams, UAEventMap } from '@krivega/jssip';
2
2
  import { default as Events } from 'events-constructor';
3
- import { TEventUA, UA_EVENT_NAMES } from '../eventNames';
3
+ import { TEventHandlers } from './BaseSession.mock';
4
4
  import { default as Registrator } from './Registrator.mock';
5
5
  import { default as RTCSessionMock } from './RTCSessionMock';
6
6
  export declare const PASSWORD_CORRECT = "PASSWORD_CORRECT";
7
7
  export declare const PASSWORD_CORRECT_2 = "PASSWORD_CORRECT_2";
8
8
  export declare const NAME_INCORRECT = "NAME_INCORRECT";
9
- export declare const createWebsocketHandshakeTimeoutError: (sipServerUrl: string) => {
10
- socket: {
11
- _url: string;
12
- _sip_uri: string;
13
- _via_transport: string;
14
- _ws: null;
15
- };
16
- error: boolean;
17
- code: number;
18
- reason: string;
19
- };
9
+ export declare const createWebsocketHandshakeTimeoutError: (sipServerUrl: string) => DisconnectEvent;
20
10
  declare class UA implements IUA {
21
11
  private static isAvailableTelephony;
22
12
  private static startError?;
23
13
  private static countStartError;
24
14
  private static countStarts;
25
- static setStartError(startError: unknown, { count }?: {
15
+ static setStartError(startError: DisconnectEvent, { count }?: {
26
16
  count?: number;
27
17
  }): void;
28
18
  static resetStartError(): void;
29
19
  static setAvailableTelephony(): void;
30
20
  static setNotAvailableTelephony(): void;
31
- _events: Events<typeof UA_EVENT_NAMES>;
32
- _startedTimeout?: ReturnType<typeof setTimeout>;
33
- _stopedTimeout?: ReturnType<typeof setTimeout>;
34
- session?: RTCSessionMock;
35
- _isRegistered?: boolean;
36
- _isConnected?: boolean;
37
- configuration: UAConfiguration;
38
- _registrator: Registrator;
21
+ events: Events<readonly (keyof UAEventMap)[]>;
22
+ private startedTimeout?;
23
+ private stopedTimeout?;
24
+ private session?;
25
+ private isRegisteredInner?;
26
+ private isConnectedInner?;
27
+ private configuration;
28
+ readonly registratorInner: Registrator;
39
29
  constructor(_configuration: UAConfigurationParams);
40
- isConnected(): boolean;
41
30
  /**
42
31
  * start
43
32
  *
@@ -50,27 +39,22 @@ declare class UA implements IUA {
50
39
  * @returns {undefined}
51
40
  */
52
41
  stop(): void;
53
- call: jest.Mock<RTCSessionMock, [url: string, parameters: any], any>;
54
- on(eventName: TEventUA, handler: any): this;
55
- once(eventName: TEventUA, handler: any): this;
56
- off(eventName: TEventUA, handler: any): this;
42
+ call: jest.Mock<RTCSessionMock, [url: string, parameters: {
43
+ mediaStream: MediaStream;
44
+ eventHandlers: TEventHandlers;
45
+ }], any>;
46
+ on<T extends keyof UAEventMap>(eventName: T, handler: UAEventMap[T]): this;
47
+ once<T extends keyof UAEventMap>(eventName: T, handler: UAEventMap[T]): this;
48
+ off<T extends keyof UAEventMap>(eventName: T, handler: UAEventMap[T]): this;
57
49
  removeAllListeners(): this;
58
- trigger(eventName: TEventUA, data?: any): void;
50
+ trigger<T extends keyof UAEventMap>(eventName: T, data: Parameters<UAEventMap[T]>[0]): void;
59
51
  /**
60
52
  * terminateSessions
61
53
  *
62
54
  * @returns {undefined}
63
55
  */
64
56
  terminateSessions(): void;
65
- /**
66
- * set
67
- *
68
- * @param {string} key - key
69
- * @param {string} value - value
70
- *
71
- * @returns {boolean} true
72
- */
73
- set(key: string, value: any): boolean;
57
+ set(key: keyof UAConfiguration, value: UAConfiguration[keyof UAConfiguration]): boolean;
74
58
  /**
75
59
  * register
76
60
  *
@@ -83,21 +67,18 @@ declare class UA implements IUA {
83
67
  * @returns {undefined}
84
68
  */
85
69
  unregister(): void;
86
- /**
87
- * isRegistered
88
- *
89
- * @returns {boolean} isRegistered
90
- */
91
70
  isRegistered(): boolean;
71
+ isConnected(): boolean;
92
72
  /**
93
73
  * isStarted
94
74
  *
95
75
  * @returns {boolean} isStarted
96
76
  */
97
77
  isStarted(): boolean;
98
- registrator(): Registrator;
99
78
  newSipEvent(data: {
79
+ event: unknown;
100
80
  request: IncomingRequest;
101
81
  }): void;
82
+ registrator(): Registrator;
102
83
  }
103
84
  export default UA;
@@ -1,5 +1,5 @@
1
1
  export declare const channelsHeaders: [string, string][];
2
2
  export declare const channelsData: {
3
- inputChannels: any;
4
- outputChannels: any;
3
+ inputChannels: string;
4
+ outputChannels: string;
5
5
  };
@@ -9,7 +9,7 @@ declare const jssip: {
9
9
  displayName: string;
10
10
  host: string;
11
11
  }) => void;
12
- triggerFailIncomingSession: (incomingSession: unknown, options?: {
12
+ triggerFailIncomingSession: (incomingSession: RTCSession, options?: {
13
13
  originator: "local" | "remote";
14
14
  }) => void;
15
15
  WebSocketInterface: typeof WebSocketInterfaceMock;
@@ -1,8 +1,8 @@
1
1
  export declare const removedFromListModeratorsHeaders: [string, string][];
2
2
  export declare const removedFromListModeratorsData: {
3
- conference: any;
3
+ conference: string;
4
4
  };
5
5
  export declare const addedToListModeratorsHeaders: [string, string][];
6
6
  export declare const addedToListModeratorsData: {
7
- conference: any;
7
+ conference: string;
8
8
  };
@@ -72,3 +72,8 @@ export declare const PRESENTATION_FAILED = "presentation:failed";
72
72
  export declare const SPECTATOR = "SPECTATOR";
73
73
  export declare const PARTICIPANT = "PARTICIPANT";
74
74
  export declare const ONE_MEGABIT_IN_BITS = 1000000;
75
+ export declare enum Originator {
76
+ LOCAL = "local",
77
+ REMOTE = "remote",
78
+ SYSTEM = "system"
79
+ }
@@ -1,4 +1,5 @@
1
1
  import { UA, WebSocketInterface } from '@krivega/jssip';
2
+ import { Originator } from './constants';
2
3
  export declare enum EEventsMainCAM {
3
4
  PAUSE_MAIN_CAM = "PAUSEMAINCAM",
4
5
  RESUME_MAIN_CAM = "RESUMEMAINCAM",
@@ -20,7 +21,7 @@ export declare enum EUseLicense {
20
21
  AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION"
21
22
  }
22
23
  export type TCustomError = Error & {
23
- originator?: string;
24
+ originator?: Originator;
24
25
  cause?: unknown;
25
26
  message: unknown;
26
27
  _ws?: unknown;