@telnyx/webrtc 2.25.17 → 2.25.18-beta.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.
@@ -17,6 +17,7 @@ export default abstract class BaseSession {
17
17
  timeoutErrorCode: number;
18
18
  invalidMethodErrorCode: number;
19
19
  authenticationRequiredErrorCode: number;
20
+ callReportId: string | null;
20
21
  connection: Connection;
21
22
  protected _jwtAuth: boolean;
22
23
  protected _keepAliveTimeout: any;
@@ -17,6 +17,7 @@ export default class Connection {
17
17
  get closed(): boolean;
18
18
  get isAlive(): boolean;
19
19
  get isDead(): boolean;
20
+ get host(): string;
20
21
  connect(): void;
21
22
  sendRawText(request: string): void;
22
23
  send(bladeObj: any): Promise<any>;
@@ -0,0 +1,30 @@
1
+ export declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
2
+ export interface ILogEntry {
3
+ timestamp: string;
4
+ level: LogLevel;
5
+ message: string;
6
+ context?: Record<string, unknown>;
7
+ }
8
+ export interface ILogCollectorOptions {
9
+ enabled: boolean;
10
+ level: LogLevel;
11
+ maxEntries: number;
12
+ }
13
+ export declare class LogCollector {
14
+ private options;
15
+ private buffer;
16
+ private isCapturing;
17
+ constructor(options?: Partial<ILogCollectorOptions>);
18
+ start(): void;
19
+ stop(): void;
20
+ addEntry(level: LogLevel, message: string, context?: Record<string, unknown>): void;
21
+ getLogs(): ILogEntry[];
22
+ getLogCount(): number;
23
+ drain(): ILogEntry[];
24
+ clear(): void;
25
+ isActive(): boolean;
26
+ isEnabled(): boolean;
27
+ }
28
+ export declare function getGlobalLogCollector(): LogCollector | null;
29
+ export declare function setGlobalLogCollector(collector: LogCollector | null): void;
30
+ export declare function createLogCollector(options: Partial<ILogCollectorOptions>): LogCollector;
@@ -18,12 +18,12 @@ export declare const TURN_SERVER: {
18
18
  urls: string;
19
19
  username: string;
20
20
  credential: string;
21
- };
21
+ }[];
22
22
  export declare const TURN_DEV_SERVER: {
23
23
  urls: string;
24
24
  username: string;
25
25
  credential: string;
26
- };
26
+ }[];
27
27
  export declare const DEFAULT_PROD_ICE_SERVERS: RTCIceServer[];
28
28
  export declare const DEFAULT_DEV_ICE_SERVERS: RTCIceServer[];
29
29
  export declare enum SwEvent {
@@ -31,6 +31,10 @@ export interface IVertoOptions {
31
31
  rtcIp?: string;
32
32
  rtcPort?: number;
33
33
  mutedMicOnStart?: boolean;
34
+ enableCallReports?: boolean;
35
+ callReportInterval?: number;
36
+ debugLogLevel?: 'debug' | 'info' | 'warn' | 'error';
37
+ debugLogMaxEntries?: number;
34
38
  }
35
39
  export interface ILoginParams {
36
40
  login?: string;
@@ -7,6 +7,7 @@ export default abstract class BaseCall implements IWebRTCCall {
7
7
  protected session: BrowserSession;
8
8
  private _isRecovering;
9
9
  private _webRTCStats;
10
+ private _callReportCollector;
10
11
  id: string;
11
12
  state: string;
12
13
  prevState: string;
@@ -113,6 +114,8 @@ export default abstract class BaseCall implements IWebRTCCall {
113
114
  private _execute;
114
115
  private _init;
115
116
  protected _finalize(): void;
117
+ private _flushIntermediateReport;
118
+ private _postCallReport;
116
119
  private _startStats;
117
120
  private _stopStats;
118
121
  private _doStats;
@@ -0,0 +1,100 @@
1
+ import { ILogEntry } from '../../../Modules/Verto/util/LogCollector';
2
+ export interface ICallReportOptions {
3
+ enabled: boolean;
4
+ interval: number;
5
+ }
6
+ export interface ILogCollectorOptions {
7
+ enabled: boolean;
8
+ level: 'debug' | 'info' | 'warn' | 'error';
9
+ maxEntries: number;
10
+ }
11
+ export interface IStatsInterval {
12
+ intervalStartUtc: string;
13
+ intervalEndUtc: string;
14
+ audio?: {
15
+ outbound?: {
16
+ packetsSent?: number;
17
+ bytesSent?: number;
18
+ audioLevelAvg?: number;
19
+ bitrateAvg?: number;
20
+ };
21
+ inbound?: {
22
+ packetsReceived?: number;
23
+ bytesReceived?: number;
24
+ packetsLost?: number;
25
+ packetsDiscarded?: number;
26
+ jitterBufferDelay?: number;
27
+ jitterBufferEmittedCount?: number;
28
+ totalSamplesReceived?: number;
29
+ concealedSamples?: number;
30
+ concealmentEvents?: number;
31
+ audioLevelAvg?: number;
32
+ jitterAvg?: number;
33
+ bitrateAvg?: number;
34
+ };
35
+ };
36
+ connection?: {
37
+ roundTripTimeAvg?: number;
38
+ packetsSent?: number;
39
+ packetsReceived?: number;
40
+ bytesSent?: number;
41
+ bytesReceived?: number;
42
+ };
43
+ }
44
+ export interface ICallSummary {
45
+ callId: string;
46
+ destinationNumber?: string;
47
+ callerNumber?: string;
48
+ direction?: 'inbound' | 'outbound';
49
+ state?: string;
50
+ durationSeconds?: number;
51
+ telnyxSessionId?: string;
52
+ telnyxLegId?: string;
53
+ voiceSdkSessionId?: string;
54
+ sdkVersion?: string;
55
+ startTimestamp?: string;
56
+ endTimestamp?: string;
57
+ }
58
+ export interface ICallReportPayload {
59
+ summary: ICallSummary;
60
+ stats: IStatsInterval[];
61
+ logs?: ILogEntry[];
62
+ segment?: number;
63
+ }
64
+ export declare class CallReportCollector {
65
+ private options;
66
+ private logCollectorOptions;
67
+ private peerConnection;
68
+ private intervalId;
69
+ private statsBuffer;
70
+ private intervalStartTime;
71
+ private callStartTime;
72
+ private callEndTime;
73
+ private logCollector;
74
+ private intervalAudioLevels;
75
+ private intervalJitters;
76
+ private intervalRTTs;
77
+ private intervalBitrates;
78
+ private previousStats;
79
+ private readonly MAX_BUFFER_SIZE;
80
+ private static readonly STATS_FLUSH_THRESHOLD;
81
+ private static readonly LOGS_FLUSH_THRESHOLD;
82
+ onFlushNeeded: (() => void) | null;
83
+ private _segmentIndex;
84
+ private _flushing;
85
+ constructor(options: ICallReportOptions, logCollectorOptions?: ILogCollectorOptions);
86
+ start(peerConnection: RTCPeerConnection): void;
87
+ stop(): void;
88
+ flush(summary: ICallSummary): ICallReportPayload | null;
89
+ postReport(summary: ICallSummary, callReportId: string, host: string, voiceSdkId?: string): Promise<void>;
90
+ sendPayload(payload: ICallReportPayload, callReportId: string, host: string, voiceSdkId?: string): Promise<void>;
91
+ private _sendPayload;
92
+ getStatsBuffer(): IStatsInterval[];
93
+ getLogs(): ILogEntry[];
94
+ cleanup(): void;
95
+ private _collectStats;
96
+ private _createStatsEntry;
97
+ private _getTrackAudioLevel;
98
+ private _average;
99
+ private _resetIntervalAccumulators;
100
+ }
@@ -29,6 +29,8 @@ export interface IClientOptions {
29
29
  env?: Environment;
30
30
  iceServers?: RTCIceServer[];
31
31
  mutedMicOnStart?: boolean;
32
+ enableCallReports?: boolean;
33
+ callReportInterval?: number;
32
34
  }
33
35
  export interface ICallOptions {
34
36
  destinationNumber?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telnyx/webrtc",
3
- "version": "2.25.17",
3
+ "version": "2.25.18-beta.2",
4
4
  "description": "Telnyx WebRTC Client",
5
5
  "keywords": [
6
6
  "telnyx",