@telnyx/webrtc 2.27.4-beta.2 → 2.27.4

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.
@@ -19,7 +19,9 @@ export default abstract class BrowserSession extends BaseSession {
19
19
  ringbackFile?: string;
20
20
  private _iceServers;
21
21
  private _localElement;
22
+ private _localElementId;
22
23
  private _remoteElement;
24
+ private _remoteElementId;
23
25
  protected _jwtAuth: boolean;
24
26
  protected _audioConstraints: boolean | MediaTrackConstraints;
25
27
  private _previousAudioConstraints;
@@ -54,8 +56,10 @@ export default abstract class BrowserSession extends BaseSession {
54
56
  get speaker(): string;
55
57
  set localElement(tag: HTMLMediaElement | string | Function);
56
58
  get localElement(): HTMLMediaElement | string | Function;
59
+ get localElementId(): string;
57
60
  set remoteElement(tag: HTMLMediaElement | string | Function);
58
61
  get remoteElement(): HTMLMediaElement | string | Function;
62
+ get remoteElementId(): string;
59
63
  vertoBroadcast({ nodeId, channel: eventChannel, data, }: BroadcastParams): void;
60
64
  vertoSubscribe({ nodeId, channels: eventChannel, handler, }: SubscribeParams): Promise<any>;
61
65
  vertoUnsubscribe({ nodeId, channels: eventChannel, }: SubscribeParams): Promise<any>;
@@ -45,6 +45,7 @@ export declare const TELNYX_WARNING_CODES: {
45
45
  readonly AUDIO_INPUT_DEVICE_CHANGE_SKIPPED: 33009;
46
46
  readonly MULTIPLE_ACTIVE_CALLS_DETECTED: 33010;
47
47
  readonly DUPLICATE_INBOUND_ANSWER: 33007;
48
+ readonly SHARED_REMOTE_ELEMENT_OVERWRITE: 33011;
48
49
  readonly TOKEN_EXPIRING_SOON: 34001;
49
50
  readonly UNKNOWN_REATTACHED_SESSION: 35002;
50
51
  readonly SIGNALING_RECOVERY_REQUIRED: 36003;
@@ -52,5 +53,5 @@ export declare const TELNYX_WARNING_CODES: {
52
53
  readonly RECONNECTION_FAILED_WITH_NO_AUTO_RECONNECT: 36005;
53
54
  };
54
55
  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, SESSION_NOT_REATTACHED: 48501, UNEXPECTED_ERROR: 49001;
55
- export declare const HIGH_RTT: 31001, HIGH_JITTER: 31002, HIGH_PACKET_LOSS: 31003, LOW_MOS: 31004, LOW_LOCAL_AUDIO: 31005, LOW_INBOUND_AUDIO: 31006, LOW_BYTES_RECEIVED: 32001, LOW_BYTES_SENT: 32002, RECORDING_UNAVAILABLE: 32003, RECORDING_BUFFER_OVERFLOW: 32004, 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, ICE_CANDIDATE_PAIR_CHANGED: 33008, AUDIO_INPUT_DEVICE_CHANGE_SKIPPED: 33009, MULTIPLE_ACTIVE_CALLS_DETECTED: 33010, DUPLICATE_INBOUND_ANSWER: 33007, TOKEN_EXPIRING_SOON: 34001, UNKNOWN_REATTACHED_SESSION: 35002, SIGNALING_RECOVERY_REQUIRED: 36003, MEDIA_RECOVERY_REQUIRED: 36004, RECONNECTION_FAILED_WITH_NO_AUTO_RECONNECT: 36005;
56
+ export declare const HIGH_RTT: 31001, HIGH_JITTER: 31002, HIGH_PACKET_LOSS: 31003, LOW_MOS: 31004, LOW_LOCAL_AUDIO: 31005, LOW_INBOUND_AUDIO: 31006, LOW_BYTES_RECEIVED: 32001, LOW_BYTES_SENT: 32002, RECORDING_UNAVAILABLE: 32003, RECORDING_BUFFER_OVERFLOW: 32004, 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, ICE_CANDIDATE_PAIR_CHANGED: 33008, AUDIO_INPUT_DEVICE_CHANGE_SKIPPED: 33009, MULTIPLE_ACTIVE_CALLS_DETECTED: 33010, DUPLICATE_INBOUND_ANSWER: 33007, SHARED_REMOTE_ELEMENT_OVERWRITE: 33011, TOKEN_EXPIRING_SOON: 34001, UNKNOWN_REATTACHED_SESSION: 35002, SIGNALING_RECOVERY_REQUIRED: 36003, MEDIA_RECOVERY_REQUIRED: 36004, RECONNECTION_FAILED_WITH_NO_AUTO_RECONNECT: 36005;
56
57
  export declare const HAS_NON_HOST_ICE_CANDIDATE_REGEX: RegExp;
@@ -27,6 +27,16 @@ export declare const STUN_SERVER: {
27
27
  export declare const STUN_DEV_SERVER: {
28
28
  urls: string;
29
29
  };
30
+ export declare const TURN_UDP_3478_SERVER: {
31
+ urls: string;
32
+ username: string;
33
+ credential: string;
34
+ };
35
+ export declare const TURN_TCP_3478_SERVER: {
36
+ urls: string;
37
+ username: string;
38
+ credential: string;
39
+ };
30
40
  export declare const TURN_SERVER: {
31
41
  urls: string;
32
42
  username: string;
@@ -37,8 +47,41 @@ export declare const TURN_DEV_SERVER: {
37
47
  username: string;
38
48
  credential: string;
39
49
  }[];
50
+ export declare const TURN_TLS_443_SERVER: {
51
+ urls: string;
52
+ username: string;
53
+ credential: string;
54
+ };
55
+ export declare const TURN_TLS_443_DEV_SERVER: {
56
+ urls: string;
57
+ username: string;
58
+ credential: string;
59
+ };
40
60
  export declare const DEFAULT_PROD_ICE_SERVERS: RTCIceServer[];
41
61
  export declare const DEFAULT_DEV_ICE_SERVERS: RTCIceServer[];
62
+ export declare const TELNYX_ICE_SERVERS: {
63
+ readonly GOOGLE_STUN: {
64
+ urls: string;
65
+ };
66
+ readonly TELNYX_STUN: {
67
+ urls: string;
68
+ };
69
+ readonly TELNYX_TURN_UDP_3478: {
70
+ urls: string;
71
+ username: string;
72
+ credential: string;
73
+ };
74
+ readonly TELNYX_TURN_TCP_3478: {
75
+ urls: string;
76
+ username: string;
77
+ credential: string;
78
+ };
79
+ readonly TELNYX_TURNS_TCP_443: {
80
+ urls: string;
81
+ username: string;
82
+ credential: string;
83
+ };
84
+ };
42
85
  export declare enum SwEvent {
43
86
  SocketOpen = "telnyx.socket.open",
44
87
  SocketClose = "telnyx.socket.close",
@@ -180,6 +180,13 @@ export declare const SDK_WARNINGS: {
180
180
  readonly causes: readonly ["Application created an outbound call while another call is active", "An inbound call arrived while another call is already active", "Application did not hang up the previous call before starting a new one", "Call waiting or multi-call scenario (may be intentional)"];
181
181
  readonly solutions: readonly ["Verify this is the expected behavior for your application", "Ensure the previous call is hung up before creating a new one if only one call is expected", "Use call.hold() before starting a new call if needed", "Check the warning payload for call IDs to correlate which calls are involved"];
182
182
  };
183
+ readonly 33011: {
184
+ readonly name: "SHARED_REMOTE_ELEMENT_OVERWRITE";
185
+ readonly message: "Remote media element overwritten by another call";
186
+ readonly description: "A new MediaStream was attached to an HTML media element (audio/video) that already held a different MediaStream from another active call. The SDK overwrote the existing stream (last-writer-wins), which disrupts the other call remote media playout. This happens when two concurrent calls share a single remoteElement instead of each having its own. Use a per-call remoteElement (client.newCall({ remoteElement }) or call.answer({ remoteElement })) so each call owns a distinct element.";
187
+ readonly causes: readonly ["Two concurrent calls share one remoteElement (legacy single-element app)", "Application did not pass a per-call remoteElement to newCall() or answer()", "A second inbound call rang into a session using one session-level remoteElement"];
188
+ readonly solutions: readonly ["Pass a distinct remoteElement per call via client.newCall({ remoteElement })", "For inbound calls, override at answer time via call.answer({ remoteElement })", "Give each call its own <audio>/<video> element so attach/detach lifecycles are independent"];
189
+ };
183
190
  readonly 35002: {
184
191
  readonly name: "UNKNOWN_REATTACHED_SESSION";
185
192
  readonly message: "Unknown reattach session after reconnect";
@@ -2,6 +2,8 @@ import { IWebRTCCall } from '../webrtc/interfaces';
2
2
  export interface IStoredActiveCall {
3
3
  id: IWebRTCCall['id'];
4
4
  customHeaders: IWebRTCCall['options']['customHeaders'];
5
+ remoteElement?: string;
6
+ localElement?: string;
5
7
  }
6
8
  export interface IStoredActiveCalls {
7
9
  sessionId: string;
@@ -8,7 +8,12 @@ declare const getSupportedConstraints: () => MediaTrackSupportedConstraints;
8
8
  declare const streamIsValid: (stream: MediaStream) => boolean;
9
9
  declare const audioIsMediaTrackConstraints: (audio: boolean | MediaTrackConstraints) => boolean;
10
10
  declare const videoIsMediaTrackConstraints: (video: boolean | MediaTrackConstraints) => boolean;
11
- declare const attachMediaStream: (tag: any, stream: MediaStream) => void;
11
+ export interface IAttachMediaStreamContext {
12
+ callId?: string;
13
+ sessionId?: string;
14
+ eventTarget?: string;
15
+ }
16
+ declare const attachMediaStream: (tag: any, stream: MediaStream, context?: IAttachMediaStreamContext) => void;
12
17
  declare const detachMediaStream: (tag: any, stream?: MediaStream) => void;
13
18
  declare const muteMediaElement: (tag: any) => void;
14
19
  declare const unmuteMediaElement: (tag: any) => void;
@@ -4,7 +4,11 @@ declare const _getUserMedia: (constraints: MediaStreamConstraints) => any;
4
4
  declare const _enumerateDevices: () => any;
5
5
  declare const streamIsValid: (stream: MediaStream) => boolean;
6
6
  declare const getSupportedConstraints: () => {};
7
- declare const attachMediaStream: (htmlElementId: string, stream: MediaStream) => any;
7
+ declare const attachMediaStream: (htmlElementId: string, stream: MediaStream, _context?: {
8
+ callId?: string;
9
+ sessionId?: string;
10
+ eventTarget?: string;
11
+ }) => any;
8
12
  declare const detachMediaStream: (htmlElementId: string, _stream?: MediaStream) => any;
9
13
  declare const muteMediaElement: (htmlElementId: string) => any;
10
14
  declare const unmuteMediaElement: (htmlElementId: string) => any;
@@ -83,6 +83,8 @@ export interface AnswerParams {
83
83
  value: string;
84
84
  }>;
85
85
  video?: boolean;
86
+ remoteElement?: HTMLMediaElement | string | Function;
87
+ localElement?: HTMLMediaElement | string | Function;
86
88
  }
87
89
  export interface IWebRTCCall {
88
90
  id: string;
@@ -1,9 +1,9 @@
1
1
  import TelnyxRTC from './TelnyxRTC';
2
2
  import { IClientOptions, ICallOptions, ICredentials, INotification } from './utils/interfaces';
3
- import { SwEvent } from './Modules/Verto/util/constants';
3
+ import { SwEvent, TELNYX_ICE_SERVERS } 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
- export { Call, TelnyxRTC, IClientOptions, ICallOptions, ICredentials, INotification, SwEvent, NOTIFICATION_TYPE, ERROR_TYPE, };
6
+ export { Call, TelnyxRTC, IClientOptions, ICallOptions, ICredentials, INotification, SwEvent, TELNYX_ICE_SERVERS, NOTIFICATION_TYPE, ERROR_TYPE, };
7
7
  export { SDK_ERRORS, SDK_WARNINGS, TelnyxError, isMediaRecoveryErrorEvent, } from './Modules/Verto/util/errors';
8
8
  export { TELNYX_ERROR_CODES, TELNYX_WARNING_CODES, } from './Modules/Verto/util/constants/errorCodes';
9
9
  export type { ITelnyxError, ITelnyxMediaError, ITelnyxErrorEvent, ITelnyxMediaRecoveryErrorEvent, ITelnyxStandardErrorEvent, TelnyxMediaErrorCode, } from './Modules/Verto/util/errors';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telnyx/webrtc",
3
- "version": "2.27.4-beta.2",
3
+ "version": "2.27.4",
4
4
  "description": "Telnyx WebRTC Client",
5
5
  "keywords": [
6
6
  "telnyx",