@telnyx/webrtc 2.27.2-beta.0 → 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.
@@ -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;
@@ -131,6 +131,11 @@ export default abstract class BaseCall implements IWebRTCCall {
131
131
  private _init;
132
132
  protected _finalize(): void;
133
133
  private _getCallReportVoiceSdkId;
134
+ private _getClientSummary;
135
+ private _getAuthenticationType;
136
+ private _sanitizeIceServers;
137
+ private _sanitizeClientOption;
138
+ private _isSensitiveClientOptionKey;
134
139
  flushIntermediateCallReport(flushReason?: ICallReportFlushReason): void;
135
140
  private _flushIntermediateReport;
136
141
  private _postCallReport;
@@ -1,6 +1,5 @@
1
1
  import BaseCall from './BaseCall';
2
2
  import { IVertoCallOptions } from './interfaces';
3
- import type { FunctionCallOutputItem } from './AIConversationTypes';
4
3
  export declare class Call extends BaseCall {
5
4
  screenShare: Call;
6
5
  private _statsInterval;
@@ -8,7 +7,6 @@ export declare class Call extends BaseCall {
8
7
  startScreenShare(opts?: IVertoCallOptions): Promise<Call>;
9
8
  stopScreenShare(): Promise<void>;
10
9
  sendConversationMessage: (message: string, attachments?: string[]) => Promise<any>;
11
- sendAIConversationMessage: (item: FunctionCallOutputItem) => void;
12
10
  setAudioOutDevice(deviceId: string): Promise<boolean>;
13
11
  protected _finalize(): void;
14
12
  private _stats;
@@ -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;
@@ -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;
@@ -140,9 +140,6 @@ export interface IWebRTCCall {
140
140
  stopScreenShare?: () => Promise<void>;
141
141
  setAudioOutDevice?: (deviceId: string) => Promise<boolean>;
142
142
  setSpeakerPhone?: (flag: boolean) => void;
143
- sendConversationMessage?: (message: string, attachments?: string[]) => void;
144
- sendAIConversationMessage?: (item: import('./AIConversationTypes').FunctionCallOutputItem) => void;
145
- recordSessionWarning?: (code: string, name: string, message: string, activeCallIds?: string[]) => void;
146
143
  }
147
144
  export interface IWebRTCInfo {
148
145
  browserInfo: any;
@@ -9,5 +9,3 @@ export { TELNYX_ERROR_CODES, TELNYX_WARNING_CODES, } from './Modules/Verto/util/
9
9
  export type { ITelnyxError, ITelnyxMediaError, ITelnyxErrorEvent, ITelnyxMediaRecoveryErrorEvent, ITelnyxStandardErrorEvent, TelnyxMediaErrorCode, } from './Modules/Verto/util/errors';
10
10
  export type { ITelnyxWarning, ITelnyxWarningEvent, } from './Modules/Verto/util/constants/warnings';
11
11
  export * from './PreCallDiagnosis';
12
- export type { FunctionCallItem, FunctionCallOutputItem, AIConversationParams, AIConversationFunctionCallParams, AIConversationFunctionCallOutputParams, IAIConversationMessageEvent, ISendAIConversationMessageOptions, } from './Modules/Verto/webrtc/AIConversationTypes';
13
- export { isFunctionCallParams, isFunctionCallOutputParams, } from './Modules/Verto/webrtc/AIConversationTypes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telnyx/webrtc",
3
- "version": "2.27.2-beta.0",
3
+ "version": "2.27.2-beta.1",
4
4
  "description": "Telnyx WebRTC Client",
5
5
  "keywords": [
6
6
  "telnyx",
@@ -1,6 +0,0 @@
1
- import BaseMessage from '../BaseMessage';
2
- import type { FunctionCallOutputItem } from '../../webrtc/AIConversationTypes';
3
- declare class AIConversationMessage extends BaseMessage {
4
- constructor(item: FunctionCallOutputItem);
5
- }
6
- export { AIConversationMessage };
@@ -1,33 +0,0 @@
1
- export declare type FunctionCallItem = {
2
- type: 'function_call';
3
- call_id: string;
4
- name: string;
5
- arguments: string;
6
- };
7
- export declare type FunctionCallOutputItem = {
8
- type: 'function_call_output';
9
- call_id: string;
10
- output: string;
11
- };
12
- export declare type AIConversationFunctionCallParams = {
13
- type: 'conversation.item.created';
14
- item: FunctionCallItem;
15
- };
16
- export declare type AIConversationFunctionCallOutputParams = {
17
- type: 'conversation.item.create';
18
- item: FunctionCallOutputItem;
19
- };
20
- export declare type AIConversationParams = AIConversationFunctionCallParams | AIConversationFunctionCallOutputParams | {
21
- type: string;
22
- [key: string]: unknown;
23
- };
24
- export declare type IAIConversationMessageEvent = {
25
- method: 'ai_conversation';
26
- params: AIConversationParams;
27
- voice_sdk_id?: string;
28
- };
29
- export declare type ISendAIConversationMessageOptions = {
30
- item: FunctionCallOutputItem;
31
- };
32
- export declare function isFunctionCallParams(params: AIConversationParams): params is AIConversationFunctionCallParams;
33
- export declare function isFunctionCallOutputParams(params: AIConversationParams): params is AIConversationFunctionCallOutputParams;