@telnyx/webrtc 2.26.3 → 2.27.0-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.
- package/lib/bundle.js +1 -1
- package/lib/bundle.mjs +1 -1
- package/lib/src/Modules/Verto/util/constants/errorCodes.d.ts +5 -2
- package/lib/src/Modules/Verto/util/constants/errors.d.ts +14 -0
- package/lib/src/Modules/Verto/util/constants/warnings.d.ts +7 -0
- package/lib/src/Modules/Verto/util/interfaces.d.ts +1 -0
- package/lib/src/Modules/Verto/webrtc/BaseCall.d.ts +3 -2
- package/lib/src/Modules/Verto/webrtc/CallReportCollector.d.ts +38 -0
- package/lib/src/Modules/Verto/webrtc/Peer.d.ts +7 -0
- package/lib/src/Modules/Verto/webrtc/constants.d.ts +6 -0
- package/lib/src/Modules/Verto/webrtc/interfaces.d.ts +1 -0
- package/lib/src/utils/interfaces.d.ts +1 -0
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export declare const TELNYX_ERROR_CODES: {
|
|
|
11
11
|
readonly INVALID_CALL_PARAMETERS: 44002;
|
|
12
12
|
readonly BYE_SEND_FAILED: 44003;
|
|
13
13
|
readonly SUBSCRIBE_FAILED: 44004;
|
|
14
|
+
readonly PEER_CLOSED_DURING_INIT: 44005;
|
|
14
15
|
readonly WEBSOCKET_CONNECTION_FAILED: 45001;
|
|
15
16
|
readonly WEBSOCKET_ERROR: 45002;
|
|
16
17
|
readonly RECONNECTION_EXHAUSTED: 45003;
|
|
@@ -18,6 +19,7 @@ export declare const TELNYX_ERROR_CODES: {
|
|
|
18
19
|
readonly LOGIN_FAILED: 46001;
|
|
19
20
|
readonly INVALID_CREDENTIALS: 46002;
|
|
20
21
|
readonly AUTHENTICATION_REQUIRED: 46003;
|
|
22
|
+
readonly ICE_RESTART_FAILED: 47001;
|
|
21
23
|
readonly NETWORK_OFFLINE: 48001;
|
|
22
24
|
readonly UNEXPECTED_ERROR: 49001;
|
|
23
25
|
};
|
|
@@ -33,9 +35,10 @@ export declare const TELNYX_WARNING_CODES: {
|
|
|
33
35
|
readonly ICE_GATHERING_EMPTY: 33003;
|
|
34
36
|
readonly PEER_CONNECTION_FAILED: 33004;
|
|
35
37
|
readonly ONLY_HOST_ICE_CANDIDATES: 33005;
|
|
38
|
+
readonly ANSWER_WHILE_PEER_ACTIVE: 33006;
|
|
36
39
|
readonly TOKEN_EXPIRING_SOON: 34001;
|
|
37
40
|
readonly SESSION_NOT_REATTACHED: 35001;
|
|
38
41
|
};
|
|
39
|
-
export declare const SDP_CREATE_OFFER_FAILED: 40001, SDP_CREATE_ANSWER_FAILED: 40002, SDP_SET_LOCAL_DESCRIPTION_FAILED: 40003, SDP_SET_REMOTE_DESCRIPTION_FAILED: 40004, SDP_SEND_FAILED: 40005, MEDIA_MICROPHONE_PERMISSION_DENIED: 42001, MEDIA_DEVICE_NOT_FOUND: 42002, MEDIA_GET_USER_MEDIA_FAILED: 42003, HOLD_FAILED: 44001, INVALID_CALL_PARAMETERS: 44002, BYE_SEND_FAILED: 44003, SUBSCRIBE_FAILED: 44004, WEBSOCKET_CONNECTION_FAILED: 45001, WEBSOCKET_ERROR: 45002, RECONNECTION_EXHAUSTED: 45003, GATEWAY_FAILED: 45004, LOGIN_FAILED: 46001, INVALID_CREDENTIALS: 46002, AUTHENTICATION_REQUIRED: 46003, NETWORK_OFFLINE: 48001, UNEXPECTED_ERROR: 49001;
|
|
40
|
-
export declare const HIGH_RTT: 31001, HIGH_JITTER: 31002, HIGH_PACKET_LOSS: 31003, LOW_MOS: 31004, LOW_BYTES_RECEIVED: 32001, LOW_BYTES_SENT: 32002, ICE_CONNECTIVITY_LOST: 33001, ICE_GATHERING_TIMEOUT: 33002, ICE_GATHERING_EMPTY: 33003, PEER_CONNECTION_FAILED: 33004, ONLY_HOST_ICE_CANDIDATES: 33005, TOKEN_EXPIRING_SOON: 34001, SESSION_NOT_REATTACHED: 35001;
|
|
42
|
+
export declare const SDP_CREATE_OFFER_FAILED: 40001, SDP_CREATE_ANSWER_FAILED: 40002, SDP_SET_LOCAL_DESCRIPTION_FAILED: 40003, SDP_SET_REMOTE_DESCRIPTION_FAILED: 40004, SDP_SEND_FAILED: 40005, MEDIA_MICROPHONE_PERMISSION_DENIED: 42001, MEDIA_DEVICE_NOT_FOUND: 42002, MEDIA_GET_USER_MEDIA_FAILED: 42003, HOLD_FAILED: 44001, INVALID_CALL_PARAMETERS: 44002, BYE_SEND_FAILED: 44003, SUBSCRIBE_FAILED: 44004, PEER_CLOSED_DURING_INIT: 44005, WEBSOCKET_CONNECTION_FAILED: 45001, WEBSOCKET_ERROR: 45002, RECONNECTION_EXHAUSTED: 45003, GATEWAY_FAILED: 45004, LOGIN_FAILED: 46001, INVALID_CREDENTIALS: 46002, AUTHENTICATION_REQUIRED: 46003, ICE_RESTART_FAILED: 47001, NETWORK_OFFLINE: 48001, UNEXPECTED_ERROR: 49001;
|
|
43
|
+
export declare const HIGH_RTT: 31001, HIGH_JITTER: 31002, HIGH_PACKET_LOSS: 31003, LOW_MOS: 31004, LOW_BYTES_RECEIVED: 32001, LOW_BYTES_SENT: 32002, ICE_CONNECTIVITY_LOST: 33001, ICE_GATHERING_TIMEOUT: 33002, ICE_GATHERING_EMPTY: 33003, PEER_CONNECTION_FAILED: 33004, ONLY_HOST_ICE_CANDIDATES: 33005, ANSWER_WHILE_PEER_ACTIVE: 33006, TOKEN_EXPIRING_SOON: 34001, SESSION_NOT_REATTACHED: 35001;
|
|
41
44
|
export declare const HAS_NON_HOST_ICE_CANDIDATE_REGEX: RegExp;
|
|
@@ -55,6 +55,13 @@ export declare const SDK_ERRORS: {
|
|
|
55
55
|
readonly causes: readonly ["Browser error", "Device in use by another application"];
|
|
56
56
|
readonly solutions: readonly ["Close other applications using the microphone", "Retry"];
|
|
57
57
|
};
|
|
58
|
+
readonly 44005: {
|
|
59
|
+
readonly name: "PEER_CLOSED_DURING_INIT";
|
|
60
|
+
readonly message: "Call was closed during setup";
|
|
61
|
+
readonly description: "The PeerConnection was closed (e.g. by hangup()) while peer.init() was still running. This is a race condition: an async operation such as setRemoteDescription, getUserMedia, or the media recovery flow yielded control, and close() ran during that gap. The init() cannot continue because the underlying RTCPeerConnection has been destroyed.";
|
|
62
|
+
readonly causes: readonly ["call.hangup() or call.close() was called while the call was still setting up", "A WebSocket Bye message arrived during getUserMedia prompt or SDP negotiation", "User clicked hangup/decline before media permissions were granted"];
|
|
63
|
+
readonly solutions: readonly ["This is expected if the user intentionally hung up during setup — no action needed", "If this happens frequently without user action, check for automatic hangup triggers that may fire too early"];
|
|
64
|
+
};
|
|
58
65
|
readonly 44001: {
|
|
59
66
|
readonly name: "HOLD_FAILED";
|
|
60
67
|
readonly message: "Failed to hold the call";
|
|
@@ -132,6 +139,13 @@ export declare const SDK_ERRORS: {
|
|
|
132
139
|
readonly causes: readonly ["Message sent before login completed", "Authentication token expired during the session", "Server-side session was invalidated", "WebSocket reconnected but re-authentication did not complete"];
|
|
133
140
|
readonly solutions: readonly ["Ensure the client is fully logged in before sending messages", "Re-authenticate using client.login() with fresh credentials", "Listen for telnyx.ready before making calls or sending requests"];
|
|
134
141
|
};
|
|
142
|
+
readonly 47001: {
|
|
143
|
+
readonly name: "ICE_RESTART_FAILED";
|
|
144
|
+
readonly message: "ICE restart failed";
|
|
145
|
+
readonly description: "The ICE restart Modify request could not be sent or the server returned an error. The media path could not be recovered via ICE restart.";
|
|
146
|
+
readonly causes: readonly ["WebSocket connection lost during ICE restart", "Server rejected the Modify request", "Timeout waiting for server response"];
|
|
147
|
+
readonly solutions: readonly ["The call may recover via WebSocket reconnect + Attach", "If the call does not recover, hang up and retry"];
|
|
148
|
+
};
|
|
135
149
|
readonly 48001: {
|
|
136
150
|
readonly name: "NETWORK_OFFLINE";
|
|
137
151
|
readonly message: "Device is offline";
|
|
@@ -89,6 +89,13 @@ export declare const SDK_WARNINGS: {
|
|
|
89
89
|
readonly causes: readonly ["STUN/TURN servers unreachable", "Firewall blocking UDP traffic to STUN/TURN servers", "Incorrect TURN server configuration or credentials", "Restrictive corporate network or VPN"];
|
|
90
90
|
readonly solutions: readonly ["Verify STUN/TURN server URLs and credentials", "Ensure UDP traffic to STUN/TURN ports is not blocked", "Check firewall or VPN settings", "Try using TCP-based TURN as a fallback"];
|
|
91
91
|
};
|
|
92
|
+
readonly 33006: {
|
|
93
|
+
readonly name: "ANSWER_WHILE_PEER_ACTIVE";
|
|
94
|
+
readonly message: "Call answer ignored because a peer connection is already active";
|
|
95
|
+
readonly description: "answer() was called on a call that already has an active or connecting peer connection. Creating a second peer connection for the same call would duplicate media negotiation, confuse the remote party, and break call reporting. This is typically caused by application code invoking answer() multiple times (e.g. from multiple event handlers).";
|
|
96
|
+
readonly causes: readonly ["Application called answer() twice on the same call object", "Multiple click handlers or event listeners triggering answer()"];
|
|
97
|
+
readonly solutions: readonly ["Ensure answer() is called only once per call", "Disable the answer button after the first click", "Check that answer() is not invoked from multiple event handlers"];
|
|
98
|
+
};
|
|
92
99
|
readonly 34001: {
|
|
93
100
|
readonly name: "TOKEN_EXPIRING_SOON";
|
|
94
101
|
readonly message: "Authentication token expiring soon";
|
|
@@ -31,7 +31,6 @@ export default abstract class BaseCall implements IWebRTCCall {
|
|
|
31
31
|
private _lastSerno;
|
|
32
32
|
private _targetNodeId;
|
|
33
33
|
private _iceTimeout;
|
|
34
|
-
private _iceDone;
|
|
35
34
|
private _ringtone;
|
|
36
35
|
private _ringback;
|
|
37
36
|
private _statsBindings;
|
|
@@ -43,6 +42,7 @@ export default abstract class BaseCall implements IWebRTCCall {
|
|
|
43
42
|
private _firstCandidateSent;
|
|
44
43
|
private _firstNonHostCandidateSent;
|
|
45
44
|
private _isRecovering;
|
|
45
|
+
private _captureHangupCallerStack;
|
|
46
46
|
constructor(session: BrowserSession, opts?: IVertoCallOptions);
|
|
47
47
|
get nodeId(): string;
|
|
48
48
|
set nodeId(what: string);
|
|
@@ -93,6 +93,8 @@ export default abstract class BaseCall implements IWebRTCCall {
|
|
|
93
93
|
private _confControl;
|
|
94
94
|
private _handleChangeHoldStateSuccess;
|
|
95
95
|
private _handleChangeHoldStateError;
|
|
96
|
+
private _sendIceRestartModify;
|
|
97
|
+
private _onIceRestartFailed;
|
|
96
98
|
private _onRemoteSdp;
|
|
97
99
|
private _requestAnotherLocalDescription;
|
|
98
100
|
private _onIceSdp;
|
|
@@ -107,7 +109,6 @@ export default abstract class BaseCall implements IWebRTCCall {
|
|
|
107
109
|
private _resetTrickleIceCandidateState;
|
|
108
110
|
private _flushPendingTrickleIceCandidates;
|
|
109
111
|
private _registerPeerEvents;
|
|
110
|
-
private _registerTrickleIcePeerEvents;
|
|
111
112
|
private _checkConferenceSerno;
|
|
112
113
|
private _onMediaError;
|
|
113
114
|
private _onPeerConnectionFailureError;
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import { ILogEntry } from '../../../Modules/Verto/util/LogCollector';
|
|
2
2
|
import { type ITelnyxWarning } from '../../../Modules/Verto/util/errors';
|
|
3
|
+
export interface ILocalAudioTrackSnapshot {
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
muted?: boolean;
|
|
8
|
+
readyState?: MediaStreamTrackState;
|
|
9
|
+
contentHint?: string;
|
|
10
|
+
settings?: {
|
|
11
|
+
deviceId?: string;
|
|
12
|
+
groupId?: string;
|
|
13
|
+
channelCount?: number;
|
|
14
|
+
sampleRate?: number;
|
|
15
|
+
sampleSize?: number;
|
|
16
|
+
latency?: number;
|
|
17
|
+
echoCancellation?: boolean;
|
|
18
|
+
noiseSuppression?: boolean;
|
|
19
|
+
autoGainControl?: boolean;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface ILocalAudioSourceStats {
|
|
23
|
+
id?: string;
|
|
24
|
+
trackIdentifier?: string;
|
|
25
|
+
audioLevel?: number;
|
|
26
|
+
totalAudioEnergy?: number;
|
|
27
|
+
totalSamplesDuration?: number;
|
|
28
|
+
echoReturnLoss?: number;
|
|
29
|
+
echoReturnLossEnhancement?: number;
|
|
30
|
+
}
|
|
3
31
|
interface ICECandidateInfo {
|
|
4
32
|
address?: string;
|
|
5
33
|
port?: number;
|
|
@@ -42,6 +70,8 @@ export interface IStatsInterval {
|
|
|
42
70
|
bytesSent?: number;
|
|
43
71
|
audioLevelAvg?: number;
|
|
44
72
|
bitrateAvg?: number;
|
|
73
|
+
localTrack?: ILocalAudioTrackSnapshot;
|
|
74
|
+
mediaSource?: ILocalAudioSourceStats;
|
|
45
75
|
};
|
|
46
76
|
inbound?: {
|
|
47
77
|
packetsReceived?: number;
|
|
@@ -120,6 +150,7 @@ export declare class CallReportCollector {
|
|
|
120
150
|
private static readonly WARNING_THROTTLE_MS;
|
|
121
151
|
private _prevPacketsReceived;
|
|
122
152
|
private _prevPacketsLost;
|
|
153
|
+
private _lastLocalAudioTrackSnapshotJson;
|
|
123
154
|
private _segmentIndex;
|
|
124
155
|
private _flushing;
|
|
125
156
|
private static readonly RETRY_DELAY_MS;
|
|
@@ -138,6 +169,13 @@ export declare class CallReportCollector {
|
|
|
138
169
|
private _trackBreach;
|
|
139
170
|
private _createStatsEntry;
|
|
140
171
|
private _resolveCandidate;
|
|
172
|
+
private _getOutboundMediaSource;
|
|
173
|
+
private _getLocalAudioTrackSnapshot;
|
|
174
|
+
private _getOutboundAudioSourceStats;
|
|
175
|
+
private _logLocalAudioTrackSnapshot;
|
|
176
|
+
private _withoutUndefined;
|
|
177
|
+
private _stableStringify;
|
|
178
|
+
private _sortObjectKeys;
|
|
141
179
|
private _getOutboundAudioLevel;
|
|
142
180
|
private _getInboundAudioLevel;
|
|
143
181
|
private _computeAudioLevelFromEnergy;
|
|
@@ -8,6 +8,8 @@ export default class Peer {
|
|
|
8
8
|
instance: RTCPeerConnection;
|
|
9
9
|
onSdpReadyTwice: ((data: RTCSessionDescription) => void) | null;
|
|
10
10
|
statsReporter: WebRTCStatsReporter | null;
|
|
11
|
+
isIceRestarting: boolean;
|
|
12
|
+
iceDone: boolean;
|
|
11
13
|
private _constraints;
|
|
12
14
|
private _session;
|
|
13
15
|
private _negotiating;
|
|
@@ -21,7 +23,12 @@ export default class Peer {
|
|
|
21
23
|
private static readonly ICE_GATHERING_SAFETY_TIMEOUT_MS;
|
|
22
24
|
private _firstMediaTrackMarked;
|
|
23
25
|
private _timingsCollected;
|
|
26
|
+
private _iceRestartTimeoutId;
|
|
27
|
+
private static readonly ICE_RESTART_TIMEOUT_MS;
|
|
28
|
+
private _hadOfflineEvent;
|
|
29
|
+
private _offlineHandler;
|
|
24
30
|
constructor(type: PeerType, options: IVertoCallOptions, session: BrowserSession, trickleIceSdpFn: (sdp: RTCSessionDescriptionInit) => void, registerPeerEvents: (instance: RTCPeerConnection) => void);
|
|
31
|
+
finishIceRestart(): void;
|
|
25
32
|
get isOffer(): boolean;
|
|
26
33
|
get isAnswer(): boolean;
|
|
27
34
|
get isDebugEnabled(): boolean;
|