@telnyx/webrtc 2.26.1-beta.4 → 2.26.2
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/BaseSession.d.ts +10 -0
- package/lib/src/Modules/Verto/BrowserSession.d.ts +1 -0
- package/lib/src/Modules/Verto/util/constants/errorCodes.d.ts +40 -35
- package/lib/src/Modules/Verto/util/constants/errors.d.ts +7 -0
- package/lib/src/Modules/Verto/util/constants/warnings.d.ts +5 -0
- package/lib/src/Modules/Verto/util/errors.d.ts +23 -2
- package/lib/src/Modules/Verto/util/interfaces.d.ts +6 -1
- package/lib/src/Modules/Verto/webrtc/BaseCall.d.ts +0 -1
- package/lib/src/Modules/Verto/webrtc/interfaces.d.ts +0 -1
- package/lib/src/index.d.ts +4 -2
- package/lib/src/utils/interfaces.d.ts +6 -0
- package/package.json +2 -2
- package/lib/src/Modules/Verto/webrtc/CandidateFilter.d.ts +0 -14
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Logger } from 'loglevel';
|
|
2
2
|
import BaseMessage from './messages/BaseMessage';
|
|
3
3
|
import Connection from './services/Connection';
|
|
4
|
+
import { SwEvent } from './util/constants';
|
|
5
|
+
import type { ITelnyxErrorEvent } from './util/errors';
|
|
4
6
|
import { BroadcastParams, ILoginParams, IVertoOptions } from './util/interfaces';
|
|
7
|
+
import type { INotification } from '../../utils/interfaces';
|
|
8
|
+
import type { ITelnyxWarningEvent } from './util/constants/warnings';
|
|
5
9
|
export default abstract class BaseSession {
|
|
6
10
|
options: IVertoOptions;
|
|
7
11
|
uuid: string;
|
|
@@ -41,7 +45,13 @@ export default abstract class BaseSession {
|
|
|
41
45
|
validateOptions(): boolean;
|
|
42
46
|
broadcast(_params: BroadcastParams): void;
|
|
43
47
|
disconnect(): Promise<void>;
|
|
48
|
+
on(eventName: SwEvent.Error | 'telnyx.error', callback: (event: ITelnyxErrorEvent) => void): this;
|
|
49
|
+
on(eventName: SwEvent.Warning | 'telnyx.warning', callback: (event: ITelnyxWarningEvent) => void): this;
|
|
50
|
+
on(eventName: SwEvent.Notification | 'telnyx.notification', callback: (event: INotification) => void): this;
|
|
44
51
|
on(eventName: string, callback: Function): this;
|
|
52
|
+
off(eventName: SwEvent.Error | 'telnyx.error', callback?: (event: ITelnyxErrorEvent) => void): this;
|
|
53
|
+
off(eventName: SwEvent.Warning | 'telnyx.warning', callback?: (event: ITelnyxWarningEvent) => void): this;
|
|
54
|
+
off(eventName: SwEvent.Notification | 'telnyx.notification', callback?: (event: INotification) => void): this;
|
|
45
55
|
off(eventName: string, callback?: Function): this;
|
|
46
56
|
connect(): Promise<void>;
|
|
47
57
|
protected _handleLoginError(error: any): void;
|
|
@@ -31,6 +31,7 @@ export default abstract class BrowserSession extends BaseSession {
|
|
|
31
31
|
checkPermissions(audio?: boolean, video?: boolean): Promise<boolean>;
|
|
32
32
|
logout(): void;
|
|
33
33
|
disconnect(): Promise<void>;
|
|
34
|
+
serverDisconnect(): Promise<void>;
|
|
34
35
|
socketDisconnect(): void;
|
|
35
36
|
handleLoginError(error: any): void;
|
|
36
37
|
speedTest(bytes: number): Promise<unknown>;
|
|
@@ -1,36 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export declare const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
export declare const TELNYX_ERROR_CODES: {
|
|
2
|
+
readonly SDP_CREATE_OFFER_FAILED: 40001;
|
|
3
|
+
readonly SDP_CREATE_ANSWER_FAILED: 40002;
|
|
4
|
+
readonly SDP_SET_LOCAL_DESCRIPTION_FAILED: 40003;
|
|
5
|
+
readonly SDP_SET_REMOTE_DESCRIPTION_FAILED: 40004;
|
|
6
|
+
readonly SDP_SEND_FAILED: 40005;
|
|
7
|
+
readonly MEDIA_MICROPHONE_PERMISSION_DENIED: 42001;
|
|
8
|
+
readonly MEDIA_DEVICE_NOT_FOUND: 42002;
|
|
9
|
+
readonly MEDIA_GET_USER_MEDIA_FAILED: 42003;
|
|
10
|
+
readonly HOLD_FAILED: 44001;
|
|
11
|
+
readonly INVALID_CALL_PARAMETERS: 44002;
|
|
12
|
+
readonly BYE_SEND_FAILED: 44003;
|
|
13
|
+
readonly SUBSCRIBE_FAILED: 44004;
|
|
14
|
+
readonly WEBSOCKET_CONNECTION_FAILED: 45001;
|
|
15
|
+
readonly WEBSOCKET_ERROR: 45002;
|
|
16
|
+
readonly RECONNECTION_EXHAUSTED: 45003;
|
|
17
|
+
readonly GATEWAY_FAILED: 45004;
|
|
18
|
+
readonly LOGIN_FAILED: 46001;
|
|
19
|
+
readonly INVALID_CREDENTIALS: 46002;
|
|
20
|
+
readonly AUTHENTICATION_REQUIRED: 46003;
|
|
21
|
+
readonly NETWORK_OFFLINE: 48001;
|
|
22
|
+
readonly UNEXPECTED_ERROR: 49001;
|
|
23
|
+
};
|
|
24
|
+
export declare const TELNYX_WARNING_CODES: {
|
|
25
|
+
readonly HIGH_RTT: 31001;
|
|
26
|
+
readonly HIGH_JITTER: 31002;
|
|
27
|
+
readonly HIGH_PACKET_LOSS: 31003;
|
|
28
|
+
readonly LOW_MOS: 31004;
|
|
29
|
+
readonly LOW_BYTES_RECEIVED: 32001;
|
|
30
|
+
readonly LOW_BYTES_SENT: 32002;
|
|
31
|
+
readonly ICE_CONNECTIVITY_LOST: 33001;
|
|
32
|
+
readonly ICE_GATHERING_TIMEOUT: 33002;
|
|
33
|
+
readonly ICE_GATHERING_EMPTY: 33003;
|
|
34
|
+
readonly PEER_CONNECTION_FAILED: 33004;
|
|
35
|
+
readonly ONLY_HOST_ICE_CANDIDATES: 33005;
|
|
36
|
+
readonly TOKEN_EXPIRING_SOON: 34001;
|
|
37
|
+
readonly SESSION_NOT_REATTACHED: 35001;
|
|
38
|
+
};
|
|
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;
|
|
36
41
|
export declare const HAS_NON_HOST_ICE_CANDIDATE_REGEX: RegExp;
|
|
@@ -139,5 +139,12 @@ export declare const SDK_ERRORS: {
|
|
|
139
139
|
readonly causes: readonly ["Wi-Fi or ethernet disconnected", "Airplane mode enabled", "Network interface went down"];
|
|
140
140
|
readonly solutions: readonly ["Check network connectivity", "Reconnect to Wi-Fi or ethernet", "Disable airplane mode"];
|
|
141
141
|
};
|
|
142
|
+
readonly 49001: {
|
|
143
|
+
readonly name: "UNEXPECTED_ERROR";
|
|
144
|
+
readonly message: "An unexpected error occurred";
|
|
145
|
+
readonly description: "An error was thrown that does not match any known SDK error category. This is a catch-all for unclassified failures.";
|
|
146
|
+
readonly causes: readonly ["Unknown or unhandled error condition"];
|
|
147
|
+
readonly solutions: readonly ["Check the originalError property for the underlying cause", "Report the issue if it persists"];
|
|
148
|
+
};
|
|
142
149
|
};
|
|
143
150
|
export declare type SdkErrorCode = keyof typeof SDK_ERRORS;
|
|
@@ -6,6 +6,11 @@ export interface ITelnyxWarning {
|
|
|
6
6
|
causes: string[];
|
|
7
7
|
solutions: string[];
|
|
8
8
|
}
|
|
9
|
+
export interface ITelnyxWarningEvent {
|
|
10
|
+
warning: ITelnyxWarning;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
callId?: string;
|
|
13
|
+
}
|
|
9
14
|
export declare const SDK_WARNINGS: {
|
|
10
15
|
readonly 31001: {
|
|
11
16
|
readonly name: "HIGH_RTT";
|
|
@@ -3,8 +3,9 @@ import { SDK_WARNINGS, SdkWarningCode, ITelnyxWarning, createTelnyxWarning } fro
|
|
|
3
3
|
import { MEDIA_MICROPHONE_PERMISSION_DENIED, MEDIA_DEVICE_NOT_FOUND, MEDIA_GET_USER_MEDIA_FAILED } from './constants/errorCodes';
|
|
4
4
|
export { SDK_ERRORS, SdkErrorCode };
|
|
5
5
|
export { SDK_WARNINGS, SdkWarningCode, ITelnyxWarning, createTelnyxWarning };
|
|
6
|
+
export declare type TelnyxMediaErrorCode = typeof MEDIA_MICROPHONE_PERMISSION_DENIED | typeof MEDIA_DEVICE_NOT_FOUND | typeof MEDIA_GET_USER_MEDIA_FAILED;
|
|
6
7
|
export interface ITelnyxError {
|
|
7
|
-
code:
|
|
8
|
+
code: SdkErrorCode;
|
|
8
9
|
name: string;
|
|
9
10
|
description: string;
|
|
10
11
|
message: string;
|
|
@@ -12,8 +13,27 @@ export interface ITelnyxError {
|
|
|
12
13
|
solutions: string[];
|
|
13
14
|
originalError?: unknown;
|
|
14
15
|
}
|
|
16
|
+
export interface ITelnyxMediaError extends Omit<ITelnyxError, 'code'> {
|
|
17
|
+
code: TelnyxMediaErrorCode;
|
|
18
|
+
}
|
|
19
|
+
export interface ITelnyxStandardErrorEvent {
|
|
20
|
+
error: ITelnyxError;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
callId?: string;
|
|
23
|
+
recoverable?: false;
|
|
24
|
+
}
|
|
25
|
+
export interface ITelnyxMediaRecoveryErrorEvent {
|
|
26
|
+
error: ITelnyxMediaError;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
callId: string;
|
|
29
|
+
recoverable: true;
|
|
30
|
+
retryDeadline: number;
|
|
31
|
+
resume: () => void;
|
|
32
|
+
reject: () => void;
|
|
33
|
+
}
|
|
34
|
+
export declare type ITelnyxErrorEvent = ITelnyxStandardErrorEvent | ITelnyxMediaRecoveryErrorEvent;
|
|
15
35
|
export declare class TelnyxError extends Error implements ITelnyxError {
|
|
16
|
-
readonly code:
|
|
36
|
+
readonly code: SdkErrorCode;
|
|
17
37
|
readonly description: string;
|
|
18
38
|
readonly causes: string[];
|
|
19
39
|
readonly solutions: string[];
|
|
@@ -23,5 +43,6 @@ export declare class TelnyxError extends Error implements ITelnyxError {
|
|
|
23
43
|
});
|
|
24
44
|
toJSON(): ITelnyxError;
|
|
25
45
|
}
|
|
46
|
+
export declare function isMediaRecoveryErrorEvent(event: ITelnyxErrorEvent): event is ITelnyxMediaRecoveryErrorEvent;
|
|
26
47
|
export declare function classifyMediaErrorCode(error: unknown): typeof MEDIA_MICROPHONE_PERMISSION_DENIED | typeof MEDIA_DEVICE_NOT_FOUND | typeof MEDIA_GET_USER_MEDIA_FAILED;
|
|
27
48
|
export declare function createTelnyxError(code: SdkErrorCode, originalError?: unknown, message?: string): TelnyxError;
|
|
@@ -21,7 +21,6 @@ export interface IVertoOptions {
|
|
|
21
21
|
prefetchIceCandidates?: boolean;
|
|
22
22
|
forceRelayCandidate?: boolean;
|
|
23
23
|
trickleIce?: boolean;
|
|
24
|
-
singleInterfaceIce?: boolean;
|
|
25
24
|
keepConnectionAliveOnSocketClose?: boolean;
|
|
26
25
|
useCanaryRtcServer?: boolean;
|
|
27
26
|
region?: string;
|
|
@@ -38,6 +37,12 @@ export interface IVertoOptions {
|
|
|
38
37
|
callReportInterval?: number;
|
|
39
38
|
debugLogLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
40
39
|
debugLogMaxEntries?: number;
|
|
40
|
+
mediaPermissionsRecovery?: {
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
timeout: number;
|
|
43
|
+
onSuccess?: () => void;
|
|
44
|
+
onError?: (error: Error) => void;
|
|
45
|
+
};
|
|
41
46
|
}
|
|
42
47
|
export interface ILoginParams {
|
|
43
48
|
login?: string;
|
|
@@ -43,7 +43,6 @@ export default abstract class BaseCall implements IWebRTCCall {
|
|
|
43
43
|
private _firstCandidateSent;
|
|
44
44
|
private _firstNonHostCandidateSent;
|
|
45
45
|
private _isRecovering;
|
|
46
|
-
private _candidateFilter;
|
|
47
46
|
constructor(session: BrowserSession, opts?: IVertoCallOptions);
|
|
48
47
|
get nodeId(): string;
|
|
49
48
|
set nodeId(what: string);
|
|
@@ -66,7 +66,6 @@ export interface IVertoCallOptions {
|
|
|
66
66
|
prefetchIceCandidates?: boolean;
|
|
67
67
|
forceRelayCandidate?: boolean;
|
|
68
68
|
trickleIce?: boolean;
|
|
69
|
-
singleInterfaceIce?: boolean;
|
|
70
69
|
keepConnectionAliveOnSocketClose?: boolean;
|
|
71
70
|
mutedMicOnStart?: boolean;
|
|
72
71
|
recoveredCallId?: string;
|
package/lib/src/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { SwEvent } from './Modules/Verto/util/constants';
|
|
|
4
4
|
import { NOTIFICATION_TYPE, ERROR_TYPE } from './Modules/Verto/webrtc/constants';
|
|
5
5
|
import Call from './Modules/Verto/webrtc/Call';
|
|
6
6
|
export { Call, TelnyxRTC, IClientOptions, ICallOptions, ICredentials, INotification, SwEvent, NOTIFICATION_TYPE, ERROR_TYPE, };
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export { SDK_ERRORS, SDK_WARNINGS, TelnyxError, isMediaRecoveryErrorEvent, } from './Modules/Verto/util/errors';
|
|
8
|
+
export { TELNYX_ERROR_CODES, TELNYX_WARNING_CODES, } from './Modules/Verto/util/constants/errorCodes';
|
|
9
|
+
export type { ITelnyxError, ITelnyxMediaError, ITelnyxErrorEvent, ITelnyxMediaRecoveryErrorEvent, ITelnyxStandardErrorEvent, TelnyxMediaErrorCode, } from './Modules/Verto/util/errors';
|
|
10
|
+
export type { ITelnyxWarning, ITelnyxWarningEvent, } from './Modules/Verto/util/constants/warnings';
|
|
9
11
|
export * from './PreCallDiagnosis';
|
|
@@ -36,6 +36,12 @@ export interface IClientOptions {
|
|
|
36
36
|
mutedMicOnStart?: boolean;
|
|
37
37
|
enableCallReports?: boolean;
|
|
38
38
|
callReportInterval?: number;
|
|
39
|
+
mediaPermissionsRecovery?: {
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
timeout: number;
|
|
42
|
+
onSuccess?: () => void;
|
|
43
|
+
onError?: (error: Error) => void;
|
|
44
|
+
};
|
|
39
45
|
}
|
|
40
46
|
export interface ICallOptions {
|
|
41
47
|
destinationNumber?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telnyx/webrtc",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.2",
|
|
4
4
|
"description": "Telnyx WebRTC Client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telnyx",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"main": "lib/bundle.js",
|
|
17
17
|
"module": "lib/bundle.mjs",
|
|
18
|
-
"types": "lib/
|
|
18
|
+
"types": "lib/src/index.d.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"lib",
|
|
21
21
|
"README.md"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare class CandidateFilter {
|
|
2
|
-
private _lockedInterface;
|
|
3
|
-
private _enabled;
|
|
4
|
-
private _onCandidate;
|
|
5
|
-
private _onEndOfCandidates;
|
|
6
|
-
private _filteredCount;
|
|
7
|
-
private _passedCount;
|
|
8
|
-
constructor(enabled: boolean, onCandidate: (candidate: RTCIceCandidate) => void, onEndOfCandidates: () => void);
|
|
9
|
-
add(event: RTCPeerConnectionIceEvent): void;
|
|
10
|
-
reset(): void;
|
|
11
|
-
private _extractRaddr;
|
|
12
|
-
private _extractNetworkId;
|
|
13
|
-
private _isTcpCandidate;
|
|
14
|
-
}
|