@telnyx/webrtc 2.27.1 → 2.27.2-beta.1

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.
@@ -41,6 +41,7 @@ export interface IVertoOptions {
41
41
  debugLogLevel?: 'debug' | 'info' | 'warn' | 'error';
42
42
  debugLogMaxEntries?: number;
43
43
  skipLastVoiceSdkId?: boolean;
44
+ skipTrailing?: boolean;
44
45
  mediaPermissionsRecovery?: {
45
46
  enabled: boolean;
46
47
  timeout: number;
@@ -1,7 +1,21 @@
1
+ import { IWebRTCCall } from '../webrtc/interfaces';
2
+ export interface IStoredActiveCall {
3
+ id: IWebRTCCall['id'];
4
+ customHeaders: IWebRTCCall['options']['customHeaders'];
5
+ }
6
+ export interface IStoredActiveCalls {
7
+ sessionId: string;
8
+ calls: IStoredActiveCall[];
9
+ storedAt: number;
10
+ }
1
11
  export declare const RECONNECT_SESSION_ID_MAX_AGE_MS: number;
12
+ export declare const RECOVERY_MARKER_MAX_AGE_MS: number;
2
13
  export declare function isReconnectSessionIdFresh(now?: number): boolean;
3
14
  export declare function getReconnectToken(): string | null;
4
15
  export declare function setReconnectToken(token: string): void;
5
16
  export declare function getReconnectSessionId(now?: number): string | null;
6
17
  export declare function setReconnectSessionId(sessionId: string, storedAt?: number): void;
7
18
  export declare function clearReconnectToken(): void;
19
+ export declare function clearActiveCallsRecoveryMarker(): void;
20
+ export declare function getActiveCallsRecoveryMarker(now?: number): IStoredActiveCalls | null;
21
+ export declare function setActiveCallsRecoveryMarker(calls: IStoredActiveCall[], sessionId: string, storedAt?: number): void;
@@ -8,6 +8,7 @@ export default abstract class BaseCall implements IWebRTCCall {
8
8
  protected session: BrowserSession;
9
9
  private _webRTCStats;
10
10
  private _callReportCollector;
11
+ private _mediaDeviceCollector;
11
12
  id: string;
12
13
  recoveredCallId: string;
13
14
  state: string;
@@ -40,6 +41,7 @@ export default abstract class BaseCall implements IWebRTCCall {
40
41
  private _isRemoteDescriptionSet;
41
42
  private _signalingStateClosed;
42
43
  private _creatingPeer;
44
+ private _desiredAudioMuted;
43
45
  private _firstCandidateSent;
44
46
  private _firstNonHostCandidateSent;
45
47
  private _isRecovering;
@@ -57,6 +59,7 @@ export default abstract class BaseCall implements IWebRTCCall {
57
59
  get remoteStream(): MediaStream;
58
60
  get memberChannel(): string;
59
61
  get isAudioMuted(): boolean;
62
+ private _getLocalAudioTrackId;
60
63
  private _hasActiveUnmutedLocalAudioTrack;
61
64
  shouldForceRelayCandidateForRecovery(): boolean;
62
65
  invite(): Promise<void>;
@@ -74,6 +77,7 @@ export default abstract class BaseCall implements IWebRTCCall {
74
77
  message(to: string, body: string): void;
75
78
  muteAudio(): void;
76
79
  unmuteAudio(): void;
80
+ _applyDesiredAudioMuteState(): void;
77
81
  toggleAudioMute(): void;
78
82
  setAudioInDevice(deviceId: string, muted?: boolean): Promise<void>;
79
83
  muteVideo(): void;
@@ -127,6 +131,11 @@ export default abstract class BaseCall implements IWebRTCCall {
127
131
  private _init;
128
132
  protected _finalize(): void;
129
133
  private _getCallReportVoiceSdkId;
134
+ private _getClientSummary;
135
+ private _getAuthenticationType;
136
+ private _sanitizeIceServers;
137
+ private _sanitizeClientOption;
138
+ private _isSensitiveClientOptionKey;
130
139
  flushIntermediateCallReport(flushReason?: ICallReportFlushReason): void;
131
140
  private _flushIntermediateReport;
132
141
  private _postCallReport;
@@ -29,17 +29,23 @@ export interface ILocalAudioSourceStats {
29
29
  echoReturnLossEnhancement?: number;
30
30
  }
31
31
  interface ICECandidateInfo {
32
+ id?: string;
32
33
  address?: string;
33
34
  port?: number;
34
35
  candidateType?: string;
35
36
  protocol?: string;
36
37
  networkType?: string;
38
+ url?: string;
39
+ relayProtocol?: string;
37
40
  }
38
41
  export interface IICECandidatePair {
39
42
  id?: string;
43
+ localCandidateId?: string;
44
+ remoteCandidateId?: string;
40
45
  state?: string;
41
46
  nominated?: boolean;
42
47
  writable?: boolean;
48
+ currentRoundTripTime?: number;
43
49
  local?: ICECandidateInfo;
44
50
  remote?: ICECandidateInfo;
45
51
  requestsSent?: number;
@@ -51,6 +57,7 @@ export interface ITransportStats {
51
57
  srtpCipher?: string;
52
58
  tlsVersion?: string;
53
59
  selectedCandidatePairChanges?: number;
60
+ selectedCandidatePairId?: string;
54
61
  }
55
62
  export interface ICallReportOptions {
56
63
  enabled: boolean;
@@ -73,6 +80,21 @@ export interface IStatsInterval {
73
80
  bitrateAvg?: number;
74
81
  localTrack?: ILocalAudioTrackSnapshot;
75
82
  mediaSource?: ILocalAudioSourceStats;
83
+ retransmittedPacketsSent?: number;
84
+ retransmittedBytesSent?: number;
85
+ headerBytesSent?: number;
86
+ nackCount?: number;
87
+ targetBitrate?: number;
88
+ totalPacketSendDelay?: number;
89
+ active?: boolean;
90
+ codec?: {
91
+ mimeType?: string;
92
+ clockRate?: number;
93
+ channels?: number;
94
+ payloadType?: number;
95
+ sdpFmtpLine?: string;
96
+ codecId?: string;
97
+ };
76
98
  };
77
99
  inbound?: {
78
100
  packetsReceived?: number;
@@ -87,10 +109,31 @@ export interface IStatsInterval {
87
109
  audioLevelAvg?: number;
88
110
  jitterAvg?: number;
89
111
  bitrateAvg?: number;
112
+ nackCount?: number;
113
+ headerBytesReceived?: number;
114
+ fecPacketsReceived?: number;
115
+ fecPacketsDiscarded?: number;
116
+ jitterBufferTargetDelay?: number;
117
+ jitterBufferMinimumDelay?: number;
118
+ totalSamplesDecoded?: number;
119
+ samplesDecodedWithSilence?: number;
120
+ samplesDecodedWithConcealment?: number;
121
+ totalAudioEnergy?: number;
122
+ totalSamplesDuration?: number;
123
+ codec?: {
124
+ mimeType?: string;
125
+ clockRate?: number;
126
+ channels?: number;
127
+ payloadType?: number;
128
+ sdpFmtpLine?: string;
129
+ codecId?: string;
130
+ };
90
131
  };
91
132
  };
92
133
  connection?: {
93
134
  roundTripTimeAvg?: number;
135
+ currentRoundTripTime?: number;
136
+ roundTripTimeSource?: string;
94
137
  packetsSent?: number;
95
138
  packetsReceived?: number;
96
139
  bytesSent?: number;
@@ -98,6 +141,34 @@ export interface IStatsInterval {
98
141
  };
99
142
  ice?: IICECandidatePair;
100
143
  transport?: ITransportStats;
144
+ mediaPlayout?: {
145
+ synthesizedSamples?: number;
146
+ synthesizedDuration?: number;
147
+ totalPlayoutDelay?: number;
148
+ totalSampleCount?: number;
149
+ };
150
+ remoteRtcp?: {
151
+ inbound?: {
152
+ packetsReceived?: number;
153
+ packetsLost?: number;
154
+ fractionLost?: number;
155
+ jitter?: number;
156
+ roundTripTime?: number;
157
+ totalRoundTripTime?: number;
158
+ roundTripTimeMeasurements?: number;
159
+ roundTripTimeAvg?: number;
160
+ nackCount?: number;
161
+ reportsReceived?: number;
162
+ packetsDiscarded?: number;
163
+ };
164
+ outbound?: {
165
+ packetsSent?: number;
166
+ bytesSent?: number;
167
+ reportsCount?: number;
168
+ roundTripTime?: number;
169
+ totalPacketSendDelay?: number;
170
+ };
171
+ };
101
172
  }
102
173
  export interface ICallSummary {
103
174
  callId: string;
@@ -112,7 +183,58 @@ export interface ICallSummary {
112
183
  sdkVersion?: string;
113
184
  startTimestamp?: string;
114
185
  endTimestamp?: string;
186
+ clientSummary?: IClientSummary;
187
+ }
188
+ export interface IClientSummary {
189
+ authentication?: {
190
+ type?: 'anonymous_login' | 'login_token' | 'login_password' | 'token' | 'unknown';
191
+ anonymousLogin?: {
192
+ targetType?: string;
193
+ targetId?: string;
194
+ targetVersionId?: string;
195
+ targetParams?: SanitizedClientOption;
196
+ };
197
+ };
198
+ connection?: {
199
+ env?: string;
200
+ host?: string;
201
+ project?: string;
202
+ region?: string;
203
+ dc?: string;
204
+ rtcIp?: string;
205
+ rtcPort?: number;
206
+ autoReconnect?: boolean;
207
+ maxReconnectAttempts?: number;
208
+ keepConnectionAliveOnSocketClose?: boolean;
209
+ hangupOnBeforeUnload?: boolean;
210
+ useCanaryRtcServer?: boolean;
211
+ skipLastVoiceSdkId?: boolean;
212
+ skipTrailing?: boolean;
213
+ };
214
+ media?: {
215
+ audio?: unknown;
216
+ video?: unknown;
217
+ mutedMicOnStart?: boolean;
218
+ prefetchIceCandidates?: boolean;
219
+ forceRelayCandidate?: boolean;
220
+ trickleIce?: boolean;
221
+ iceServers?: Array<{
222
+ urls?: string | string[];
223
+ hasUsername?: boolean;
224
+ hasCredential?: boolean;
225
+ }>;
226
+ };
227
+ callReports?: {
228
+ enabled?: boolean;
229
+ intervalMs?: number;
230
+ flushIntervalMs?: number;
231
+ debugLogLevel?: string;
232
+ debugLogMaxEntries?: number;
233
+ };
115
234
  }
235
+ export declare type SanitizedClientOption = string | number | boolean | null | SanitizedClientOption[] | {
236
+ [key: string]: SanitizedClientOption;
237
+ };
116
238
  export interface ICallReportFlushReason {
117
239
  type: 'buffer-limit' | 'manual' | 'socket-close' | 'socket-error';
118
240
  socketClose?: {
@@ -147,7 +269,6 @@ export declare class CallReportCollector {
147
269
  private previousStats;
148
270
  private previousCandidatePairSnapshot;
149
271
  private static readonly INITIAL_COLLECTION_INTERVAL_MS;
150
- private static readonly INITIAL_COLLECTION_DURATION_MS;
151
272
  private readonly MAX_BUFFER_SIZE;
152
273
  private static readonly STATS_FLUSH_THRESHOLD;
153
274
  private static readonly LOGS_FLUSH_THRESHOLD;
@@ -161,6 +282,7 @@ export declare class CallReportCollector {
161
282
  private static readonly THRESHOLD_MOS;
162
283
  private static readonly THRESHOLD_LOCAL_AUDIO_LEVEL;
163
284
  private static readonly CONFIRMED_LOCAL_AUDIO_SILENCE_MS;
285
+ private static readonly THRESHOLD_INBOUND_AUDIO_LEVEL;
164
286
  private _breachCounters;
165
287
  private _activeWarnings;
166
288
  private _lastWarningEmitted;
@@ -199,11 +321,14 @@ export declare class CallReportCollector {
199
321
  private _trackLowLocalAudio;
200
322
  private _resetLowLocalAudioWarning;
201
323
  private _getStatsIntervalDurationMs;
324
+ private _trackLowInboundAudio;
202
325
  private _trackBreach;
203
326
  private _emitWarningOncePerEpisode;
204
327
  private _emitWarning;
205
328
  private _createStatsEntry;
206
329
  private _resolveCandidate;
330
+ private _getCodec;
331
+ private _buildCodecSnapshot;
207
332
  private _getOutboundMediaSource;
208
333
  private _getLocalAudioTrackSnapshot;
209
334
  private _getOutboundAudioSourceStats;
@@ -0,0 +1,11 @@
1
+ export declare class MediaDeviceCollector {
2
+ private _rawDeviceCache;
3
+ private _deviceChangeHandler;
4
+ private _stopped;
5
+ logDevicesAtStart(): Promise<void>;
6
+ stop(): void;
7
+ private _enumerateAudioDevices;
8
+ private _startDeviceChangeListener;
9
+ private _removeDeviceChangeListener;
10
+ private _onDeviceChange;
11
+ }
@@ -40,6 +40,7 @@ export default class Peer {
40
40
  isConnectionHealthy(): boolean;
41
41
  startNegotiation(): void;
42
42
  startTrickleIceNegotiation(): Promise<void>;
43
+ private _emitNegotiationError;
43
44
  private _logTransceivers;
44
45
  private handleSignalingStateChangeEvent;
45
46
  private handleNegotiationNeededEvent;
@@ -8,6 +8,7 @@ declare class VertoHandler {
8
8
  private _ack;
9
9
  private reconnectDelay;
10
10
  handleMessage(msg: any): Promise<void>;
11
+ private isDuplicateGatewayState;
11
12
  private _retrieveCallId;
12
13
  private _handlePvtEvent;
13
14
  private _handleSessionEvent;
@@ -88,6 +88,7 @@ export declare enum GatewayStateType {
88
88
  NOREG = "NOREG",
89
89
  FAILED = "FAILED",
90
90
  FAIL_WAIT = "FAIL_WAIT",
91
+ TIMEOUT = "TIMEOUT",
91
92
  REGISTER = "REGISTER",
92
93
  TRYING = "TRYING",
93
94
  EXPIRED = "EXPIRED",
@@ -9,9 +9,24 @@ declare function hasVideo(sdp: any): boolean;
9
9
  declare const assureDeviceId: (id: string, label: string, kind: MediaDeviceInfo['kind']) => Promise<string>;
10
10
  declare const removeUnsupportedConstraints: (constraints: MediaTrackConstraints) => void;
11
11
  declare const checkDeviceIdConstraints: (id: string, label: string, kind: MediaDeviceInfo['kind'], constraints: MediaTrackConstraints) => Promise<MediaTrackConstraints>;
12
+ declare const getTrackDebugInfo: (track?: MediaStreamTrack | null) => {
13
+ id: string;
14
+ kind: string;
15
+ enabled: boolean;
16
+ muted: boolean;
17
+ readyState: MediaStreamTrackState;
18
+ };
19
+ declare const getStreamTrackDebugInfo: (stream?: MediaStream | null) => {
20
+ id: string;
21
+ kind: string;
22
+ enabled: boolean;
23
+ muted: boolean;
24
+ readyState: MediaStreamTrackState;
25
+ }[];
12
26
  declare const sdpStereoHack: (sdp: string) => string;
13
27
  declare const sdpMediaOrderHack: (answer: string, localOffer: string) => string;
14
- declare const checkSubscribeResponse: (response: any, channel: string) => boolean;
28
+ declare type SubscribeResponse = Record<string, string[] | undefined>;
29
+ declare const checkSubscribeResponse: (response: SubscribeResponse, channel: string) => boolean;
15
30
  declare type DestructuredResult = {
16
31
  subscribed: string[];
17
32
  alreadySubscribed: string[];
@@ -19,7 +34,7 @@ declare type DestructuredResult = {
19
34
  unsubscribed: string[];
20
35
  notSubscribed: string[];
21
36
  };
22
- declare const destructSubscribeResponse: (response: any) => DestructuredResult;
37
+ declare const destructSubscribeResponse: (response: SubscribeResponse) => DestructuredResult;
23
38
  declare const enableAudioTracks: (stream: MediaStream) => void;
24
39
  declare const disableAudioTracks: (stream: MediaStream) => void;
25
40
  declare const toggleAudioTracks: (stream: MediaStream) => void;
@@ -50,4 +65,4 @@ declare const getPreferredCodecs: (preferred_codecs?: RTCRtpCodecCapability[]) =
50
65
  audioCodecs: RTCRtpCodecCapability[];
51
66
  videoCodecs: RTCRtpCodecCapability[];
52
67
  };
53
- export { getUserMedia, getDevices, scanResolutions, getMediaConstraints, assureDeviceId, removeUnsupportedConstraints, checkDeviceIdConstraints, sdpStereoHack, sdpMediaOrderHack, sdpBitrateHack, sdpBitrateASHack, checkSubscribeResponse, destructSubscribeResponse, enableAudioTracks, disableAudioTracks, toggleAudioTracks, isAudioTrackEnabled, enableVideoTracks, disableVideoTracks, toggleVideoTracks, getBrowserInfo, getWebRTCInfo, getWebRTCSupportedBrowserList, createAudio, playAudio, stopAudio, hasVideo, getPreferredCodecs, isDeviceNotFoundError, getConstraintsWithoutDeviceId, };
68
+ export { getUserMedia, getDevices, scanResolutions, getMediaConstraints, assureDeviceId, removeUnsupportedConstraints, checkDeviceIdConstraints, sdpStereoHack, sdpMediaOrderHack, sdpBitrateHack, sdpBitrateASHack, checkSubscribeResponse, destructSubscribeResponse, enableAudioTracks, disableAudioTracks, toggleAudioTracks, isAudioTrackEnabled, enableVideoTracks, disableVideoTracks, toggleVideoTracks, getBrowserInfo, getWebRTCInfo, getWebRTCSupportedBrowserList, createAudio, playAudio, stopAudio, hasVideo, getPreferredCodecs, getTrackDebugInfo, getStreamTrackDebugInfo, isDeviceNotFoundError, getConstraintsWithoutDeviceId, };
@@ -70,6 +70,7 @@ export interface IVertoCallOptions {
70
70
  trickleIce?: boolean;
71
71
  keepConnectionAliveOnSocketClose?: boolean;
72
72
  mutedMicOnStart?: boolean;
73
+ applyDesiredAudioMuteState?: () => void;
73
74
  recoveredCallId?: string;
74
75
  }
75
76
  export interface IStatsBinding {
@@ -33,6 +33,7 @@ export interface IClientOptions {
33
33
  rtcPort?: number;
34
34
  useCanaryRtcServer?: boolean;
35
35
  skipLastVoiceSdkId?: boolean;
36
+ skipTrailing?: boolean;
36
37
  env?: Environment;
37
38
  iceServers?: RTCIceServer[];
38
39
  mutedMicOnStart?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telnyx/webrtc",
3
- "version": "2.27.1",
3
+ "version": "2.27.2-beta.1",
4
4
  "description": "Telnyx WebRTC Client",
5
5
  "keywords": [
6
6
  "telnyx",