genesys-cloud-streaming-client 16.1.2 → 16.1.4-develop.69
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/dist/cjs/client.js +3 -2
- package/dist/cjs/stats-formatter.d.ts +4 -5
- package/dist/cjs/stats-formatter.js +22 -32
- package/dist/cjs/types/interfaces.d.ts +57 -0
- package/dist/cjs/webrtc.d.ts +6 -1
- package/dist/cjs/webrtc.js +58 -14
- package/dist/deploy-info.json +5 -5
- package/dist/es/client.js +3 -2
- package/dist/es/index.bundle.js +100 -79
- package/dist/es/stats-formatter.d.ts +4 -5
- package/dist/es/stats-formatter.js +18 -32
- package/dist/es/types/interfaces.d.ts +57 -0
- package/dist/es/webrtc.d.ts +6 -1
- package/dist/es/webrtc.js +56 -15
- package/dist/npm/CHANGELOG.md +2 -0
- package/dist/npm/client.js +3 -2
- package/dist/npm/stats-formatter.d.ts +4 -5
- package/dist/npm/stats-formatter.js +22 -32
- package/dist/npm/types/interfaces.d.ts +57 -0
- package/dist/npm/webrtc.d.ts +6 -1
- package/dist/npm/webrtc.js +58 -14
- package/dist/streaming-client.browser.ie.js +4 -4
- package/dist/streaming-client.browser.js +2 -2
- package/dist/v16/streaming-client.browser.ie.js +4 -4
- package/dist/v16/streaming-client.browser.js +2 -2
- package/dist/{v16.1.2 → v16.1.4}/streaming-client.browser.ie.js +4 -4
- package/dist/v16.1.4/streaming-client.browser.js +40 -0
- package/package.json +118 -116
- package/dist/v16.1.2/streaming-client.browser.js +0 -40
package/dist/cjs/client.js
CHANGED
|
@@ -48,7 +48,8 @@ class Client extends events_1.default {
|
|
|
48
48
|
jidResource: options.jidResource,
|
|
49
49
|
channelId: null,
|
|
50
50
|
appName: options.appName,
|
|
51
|
-
appVersion: options.appVersion
|
|
51
|
+
appVersion: options.appVersion,
|
|
52
|
+
appId: options.appId
|
|
52
53
|
};
|
|
53
54
|
this.backgroundAssistantMode = this.checkIsBackgroundAssistant();
|
|
54
55
|
this.isGuest = !this.backgroundAssistantMode && !options.authToken;
|
|
@@ -433,7 +434,7 @@ class Client extends events_1.default {
|
|
|
433
434
|
return Client.version;
|
|
434
435
|
}
|
|
435
436
|
static get version() {
|
|
436
|
-
return '16.1.
|
|
437
|
+
return '16.1.4';
|
|
437
438
|
}
|
|
438
439
|
}
|
|
439
440
|
exports.Client = Client;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StatsEvent } from 'webrtc-stats-gatherer';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
2
|
+
import { FlatObject, InsightAction } from './types/interfaces';
|
|
3
|
+
export declare function formatStatsEvent(event: StatsEvent, extraDetails?: FlatObject): InsightAction<{
|
|
4
|
+
_eventType: string;
|
|
5
|
+
} & FlatObject>;
|
|
7
6
|
export declare function deepFlatten(obj: any, prefix?: string): any;
|
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deepFlatten = exports.formatStatsEvent = void 0;
|
|
4
|
+
function isGetStatsEvent(event) {
|
|
5
|
+
return event.name === 'getStats';
|
|
6
|
+
}
|
|
7
|
+
function prepGetStatsEvent(event) {
|
|
8
|
+
let details = {};
|
|
9
|
+
Object.assign(details, deepFlatten(event.tracks, 'localTrack'));
|
|
10
|
+
delete event.tracks;
|
|
11
|
+
Object.assign(details, deepFlatten(event.remoteTracks, `remoteTrack`));
|
|
12
|
+
delete event.remoteTracks;
|
|
13
|
+
return details;
|
|
14
|
+
}
|
|
4
15
|
function formatStatsEvent(event, extraDetails = {}) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
else if (event.name === 'getStats') {
|
|
14
|
-
const e = event;
|
|
15
|
-
details = e;
|
|
16
|
-
Object.assign(details, deepFlatten(e.tracks, 'localTrack'));
|
|
17
|
-
delete details.tracks;
|
|
18
|
-
Object.assign(details, deepFlatten(e.remoteTracks, `remoteTrack`));
|
|
19
|
-
delete details.remoteTracks;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
details = {};
|
|
23
|
-
if (event.name !== 'failure') {
|
|
24
|
-
// TODO: log this out when we get genesys-cloud-client-logger in place (allows logging from anywhere)
|
|
25
|
-
}
|
|
26
|
-
Object.assign(details, deepFlatten(event));
|
|
16
|
+
const details = {
|
|
17
|
+
_eventType: event.name,
|
|
18
|
+
_eventTimestamp: new Date().toISOString(),
|
|
19
|
+
...extraDetails
|
|
20
|
+
};
|
|
21
|
+
// anything that needs to be renamed or massaged
|
|
22
|
+
if (isGetStatsEvent(event)) {
|
|
23
|
+
Object.assign(details, prepGetStatsEvent(event));
|
|
27
24
|
}
|
|
25
|
+
// general case
|
|
26
|
+
Object.assign(details, deepFlatten(event));
|
|
28
27
|
delete details.name;
|
|
29
|
-
Object.assign(details, extraDetails, { '_eventType': eventType });
|
|
30
|
-
// new relic doesn't accept booleans so we convert them to strings
|
|
31
|
-
Object.keys(details).forEach((key) => {
|
|
32
|
-
const val = details[key];
|
|
33
|
-
if (typeof val === 'boolean') {
|
|
34
|
-
details[key] = `${val}`;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
28
|
const formattedEvent = {
|
|
38
29
|
actionName: 'WebrtcStats',
|
|
39
|
-
|
|
40
|
-
details
|
|
30
|
+
details,
|
|
41
31
|
};
|
|
42
32
|
return formattedEvent;
|
|
43
33
|
}
|
|
@@ -186,3 +186,60 @@ export declare type HeadsetControlsRequest = TypedJsonRpcMessage<'headsetControl
|
|
|
186
186
|
export declare type HeadsetControlsRejection = TypedJsonRpcMessage<'headsetControlsRejection', HeadsetControlsRejectionParams>;
|
|
187
187
|
export declare type HeadsetControlsChanged = TypedJsonRpcMessage<'headsetControlsChanged', HeadsetControlsChangedParams>;
|
|
188
188
|
export declare type GenesysMediaMessage = HeadsetControlsRequest | HeadsetControlsRejection | HeadsetControlsChanged;
|
|
189
|
+
export declare type FlatObject = {
|
|
190
|
+
[key: string]: string | number | boolean | null | Date;
|
|
191
|
+
};
|
|
192
|
+
export declare type GenericAction = {
|
|
193
|
+
_eventType: string;
|
|
194
|
+
};
|
|
195
|
+
export declare type InsightReport = {
|
|
196
|
+
appName: string;
|
|
197
|
+
appVersion: string;
|
|
198
|
+
originAppName?: string;
|
|
199
|
+
originAppVersion?: string;
|
|
200
|
+
actions: InsightAction<any>[];
|
|
201
|
+
};
|
|
202
|
+
export declare type InsightAction<T extends {
|
|
203
|
+
_eventType: string;
|
|
204
|
+
}> = {
|
|
205
|
+
actionName: 'WebrtcStats';
|
|
206
|
+
details: InsightActionDetails<T>;
|
|
207
|
+
};
|
|
208
|
+
export declare type InsightActionDetails<K extends {
|
|
209
|
+
_eventType: string;
|
|
210
|
+
}> = {
|
|
211
|
+
_eventType: K['_eventType'];
|
|
212
|
+
/**
|
|
213
|
+
* This should be an ISO string
|
|
214
|
+
*/
|
|
215
|
+
_eventTimestamp: string;
|
|
216
|
+
_appId?: string;
|
|
217
|
+
_appName?: string;
|
|
218
|
+
_appVersion?: string;
|
|
219
|
+
} & K;
|
|
220
|
+
export declare type FirstProposeStat = InsightAction<{
|
|
221
|
+
_eventType: 'firstPropose';
|
|
222
|
+
sdpViaXmppRequested: boolean;
|
|
223
|
+
sessionType: SessionTypesAsStrings;
|
|
224
|
+
originAppId?: string;
|
|
225
|
+
conversationId: string;
|
|
226
|
+
sessionId: string;
|
|
227
|
+
}>;
|
|
228
|
+
export declare type FirstAlertingConversationStat = InsightAction<{
|
|
229
|
+
_eventType: 'firstAlertingConversationUpdate';
|
|
230
|
+
conversationId: string;
|
|
231
|
+
participantId: string;
|
|
232
|
+
}>;
|
|
233
|
+
export declare type MediaStat = InsightAction<{
|
|
234
|
+
_eventType: 'mediaRequested' | 'mediaStarted' | 'mediaError';
|
|
235
|
+
requestId?: string;
|
|
236
|
+
message?: string;
|
|
237
|
+
audioRequested: boolean;
|
|
238
|
+
videoRequested: boolean;
|
|
239
|
+
displayRequested: boolean;
|
|
240
|
+
conversationId?: string;
|
|
241
|
+
sessionType?: SessionTypesAsStrings;
|
|
242
|
+
sessionId?: string;
|
|
243
|
+
elapsedMsFromInitialRequest?: number;
|
|
244
|
+
}>;
|
|
245
|
+
export declare type NRProxyStat = FirstAlertingConversationStat | MediaStat;
|
package/dist/cjs/webrtc.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { IQ } from 'stanza/protocol';
|
|
|
4
4
|
import { SessionManager } from 'stanza/jingle';
|
|
5
5
|
import { SessionOpts } from 'stanza/jingle/Session';
|
|
6
6
|
import { Client } from './client';
|
|
7
|
-
import { ExtendedRTCIceServer, IClientOptions, SessionTypes, IPendingSession, StreamingClientExtension } from './types/interfaces';
|
|
7
|
+
import { ExtendedRTCIceServer, IClientOptions, SessionTypes, IPendingSession, StreamingClientExtension, NRProxyStat, InsightAction } from './types/interfaces';
|
|
8
8
|
import { NamedAgent } from './types/named-agent';
|
|
9
9
|
import { StanzaMediaSession } from './types/stanza-media-session';
|
|
10
10
|
import { IMediaSession } from './types/media-session';
|
|
@@ -54,6 +54,9 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
54
54
|
handleGenesysWebrtcStanza(iq: IQ): Promise<boolean | void>;
|
|
55
55
|
prepareSession(options: SessionOpts): StanzaMediaSession | undefined;
|
|
56
56
|
proxyStatsForSession(session: IMediaSession): void;
|
|
57
|
+
addStatToQueue<T extends {
|
|
58
|
+
_eventType: string;
|
|
59
|
+
}>(stat: InsightAction<T>): void;
|
|
57
60
|
getLogDetailsForPendingSessionId(sessionId: string): {
|
|
58
61
|
conversationId?: string;
|
|
59
62
|
sessionId: string;
|
|
@@ -89,6 +92,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
89
92
|
getSessionTypeByJid(jid: string): SessionTypes;
|
|
90
93
|
getSessionManager(): SessionManager | undefined;
|
|
91
94
|
getAllSessions(): IMediaSession[];
|
|
95
|
+
proxyNRStat(stat: NRProxyStat): void;
|
|
92
96
|
get expose(): WebrtcExtensionAPI;
|
|
93
97
|
}
|
|
94
98
|
export interface WebrtcExtensionAPI {
|
|
@@ -108,4 +112,5 @@ export interface WebrtcExtensionAPI {
|
|
|
108
112
|
getSessionTypeByJid(jid: string): SessionTypes;
|
|
109
113
|
getSessionManager: () => SessionManager | undefined;
|
|
110
114
|
getAllSessions: () => IMediaSession[];
|
|
115
|
+
proxyNRStat: (stat: NRProxyStat) => void;
|
|
111
116
|
}
|
package/dist/cjs/webrtc.js
CHANGED
|
@@ -162,6 +162,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
162
162
|
}
|
|
163
163
|
const session = new genesys_cloud_media_session_1.GenesysCloudMediaSession(this, mediaSessionParams);
|
|
164
164
|
await session.setRemoteDescription(params.sdp);
|
|
165
|
+
this.proxyStatsForSession(session);
|
|
165
166
|
session.on('sendIq', (iq) => { var _a; return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.sendIQ(iq); });
|
|
166
167
|
session.on('terminated', () => {
|
|
167
168
|
this.webrtcSessions = this.webrtcSessions.filter(s => s.id !== session.id);
|
|
@@ -262,25 +263,51 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
262
263
|
}
|
|
263
264
|
const statsCopy = JSON.parse(JSON.stringify(statsEvent));
|
|
264
265
|
const extraDetails = {
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
conversationId: session.conversationId,
|
|
267
|
+
sessionId: session.id,
|
|
267
268
|
sessionType: session.sessionType
|
|
268
269
|
};
|
|
269
270
|
// format the event to what the api expects
|
|
270
271
|
const event = stats_formatter_1.formatStatsEvent(statsCopy, extraDetails);
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
272
|
+
this.addStatToQueue(event);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
// this fn checks to see if the new stat fits inside the buffer. If not, send the queue;
|
|
276
|
+
addStatToQueue(stat) {
|
|
277
|
+
if (this.config.optOutOfWebrtcStatsTelemetry) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (!stat.details._appId) {
|
|
281
|
+
stat.details._appId = this.logger.clientId;
|
|
282
|
+
stat.details._appName = 'streamingclient';
|
|
283
|
+
stat.details._appVersion = client_1.Client.version;
|
|
284
|
+
}
|
|
285
|
+
stat.details._originAppId = this.client.config.appId;
|
|
286
|
+
// nr only accepts single level objects so we must flatten everything just in case
|
|
287
|
+
const flattenedDetails = stats_formatter_1.deepFlatten(stat.details);
|
|
288
|
+
// new relic doesn't accept booleans so we convert them to strings
|
|
289
|
+
Object.keys(flattenedDetails).forEach((key) => {
|
|
290
|
+
const val = flattenedDetails[key];
|
|
291
|
+
if (typeof val === 'boolean') {
|
|
292
|
+
flattenedDetails[key] = `${val}`;
|
|
282
293
|
}
|
|
283
294
|
});
|
|
295
|
+
const formattedStat = {
|
|
296
|
+
...stat,
|
|
297
|
+
details: flattenedDetails
|
|
298
|
+
};
|
|
299
|
+
const currentEventSize = utils_1.calculatePayloadSize(formattedStat);
|
|
300
|
+
// Check if the size of the current event plus the size of the previous stats exceeds max size.
|
|
301
|
+
const exceedsMaxStatSize = this.statBuffer + currentEventSize > this.currentMaxStatSize;
|
|
302
|
+
this.statsArr.push(formattedStat);
|
|
303
|
+
this.statBuffer += currentEventSize;
|
|
304
|
+
// If it exceeds max size, don't append just send current payload.
|
|
305
|
+
if (exceedsMaxStatSize) {
|
|
306
|
+
this.flushStats();
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
this.throttledSendStats();
|
|
310
|
+
}
|
|
284
311
|
}
|
|
285
312
|
getLogDetailsForPendingSessionId(sessionId) {
|
|
286
313
|
const logDetails = {
|
|
@@ -388,6 +415,19 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
388
415
|
const loggingParams = { sessionId: sessionId, conversationId: msg.propose.conversationId, sessionType, isDuplicatePropose };
|
|
389
416
|
this.logger.info('propose received', loggingParams);
|
|
390
417
|
if (!isDuplicatePropose) {
|
|
418
|
+
const { appId } = this.client.config;
|
|
419
|
+
const proposeStat = {
|
|
420
|
+
actionName: 'WebrtcStats',
|
|
421
|
+
details: {
|
|
422
|
+
_eventTimestamp: new Date().toISOString(),
|
|
423
|
+
_eventType: 'firstPropose',
|
|
424
|
+
conversationId: loggingParams.conversationId,
|
|
425
|
+
sdpViaXmppRequested: !!msg.propose.sdpOverXmpp,
|
|
426
|
+
sessionId: sessionId,
|
|
427
|
+
sessionType: sessionType,
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
this.addStatToQueue(proposeStat);
|
|
391
431
|
// TODO: is ofrom used?
|
|
392
432
|
// const roomJid = (msg.ofrom && msg.ofrom.full) || msg.from.full || msg.from;
|
|
393
433
|
const fromJid = msg.from;
|
|
@@ -706,6 +746,9 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
706
746
|
const stanzaSessions = stanzaSessionsObj && Object.values(stanzaSessionsObj) || [];
|
|
707
747
|
return [...stanzaSessions, ...this.webrtcSessions];
|
|
708
748
|
}
|
|
749
|
+
proxyNRStat(stat) {
|
|
750
|
+
this.addStatToQueue(stat);
|
|
751
|
+
}
|
|
709
752
|
get expose() {
|
|
710
753
|
return {
|
|
711
754
|
on: this.on.bind(this),
|
|
@@ -723,7 +766,8 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
723
766
|
initiateRtcSession: this.initiateRtcSession.bind(this),
|
|
724
767
|
getSessionTypeByJid: this.getSessionTypeByJid.bind(this),
|
|
725
768
|
getSessionManager: this.getSessionManager.bind(this),
|
|
726
|
-
getAllSessions: this.getAllSessions.bind(this)
|
|
769
|
+
getAllSessions: this.getAllSessions.bind(this),
|
|
770
|
+
proxyNRStat: this.proxyNRStat.bind(this)
|
|
727
771
|
};
|
|
728
772
|
}
|
|
729
773
|
}
|
package/dist/deploy-info.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "developercenter-cdn/streaming-client",
|
|
3
|
-
"version": "16.1.
|
|
3
|
+
"version": "16.1.4",
|
|
4
4
|
"ecosystem": "pc",
|
|
5
5
|
"team": "Genesys Client Media (WebRTC)",
|
|
6
6
|
"indexFiles": [
|
|
7
7
|
{
|
|
8
|
-
"file": "v16.1.
|
|
8
|
+
"file": "v16.1.4/streaming-client.browser.ie.js"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
"file": "v16.1.
|
|
11
|
+
"file": "v16.1.4/streaming-client.browser.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"file": "v16/streaming-client.browser.ie.js"
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"file": "v16/streaming-client.browser.js"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
|
-
"build": "
|
|
21
|
-
"buildDate": "2023-
|
|
20
|
+
"build": "69",
|
|
21
|
+
"buildDate": "2023-12-13T16:00:49.749620Z"
|
|
22
22
|
}
|
package/dist/es/client.js
CHANGED
|
@@ -46,7 +46,8 @@ export class Client extends EventEmitter {
|
|
|
46
46
|
jidResource: options.jidResource,
|
|
47
47
|
channelId: null,
|
|
48
48
|
appName: options.appName,
|
|
49
|
-
appVersion: options.appVersion
|
|
49
|
+
appVersion: options.appVersion,
|
|
50
|
+
appId: options.appId
|
|
50
51
|
};
|
|
51
52
|
this.backgroundAssistantMode = this.checkIsBackgroundAssistant();
|
|
52
53
|
this.isGuest = !this.backgroundAssistantMode && !options.authToken;
|
|
@@ -443,6 +444,6 @@ export class Client extends EventEmitter {
|
|
|
443
444
|
return Client.version;
|
|
444
445
|
}
|
|
445
446
|
static get version() {
|
|
446
|
-
return '16.1.
|
|
447
|
+
return '16.1.4';
|
|
447
448
|
}
|
|
448
449
|
}
|
package/dist/es/index.bundle.js
CHANGED
|
@@ -965,8 +965,8 @@ if (getRandomValues$1) {
|
|
|
965
965
|
*/
|
|
966
966
|
|
|
967
967
|
var byteToHex$1 = [];
|
|
968
|
-
for (var i
|
|
969
|
-
byteToHex$1[i
|
|
968
|
+
for (var i = 0; i < 256; ++i) {
|
|
969
|
+
byteToHex$1[i] = (i + 0x100).toString(16).substr(1);
|
|
970
970
|
}
|
|
971
971
|
|
|
972
972
|
function bytesToUuid$2(buf, offset) {
|
|
@@ -7866,14 +7866,13 @@ function defer() {
|
|
|
7866
7866
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
7867
7867
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
7868
7868
|
// generators (like Math.random()).
|
|
7869
|
-
|
|
7870
|
-
|
|
7869
|
+
let getRandomValues;
|
|
7870
|
+
const rnds8 = new Uint8Array(16);
|
|
7871
7871
|
function rng() {
|
|
7872
7872
|
// lazy load so that environments that need to polyfill have a chance to do so
|
|
7873
7873
|
if (!getRandomValues) {
|
|
7874
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
7875
|
-
|
|
7876
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
|
7874
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
7875
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
7877
7876
|
|
|
7878
7877
|
if (!getRandomValues) {
|
|
7879
7878
|
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
@@ -7883,43 +7882,35 @@ function rng() {
|
|
|
7883
7882
|
return getRandomValues(rnds8);
|
|
7884
7883
|
}
|
|
7885
7884
|
|
|
7886
|
-
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
7887
|
-
|
|
7888
|
-
function validate(uuid) {
|
|
7889
|
-
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
7890
|
-
}
|
|
7891
|
-
|
|
7892
7885
|
/**
|
|
7893
7886
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
7894
7887
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
7895
7888
|
*/
|
|
7896
7889
|
|
|
7897
|
-
|
|
7890
|
+
const byteToHex = [];
|
|
7898
7891
|
|
|
7899
|
-
for (
|
|
7900
|
-
byteToHex.push((i + 0x100).toString(16).
|
|
7892
|
+
for (let i = 0; i < 256; ++i) {
|
|
7893
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
7901
7894
|
}
|
|
7902
7895
|
|
|
7903
|
-
function
|
|
7904
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
7896
|
+
function unsafeStringify(arr, offset = 0) {
|
|
7905
7897
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
7906
7898
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
7907
|
-
|
|
7908
|
-
// of the following:
|
|
7909
|
-
// - One or more input array values don't map to a hex octet (leading to
|
|
7910
|
-
// "undefined" in the uuid)
|
|
7911
|
-
// - Invalid input values for the RFC `version` or `variant` fields
|
|
7912
|
-
|
|
7913
|
-
if (!validate(uuid)) {
|
|
7914
|
-
throw TypeError('Stringified UUID is invalid');
|
|
7915
|
-
}
|
|
7916
|
-
|
|
7917
|
-
return uuid;
|
|
7899
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
7918
7900
|
}
|
|
7919
7901
|
|
|
7902
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
7903
|
+
var native = {
|
|
7904
|
+
randomUUID
|
|
7905
|
+
};
|
|
7906
|
+
|
|
7920
7907
|
function v4(options, buf, offset) {
|
|
7908
|
+
if (native.randomUUID && !buf && !options) {
|
|
7909
|
+
return native.randomUUID();
|
|
7910
|
+
}
|
|
7911
|
+
|
|
7921
7912
|
options = options || {};
|
|
7922
|
-
|
|
7913
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
7923
7914
|
|
|
7924
7915
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
7925
7916
|
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
@@ -7927,14 +7918,14 @@ function v4(options, buf, offset) {
|
|
|
7927
7918
|
if (buf) {
|
|
7928
7919
|
offset = offset || 0;
|
|
7929
7920
|
|
|
7930
|
-
for (
|
|
7921
|
+
for (let i = 0; i < 16; ++i) {
|
|
7931
7922
|
buf[offset + i] = rnds[i];
|
|
7932
7923
|
}
|
|
7933
7924
|
|
|
7934
7925
|
return buf;
|
|
7935
7926
|
}
|
|
7936
7927
|
|
|
7937
|
-
return
|
|
7928
|
+
return unsafeStringify(rnds);
|
|
7938
7929
|
}
|
|
7939
7930
|
|
|
7940
7931
|
class TimeoutError extends Error {
|
|
@@ -18123,41 +18114,29 @@ const definitions = [
|
|
|
18123
18114
|
mediaMessage
|
|
18124
18115
|
];
|
|
18125
18116
|
|
|
18117
|
+
function isGetStatsEvent(event) {
|
|
18118
|
+
return event.name === 'getStats';
|
|
18119
|
+
}
|
|
18120
|
+
function prepGetStatsEvent(event) {
|
|
18121
|
+
let details = {};
|
|
18122
|
+
Object.assign(details, deepFlatten(event.tracks, 'localTrack'));
|
|
18123
|
+
delete event.tracks;
|
|
18124
|
+
Object.assign(details, deepFlatten(event.remoteTracks, `remoteTrack`));
|
|
18125
|
+
delete event.remoteTracks;
|
|
18126
|
+
return details;
|
|
18127
|
+
}
|
|
18126
18128
|
function formatStatsEvent(event, extraDetails = {}) {
|
|
18127
|
-
|
|
18128
|
-
|
|
18129
|
-
if (event
|
|
18130
|
-
|
|
18131
|
-
details = e;
|
|
18132
|
-
Object.assign(details, deepFlatten(e.candidatePairDetails, 'candidatePairDetails'));
|
|
18133
|
-
delete details.candidatePairDetails;
|
|
18134
|
-
}
|
|
18135
|
-
else if (event.name === 'getStats') {
|
|
18136
|
-
const e = event;
|
|
18137
|
-
details = e;
|
|
18138
|
-
Object.assign(details, deepFlatten(e.tracks, 'localTrack'));
|
|
18139
|
-
delete details.tracks;
|
|
18140
|
-
Object.assign(details, deepFlatten(e.remoteTracks, `remoteTrack`));
|
|
18141
|
-
delete details.remoteTracks;
|
|
18142
|
-
}
|
|
18143
|
-
else {
|
|
18144
|
-
details = {};
|
|
18145
|
-
if (event.name !== 'failure') ;
|
|
18146
|
-
Object.assign(details, deepFlatten(event));
|
|
18129
|
+
const details = Object.assign({ _eventType: event.name, _eventTimestamp: new Date().toISOString() }, extraDetails);
|
|
18130
|
+
// anything that needs to be renamed or massaged
|
|
18131
|
+
if (isGetStatsEvent(event)) {
|
|
18132
|
+
Object.assign(details, prepGetStatsEvent(event));
|
|
18147
18133
|
}
|
|
18134
|
+
// general case
|
|
18135
|
+
Object.assign(details, deepFlatten(event));
|
|
18148
18136
|
delete details.name;
|
|
18149
|
-
Object.assign(details, extraDetails, { '_eventType': eventType });
|
|
18150
|
-
// new relic doesn't accept booleans so we convert them to strings
|
|
18151
|
-
Object.keys(details).forEach((key) => {
|
|
18152
|
-
const val = details[key];
|
|
18153
|
-
if (typeof val === 'boolean') {
|
|
18154
|
-
details[key] = `${val}`;
|
|
18155
|
-
}
|
|
18156
|
-
});
|
|
18157
18137
|
const formattedEvent = {
|
|
18158
18138
|
actionName: 'WebrtcStats',
|
|
18159
|
-
|
|
18160
|
-
details
|
|
18139
|
+
details,
|
|
18161
18140
|
};
|
|
18162
18141
|
return formattedEvent;
|
|
18163
18142
|
}
|
|
@@ -29475,6 +29454,7 @@ class WebrtcExtension extends EventEmitter {
|
|
|
29475
29454
|
}
|
|
29476
29455
|
const session = new GenesysCloudMediaSession(this, mediaSessionParams);
|
|
29477
29456
|
yield session.setRemoteDescription(params.sdp);
|
|
29457
|
+
this.proxyStatsForSession(session);
|
|
29478
29458
|
session.on('sendIq', (iq) => { var _a; return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.sendIQ(iq); });
|
|
29479
29459
|
session.on('terminated', () => {
|
|
29480
29460
|
this.webrtcSessions = this.webrtcSessions.filter(s => s.id !== session.id);
|
|
@@ -29586,26 +29566,49 @@ class WebrtcExtension extends EventEmitter {
|
|
|
29586
29566
|
}
|
|
29587
29567
|
const statsCopy = JSON.parse(JSON.stringify(statsEvent));
|
|
29588
29568
|
const extraDetails = {
|
|
29589
|
-
|
|
29590
|
-
|
|
29569
|
+
conversationId: session.conversationId,
|
|
29570
|
+
sessionId: session.id,
|
|
29591
29571
|
sessionType: session.sessionType
|
|
29592
29572
|
};
|
|
29593
29573
|
// format the event to what the api expects
|
|
29594
29574
|
const event = formatStatsEvent(statsCopy, extraDetails);
|
|
29595
|
-
|
|
29596
|
-
// Check if the size of the current event plus the size of the previous stats exceeds max size.
|
|
29597
|
-
const exceedsMaxStatSize = this.statBuffer + currentEventSize > this.currentMaxStatSize;
|
|
29598
|
-
this.statsArr.push(event);
|
|
29599
|
-
this.statBuffer += currentEventSize;
|
|
29600
|
-
// If it exceeds max size, don't append just send current payload.
|
|
29601
|
-
if (exceedsMaxStatSize) {
|
|
29602
|
-
this.flushStats();
|
|
29603
|
-
}
|
|
29604
|
-
else {
|
|
29605
|
-
this.throttledSendStats();
|
|
29606
|
-
}
|
|
29575
|
+
this.addStatToQueue(event);
|
|
29607
29576
|
});
|
|
29608
29577
|
}
|
|
29578
|
+
// this fn checks to see if the new stat fits inside the buffer. If not, send the queue;
|
|
29579
|
+
addStatToQueue(stat) {
|
|
29580
|
+
if (this.config.optOutOfWebrtcStatsTelemetry) {
|
|
29581
|
+
return;
|
|
29582
|
+
}
|
|
29583
|
+
if (!stat.details._appId) {
|
|
29584
|
+
stat.details._appId = this.logger.clientId;
|
|
29585
|
+
stat.details._appName = 'streamingclient';
|
|
29586
|
+
stat.details._appVersion = Client.version;
|
|
29587
|
+
}
|
|
29588
|
+
stat.details._originAppId = this.client.config.appId;
|
|
29589
|
+
// nr only accepts single level objects so we must flatten everything just in case
|
|
29590
|
+
const flattenedDetails = deepFlatten(stat.details);
|
|
29591
|
+
// new relic doesn't accept booleans so we convert them to strings
|
|
29592
|
+
Object.keys(flattenedDetails).forEach((key) => {
|
|
29593
|
+
const val = flattenedDetails[key];
|
|
29594
|
+
if (typeof val === 'boolean') {
|
|
29595
|
+
flattenedDetails[key] = `${val}`;
|
|
29596
|
+
}
|
|
29597
|
+
});
|
|
29598
|
+
const formattedStat = Object.assign(Object.assign({}, stat), { details: flattenedDetails });
|
|
29599
|
+
const currentEventSize = calculatePayloadSize(formattedStat);
|
|
29600
|
+
// Check if the size of the current event plus the size of the previous stats exceeds max size.
|
|
29601
|
+
const exceedsMaxStatSize = this.statBuffer + currentEventSize > this.currentMaxStatSize;
|
|
29602
|
+
this.statsArr.push(formattedStat);
|
|
29603
|
+
this.statBuffer += currentEventSize;
|
|
29604
|
+
// If it exceeds max size, don't append just send current payload.
|
|
29605
|
+
if (exceedsMaxStatSize) {
|
|
29606
|
+
this.flushStats();
|
|
29607
|
+
}
|
|
29608
|
+
else {
|
|
29609
|
+
this.throttledSendStats();
|
|
29610
|
+
}
|
|
29611
|
+
}
|
|
29609
29612
|
getLogDetailsForPendingSessionId(sessionId) {
|
|
29610
29613
|
const logDetails = {
|
|
29611
29614
|
sessionId
|
|
@@ -29715,6 +29718,19 @@ class WebrtcExtension extends EventEmitter {
|
|
|
29715
29718
|
const loggingParams = { sessionId: sessionId, conversationId: msg.propose.conversationId, sessionType, isDuplicatePropose };
|
|
29716
29719
|
this.logger.info('propose received', loggingParams);
|
|
29717
29720
|
if (!isDuplicatePropose) {
|
|
29721
|
+
this.client.config;
|
|
29722
|
+
const proposeStat = {
|
|
29723
|
+
actionName: 'WebrtcStats',
|
|
29724
|
+
details: {
|
|
29725
|
+
_eventTimestamp: new Date().toISOString(),
|
|
29726
|
+
_eventType: 'firstPropose',
|
|
29727
|
+
conversationId: loggingParams.conversationId,
|
|
29728
|
+
sdpViaXmppRequested: !!msg.propose.sdpOverXmpp,
|
|
29729
|
+
sessionId: sessionId,
|
|
29730
|
+
sessionType: sessionType,
|
|
29731
|
+
}
|
|
29732
|
+
};
|
|
29733
|
+
this.addStatToQueue(proposeStat);
|
|
29718
29734
|
// TODO: is ofrom used?
|
|
29719
29735
|
// const roomJid = (msg.ofrom && msg.ofrom.full) || msg.from.full || msg.from;
|
|
29720
29736
|
const fromJid = msg.from;
|
|
@@ -30046,6 +30062,9 @@ class WebrtcExtension extends EventEmitter {
|
|
|
30046
30062
|
const stanzaSessions = stanzaSessionsObj && Object.values(stanzaSessionsObj) || [];
|
|
30047
30063
|
return [...stanzaSessions, ...this.webrtcSessions];
|
|
30048
30064
|
}
|
|
30065
|
+
proxyNRStat(stat) {
|
|
30066
|
+
this.addStatToQueue(stat);
|
|
30067
|
+
}
|
|
30049
30068
|
get expose() {
|
|
30050
30069
|
return {
|
|
30051
30070
|
on: this.on.bind(this),
|
|
@@ -30063,7 +30082,8 @@ class WebrtcExtension extends EventEmitter {
|
|
|
30063
30082
|
initiateRtcSession: this.initiateRtcSession.bind(this),
|
|
30064
30083
|
getSessionTypeByJid: this.getSessionTypeByJid.bind(this),
|
|
30065
30084
|
getSessionManager: this.getSessionManager.bind(this),
|
|
30066
|
-
getAllSessions: this.getAllSessions.bind(this)
|
|
30085
|
+
getAllSessions: this.getAllSessions.bind(this),
|
|
30086
|
+
proxyNRStat: this.proxyNRStat.bind(this)
|
|
30067
30087
|
};
|
|
30068
30088
|
}
|
|
30069
30089
|
}
|
|
@@ -44913,7 +44933,8 @@ class Client extends EventEmitter {
|
|
|
44913
44933
|
jidResource: options.jidResource,
|
|
44914
44934
|
channelId: null,
|
|
44915
44935
|
appName: options.appName,
|
|
44916
|
-
appVersion: options.appVersion
|
|
44936
|
+
appVersion: options.appVersion,
|
|
44937
|
+
appId: options.appId
|
|
44917
44938
|
};
|
|
44918
44939
|
this.backgroundAssistantMode = this.checkIsBackgroundAssistant();
|
|
44919
44940
|
this.isGuest = !this.backgroundAssistantMode && !options.authToken;
|
|
@@ -45310,7 +45331,7 @@ class Client extends EventEmitter {
|
|
|
45310
45331
|
return Client.version;
|
|
45311
45332
|
}
|
|
45312
45333
|
static get version() {
|
|
45313
|
-
return '16.1.
|
|
45334
|
+
return '16.1.4';
|
|
45314
45335
|
}
|
|
45315
45336
|
}
|
|
45316
45337
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StatsEvent } from 'webrtc-stats-gatherer';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
2
|
+
import { FlatObject, InsightAction } from './types/interfaces';
|
|
3
|
+
export declare function formatStatsEvent(event: StatsEvent, extraDetails?: FlatObject): InsightAction<{
|
|
4
|
+
_eventType: string;
|
|
5
|
+
} & FlatObject>;
|
|
7
6
|
export declare function deepFlatten(obj: any, prefix?: string): any;
|