genesys-cloud-streaming-client 15.0.0-develop.29 → 15.0.1-develop.31
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 +8 -2
- package/dist/cjs/types/streaming-client-extension.d.ts +1 -0
- package/dist/cjs/webrtc.d.ts +5 -5
- package/dist/cjs/webrtc.js +28 -36
- package/dist/deploy-info.json +5 -5
- package/dist/es/client.js +8 -2
- package/dist/es/index.bundle.js +34 -36
- package/dist/es/types/streaming-client-extension.d.ts +1 -0
- package/dist/es/webrtc.d.ts +5 -5
- package/dist/es/webrtc.js +27 -35
- package/dist/npm/CHANGELOG.md +10 -3
- package/dist/npm/client.js +8 -2
- package/dist/npm/types/streaming-client-extension.d.ts +1 -0
- package/dist/npm/webrtc.d.ts +5 -5
- package/dist/npm/webrtc.js +28 -36
- package/dist/streaming-client.browser.ie.js +4 -4
- package/dist/streaming-client.browser.js +4 -4
- package/dist/v15/streaming-client.browser.ie.js +4 -4
- package/dist/v15/streaming-client.browser.js +4 -4
- package/dist/v15.0.1/streaming-client.browser.ie.js +11 -0
- package/dist/v15.0.1/streaming-client.browser.js +40 -0
- package/package.json +1 -1
- package/dist/v15.0.0/streaming-client.browser.ie.js +0 -11
- package/dist/v15.0.0/streaming-client.browser.js +0 -40
package/dist/cjs/client.js
CHANGED
|
@@ -173,7 +173,7 @@ class Client extends events_1.default {
|
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
return utils_1.timeoutPromise(resolve => {
|
|
176
|
-
this.
|
|
176
|
+
this.once('disconnected', resolve);
|
|
177
177
|
this.autoReconnect = false;
|
|
178
178
|
this.http.stopAllRetries();
|
|
179
179
|
this.activeStanzaInstance.disconnect();
|
|
@@ -281,6 +281,12 @@ class Client extends events_1.default {
|
|
|
281
281
|
this.addInateEventHandlers(stanzaInstance);
|
|
282
282
|
this.proxyStanzaEvents(stanzaInstance);
|
|
283
283
|
stanzaInstance.pinger = new ping_1.Ping(this, stanzaInstance);
|
|
284
|
+
// handle any extension configuration
|
|
285
|
+
for (const extension of this.extensions) {
|
|
286
|
+
if (extension.configureNewStanzaInstance) {
|
|
287
|
+
await extension.configureNewStanzaInstance(stanzaInstance);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
284
290
|
this.extensions.forEach(extension => extension.handleStanzaInstanceChange(stanzaInstance));
|
|
285
291
|
this.activeStanzaInstance = stanzaInstance;
|
|
286
292
|
this.emit('connected');
|
|
@@ -345,7 +351,7 @@ class Client extends events_1.default {
|
|
|
345
351
|
return Client.version;
|
|
346
352
|
}
|
|
347
353
|
static get version() {
|
|
348
|
-
return '15.0.
|
|
354
|
+
return '15.0.1';
|
|
349
355
|
}
|
|
350
356
|
}
|
|
351
357
|
exports.Client = Client;
|
package/dist/cjs/webrtc.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import { SessionManager } from 'stanza/jingle';
|
|
4
4
|
import { SessionOpts } from 'stanza/jingle/Session';
|
|
5
5
|
import { GenesysCloudMediaSession } from './types/media-session';
|
|
6
|
-
import Client from '
|
|
6
|
+
import { Client } from './client';
|
|
7
7
|
import { ExtendedRTCIceServer, IClientOptions, SessionTypes, IPendingSession, StreamingClientExtension } from './types/interfaces';
|
|
8
8
|
import { NamedAgent } from './types/named-agent';
|
|
9
9
|
export interface InitRtcSessionOptions {
|
|
@@ -39,7 +39,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
39
39
|
get jid(): string | undefined;
|
|
40
40
|
constructor(client: Client, clientOptions: IClientOptions);
|
|
41
41
|
handleStanzaInstanceChange(stanzaInstance: NamedAgent): Promise<void>;
|
|
42
|
-
|
|
42
|
+
configureNewStanzaInstance(stanzaInstance: NamedAgent): Promise<void>;
|
|
43
43
|
private configureStanzaIceServers;
|
|
44
44
|
handleMessage(msg: any): Promise<void>;
|
|
45
45
|
prepareSession(options: SessionOpts): GenesysCloudMediaSession;
|
|
@@ -72,10 +72,10 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
72
72
|
notifyScreenShareStop(session: GenesysCloudMediaSession): Promise<void>;
|
|
73
73
|
cancelRtcSession(sessionId: string): Promise<void>;
|
|
74
74
|
refreshIceServers(): Promise<ExtendedRTCIceServer[]>;
|
|
75
|
-
_refreshIceServers(): Promise<ExtendedRTCIceServer[]>;
|
|
76
|
-
setIceServers(iceServers: any[]): void;
|
|
75
|
+
_refreshIceServers(stanzaInstance?: NamedAgent): Promise<ExtendedRTCIceServer[]>;
|
|
76
|
+
setIceServers(iceServers: any[], stanzaInstance: NamedAgent): void;
|
|
77
77
|
getIceTransportPolicy(): "all" | "relay" | undefined;
|
|
78
|
-
setIceTransportPolicy(policy: 'relay' | 'all'): void;
|
|
78
|
+
setIceTransportPolicy(policy: 'relay' | 'all', stanzaInstance: NamedAgent): void;
|
|
79
79
|
getSessionTypeByJid(jid: string): SessionTypes;
|
|
80
80
|
getSessionManager(): SessionManager | undefined;
|
|
81
81
|
get expose(): WebrtcExtensionAPI;
|
package/dist/cjs/webrtc.js
CHANGED
|
@@ -12,7 +12,7 @@ const browserama_1 = require("browserama");
|
|
|
12
12
|
const webrtc_signaling_1 = require("./stanza-definitions/webrtc-signaling");
|
|
13
13
|
const media_session_1 = require("./types/media-session");
|
|
14
14
|
const utils_1 = require("./utils");
|
|
15
|
-
const
|
|
15
|
+
const client_1 = require("./client");
|
|
16
16
|
const stats_formatter_1 = require("./stats-formatter");
|
|
17
17
|
const interfaces_1 = require("./types/interfaces");
|
|
18
18
|
const events = {
|
|
@@ -65,18 +65,23 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
get jid() {
|
|
68
|
-
|
|
68
|
+
var _a;
|
|
69
|
+
return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.jid;
|
|
69
70
|
}
|
|
70
71
|
async handleStanzaInstanceChange(stanzaInstance) {
|
|
71
72
|
this.stanzaInstance = stanzaInstance;
|
|
72
|
-
|
|
73
|
+
if (this.refreshIceServersTimer) {
|
|
74
|
+
clearInterval(this.refreshIceServersTimer);
|
|
75
|
+
this.refreshIceServersTimer = null;
|
|
76
|
+
}
|
|
77
|
+
this.refreshIceServersTimer = setInterval(this.refreshIceServers.bind(this), ICE_SERVER_REFRESH_PERIOD);
|
|
73
78
|
this.client.emit('sessionManagerChange', stanzaInstance);
|
|
74
79
|
}
|
|
75
|
-
async
|
|
80
|
+
async configureNewStanzaInstance(stanzaInstance) {
|
|
76
81
|
Object.assign(stanzaInstance.jingle.config.peerConnectionConfig, {
|
|
77
82
|
sdpSemantics: 'unified-plan'
|
|
78
83
|
});
|
|
79
|
-
await this.configureStanzaIceServers();
|
|
84
|
+
await this.configureStanzaIceServers(stanzaInstance);
|
|
80
85
|
stanzaInstance.stanzas.define(webrtc_signaling_1.definitions);
|
|
81
86
|
stanzaInstance.jingle.prepareSession = this.prepareSession.bind(this);
|
|
82
87
|
stanzaInstance.jingle.on('log', (level, message, data) => {
|
|
@@ -100,24 +105,15 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
100
105
|
});
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
|
-
configureStanzaIceServers() {
|
|
108
|
+
configureStanzaIceServers(stanzaInstance) {
|
|
104
109
|
/* clear out stanzas default use of google's stun server */
|
|
105
|
-
|
|
110
|
+
stanzaInstance.jingle.config.iceServers = [];
|
|
106
111
|
/**
|
|
107
112
|
* NOTE: calling this here should not interfere with the `webrtc.ts` extension
|
|
108
113
|
* refreshingIceServers since that is async and this constructor is sync
|
|
109
114
|
*/
|
|
110
|
-
this.setIceServers([]);
|
|
111
|
-
|
|
112
|
-
clearInterval(this.refreshIceServersTimer);
|
|
113
|
-
this.refreshIceServersTimer = null;
|
|
114
|
-
}
|
|
115
|
-
this.refreshIceServersTimer = setInterval(this.refreshIceServers.bind(this), ICE_SERVER_REFRESH_PERIOD);
|
|
116
|
-
return this.refreshIceServers()
|
|
117
|
-
.catch((error) => this.logger.error('Error fetching ice servers after streaming-client connected', {
|
|
118
|
-
error,
|
|
119
|
-
channelId: this.client.config.channelId
|
|
120
|
-
}));
|
|
115
|
+
this.setIceServers([], stanzaInstance);
|
|
116
|
+
return this._refreshIceServers(stanzaInstance);
|
|
121
117
|
}
|
|
122
118
|
async handleMessage(msg) {
|
|
123
119
|
if (msg.propose) {
|
|
@@ -217,7 +213,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
217
213
|
}
|
|
218
214
|
const data = {
|
|
219
215
|
appName: 'streamingclient',
|
|
220
|
-
appVersion:
|
|
216
|
+
appVersion: client_1.Client.version,
|
|
221
217
|
originAppName: this.client.config.appName,
|
|
222
218
|
originAppVersion: this.client.config.appVersion,
|
|
223
219
|
actions: statsToSend
|
|
@@ -491,7 +487,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
491
487
|
}
|
|
492
488
|
async refreshIceServers() {
|
|
493
489
|
if (!this.refreshIceServersRetryPromise) {
|
|
494
|
-
this.refreshIceServersRetryPromise = utils_1.retryPromise(this._refreshIceServers.bind(this), (error) => {
|
|
490
|
+
this.refreshIceServersRetryPromise = utils_1.retryPromise(this._refreshIceServers.bind(this, this.stanzaInstance), (error) => {
|
|
495
491
|
if (++this.discoRetries > MAX_DISCO_RETRIES) {
|
|
496
492
|
this.logger.warn('fetching ice servers failed. max retries reached.', {
|
|
497
493
|
retryAttempt: this.discoRetries,
|
|
@@ -515,13 +511,13 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
515
511
|
this.refreshIceServersRetryPromise = undefined;
|
|
516
512
|
});
|
|
517
513
|
}
|
|
518
|
-
async _refreshIceServers() {
|
|
519
|
-
if (!
|
|
514
|
+
async _refreshIceServers(stanzaInstance) {
|
|
515
|
+
if (!stanzaInstance) {
|
|
520
516
|
throw new Error('No stanza instance to refresh ice servers');
|
|
521
517
|
}
|
|
522
|
-
const server =
|
|
523
|
-
const turnServersPromise =
|
|
524
|
-
const stunServersPromise =
|
|
518
|
+
const server = stanzaInstance.config.server;
|
|
519
|
+
const turnServersPromise = stanzaInstance.getServices(server, 'turn', '1');
|
|
520
|
+
const stunServersPromise = stanzaInstance.getServices(server, 'stun', '1');
|
|
525
521
|
const servicesPromise = new Promise((resolve, reject) => {
|
|
526
522
|
setTimeout(() => {
|
|
527
523
|
reject(new Error('Timeout waiting for refresh ice servers to finish'));
|
|
@@ -563,29 +559,25 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
563
559
|
}
|
|
564
560
|
return ice;
|
|
565
561
|
});
|
|
566
|
-
this.setIceServers(iceServers);
|
|
562
|
+
this.setIceServers(iceServers, stanzaInstance);
|
|
567
563
|
if (!stunServers.services.length) {
|
|
568
564
|
this.logger.info('No stun servers received, setting iceTransportPolicy to "relay"');
|
|
569
|
-
this.setIceTransportPolicy('relay');
|
|
565
|
+
this.setIceTransportPolicy('relay', stanzaInstance);
|
|
570
566
|
}
|
|
571
567
|
else {
|
|
572
|
-
this.setIceTransportPolicy('all');
|
|
568
|
+
this.setIceTransportPolicy('all', stanzaInstance);
|
|
573
569
|
}
|
|
574
570
|
return iceServers;
|
|
575
571
|
}
|
|
576
|
-
setIceServers(iceServers) {
|
|
577
|
-
|
|
578
|
-
this.stanzaInstance.jingle.iceServers = iceServers;
|
|
579
|
-
}
|
|
572
|
+
setIceServers(iceServers, stanzaInstance) {
|
|
573
|
+
stanzaInstance.jingle.iceServers = iceServers;
|
|
580
574
|
}
|
|
581
575
|
getIceTransportPolicy() {
|
|
582
576
|
var _a;
|
|
583
577
|
return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.jingle.config.peerConnectionConfig.iceTransportPolicy;
|
|
584
578
|
}
|
|
585
|
-
setIceTransportPolicy(policy) {
|
|
586
|
-
|
|
587
|
-
this.stanzaInstance.jingle.config.peerConnectionConfig.iceTransportPolicy = policy;
|
|
588
|
-
}
|
|
579
|
+
setIceTransportPolicy(policy, stanzaInstance) {
|
|
580
|
+
stanzaInstance.jingle.config.peerConnectionConfig.iceTransportPolicy = policy;
|
|
589
581
|
}
|
|
590
582
|
getSessionTypeByJid(jid) {
|
|
591
583
|
if (utils_1.isAcdJid(jid)) {
|
package/dist/deploy-info.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "developercenter-cdn/streaming-client",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.1",
|
|
4
4
|
"ecosystem": "pc",
|
|
5
5
|
"team": "Genesys Client Media (WebRTC)",
|
|
6
6
|
"indexFiles": [
|
|
7
7
|
{
|
|
8
|
-
"file": "/v15.0.
|
|
8
|
+
"file": "/v15.0.1/streaming-client.browser.ie.js"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
"file": "/v15.0.
|
|
11
|
+
"file": "/v15.0.1/streaming-client.browser.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"file": "/v15/streaming-client.browser.ie.js"
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"file": "/v15/streaming-client.browser.js"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
|
-
"build": "
|
|
21
|
-
"buildDate": "2022-12-
|
|
20
|
+
"build": "31",
|
|
21
|
+
"buildDate": "2022-12-20T15:24:57.873175Z"
|
|
22
22
|
}
|
package/dist/es/client.js
CHANGED
|
@@ -174,7 +174,7 @@ export class Client extends EventEmitter {
|
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
return timeoutPromise(resolve => {
|
|
177
|
-
this.
|
|
177
|
+
this.once('disconnected', resolve);
|
|
178
178
|
this.autoReconnect = false;
|
|
179
179
|
this.http.stopAllRetries();
|
|
180
180
|
this.activeStanzaInstance.disconnect();
|
|
@@ -286,6 +286,12 @@ export class Client extends EventEmitter {
|
|
|
286
286
|
this.addInateEventHandlers(stanzaInstance);
|
|
287
287
|
this.proxyStanzaEvents(stanzaInstance);
|
|
288
288
|
stanzaInstance.pinger = new Ping(this, stanzaInstance);
|
|
289
|
+
// handle any extension configuration
|
|
290
|
+
for (const extension of this.extensions) {
|
|
291
|
+
if (extension.configureNewStanzaInstance) {
|
|
292
|
+
yield extension.configureNewStanzaInstance(stanzaInstance);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
289
295
|
this.extensions.forEach(extension => extension.handleStanzaInstanceChange(stanzaInstance));
|
|
290
296
|
this.activeStanzaInstance = stanzaInstance;
|
|
291
297
|
this.emit('connected');
|
|
@@ -353,6 +359,6 @@ export class Client extends EventEmitter {
|
|
|
353
359
|
return Client.version;
|
|
354
360
|
}
|
|
355
361
|
static get version() {
|
|
356
|
-
return '15.0.
|
|
362
|
+
return '15.0.1';
|
|
357
363
|
}
|
|
358
364
|
}
|
package/dist/es/index.bundle.js
CHANGED
|
@@ -27552,21 +27552,26 @@ class WebrtcExtension extends EventEmitter {
|
|
|
27552
27552
|
});
|
|
27553
27553
|
}
|
|
27554
27554
|
get jid() {
|
|
27555
|
-
|
|
27555
|
+
var _a;
|
|
27556
|
+
return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.jid;
|
|
27556
27557
|
}
|
|
27557
27558
|
handleStanzaInstanceChange(stanzaInstance) {
|
|
27558
27559
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
27559
27560
|
this.stanzaInstance = stanzaInstance;
|
|
27560
|
-
|
|
27561
|
+
if (this.refreshIceServersTimer) {
|
|
27562
|
+
clearInterval(this.refreshIceServersTimer);
|
|
27563
|
+
this.refreshIceServersTimer = null;
|
|
27564
|
+
}
|
|
27565
|
+
this.refreshIceServersTimer = setInterval(this.refreshIceServers.bind(this), ICE_SERVER_REFRESH_PERIOD);
|
|
27561
27566
|
this.client.emit('sessionManagerChange', stanzaInstance);
|
|
27562
27567
|
});
|
|
27563
27568
|
}
|
|
27564
|
-
|
|
27569
|
+
configureNewStanzaInstance(stanzaInstance) {
|
|
27565
27570
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
27566
27571
|
Object.assign(stanzaInstance.jingle.config.peerConnectionConfig, {
|
|
27567
27572
|
sdpSemantics: 'unified-plan'
|
|
27568
27573
|
});
|
|
27569
|
-
yield this.configureStanzaIceServers();
|
|
27574
|
+
yield this.configureStanzaIceServers(stanzaInstance);
|
|
27570
27575
|
stanzaInstance.stanzas.define(definitions);
|
|
27571
27576
|
stanzaInstance.jingle.prepareSession = this.prepareSession.bind(this);
|
|
27572
27577
|
stanzaInstance.jingle.on('log', (level, message, data) => {
|
|
@@ -27591,24 +27596,15 @@ class WebrtcExtension extends EventEmitter {
|
|
|
27591
27596
|
}
|
|
27592
27597
|
});
|
|
27593
27598
|
}
|
|
27594
|
-
configureStanzaIceServers() {
|
|
27599
|
+
configureStanzaIceServers(stanzaInstance) {
|
|
27595
27600
|
/* clear out stanzas default use of google's stun server */
|
|
27596
|
-
|
|
27601
|
+
stanzaInstance.jingle.config.iceServers = [];
|
|
27597
27602
|
/**
|
|
27598
27603
|
* NOTE: calling this here should not interfere with the `webrtc.ts` extension
|
|
27599
27604
|
* refreshingIceServers since that is async and this constructor is sync
|
|
27600
27605
|
*/
|
|
27601
|
-
this.setIceServers([]);
|
|
27602
|
-
|
|
27603
|
-
clearInterval(this.refreshIceServersTimer);
|
|
27604
|
-
this.refreshIceServersTimer = null;
|
|
27605
|
-
}
|
|
27606
|
-
this.refreshIceServersTimer = setInterval(this.refreshIceServers.bind(this), ICE_SERVER_REFRESH_PERIOD);
|
|
27607
|
-
return this.refreshIceServers()
|
|
27608
|
-
.catch((error) => this.logger.error('Error fetching ice servers after streaming-client connected', {
|
|
27609
|
-
error,
|
|
27610
|
-
channelId: this.client.config.channelId
|
|
27611
|
-
}));
|
|
27606
|
+
this.setIceServers([], stanzaInstance);
|
|
27607
|
+
return this._refreshIceServers(stanzaInstance);
|
|
27612
27608
|
}
|
|
27613
27609
|
handleMessage(msg) {
|
|
27614
27610
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
@@ -27998,7 +27994,7 @@ class WebrtcExtension extends EventEmitter {
|
|
|
27998
27994
|
refreshIceServers() {
|
|
27999
27995
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
28000
27996
|
if (!this.refreshIceServersRetryPromise) {
|
|
28001
|
-
this.refreshIceServersRetryPromise = retryPromise(this._refreshIceServers.bind(this), (error) => {
|
|
27997
|
+
this.refreshIceServersRetryPromise = retryPromise(this._refreshIceServers.bind(this, this.stanzaInstance), (error) => {
|
|
28002
27998
|
if (++this.discoRetries > MAX_DISCO_RETRIES) {
|
|
28003
27999
|
this.logger.warn('fetching ice servers failed. max retries reached.', {
|
|
28004
28000
|
retryAttempt: this.discoRetries,
|
|
@@ -28023,14 +28019,14 @@ class WebrtcExtension extends EventEmitter {
|
|
|
28023
28019
|
});
|
|
28024
28020
|
});
|
|
28025
28021
|
}
|
|
28026
|
-
_refreshIceServers() {
|
|
28022
|
+
_refreshIceServers(stanzaInstance) {
|
|
28027
28023
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
28028
|
-
if (!
|
|
28024
|
+
if (!stanzaInstance) {
|
|
28029
28025
|
throw new Error('No stanza instance to refresh ice servers');
|
|
28030
28026
|
}
|
|
28031
|
-
const server =
|
|
28032
|
-
const turnServersPromise =
|
|
28033
|
-
const stunServersPromise =
|
|
28027
|
+
const server = stanzaInstance.config.server;
|
|
28028
|
+
const turnServersPromise = stanzaInstance.getServices(server, 'turn', '1');
|
|
28029
|
+
const stunServersPromise = stanzaInstance.getServices(server, 'stun', '1');
|
|
28034
28030
|
const servicesPromise = new Promise((resolve, reject) => {
|
|
28035
28031
|
setTimeout(() => {
|
|
28036
28032
|
reject(new Error('Timeout waiting for refresh ice servers to finish'));
|
|
@@ -28072,30 +28068,26 @@ class WebrtcExtension extends EventEmitter {
|
|
|
28072
28068
|
}
|
|
28073
28069
|
return ice;
|
|
28074
28070
|
});
|
|
28075
|
-
this.setIceServers(iceServers);
|
|
28071
|
+
this.setIceServers(iceServers, stanzaInstance);
|
|
28076
28072
|
if (!stunServers.services.length) {
|
|
28077
28073
|
this.logger.info('No stun servers received, setting iceTransportPolicy to "relay"');
|
|
28078
|
-
this.setIceTransportPolicy('relay');
|
|
28074
|
+
this.setIceTransportPolicy('relay', stanzaInstance);
|
|
28079
28075
|
}
|
|
28080
28076
|
else {
|
|
28081
|
-
this.setIceTransportPolicy('all');
|
|
28077
|
+
this.setIceTransportPolicy('all', stanzaInstance);
|
|
28082
28078
|
}
|
|
28083
28079
|
return iceServers;
|
|
28084
28080
|
});
|
|
28085
28081
|
}
|
|
28086
|
-
setIceServers(iceServers) {
|
|
28087
|
-
|
|
28088
|
-
this.stanzaInstance.jingle.iceServers = iceServers;
|
|
28089
|
-
}
|
|
28082
|
+
setIceServers(iceServers, stanzaInstance) {
|
|
28083
|
+
stanzaInstance.jingle.iceServers = iceServers;
|
|
28090
28084
|
}
|
|
28091
28085
|
getIceTransportPolicy() {
|
|
28092
28086
|
var _a;
|
|
28093
28087
|
return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.jingle.config.peerConnectionConfig.iceTransportPolicy;
|
|
28094
28088
|
}
|
|
28095
|
-
setIceTransportPolicy(policy) {
|
|
28096
|
-
|
|
28097
|
-
this.stanzaInstance.jingle.config.peerConnectionConfig.iceTransportPolicy = policy;
|
|
28098
|
-
}
|
|
28089
|
+
setIceTransportPolicy(policy, stanzaInstance) {
|
|
28090
|
+
stanzaInstance.jingle.config.peerConnectionConfig.iceTransportPolicy = policy;
|
|
28099
28091
|
}
|
|
28100
28092
|
getSessionTypeByJid(jid) {
|
|
28101
28093
|
if (isAcdJid(jid)) {
|
|
@@ -42873,7 +42865,7 @@ class Client extends EventEmitter {
|
|
|
42873
42865
|
return;
|
|
42874
42866
|
}
|
|
42875
42867
|
return timeoutPromise$2(resolve => {
|
|
42876
|
-
this.
|
|
42868
|
+
this.once('disconnected', resolve);
|
|
42877
42869
|
this.autoReconnect = false;
|
|
42878
42870
|
this.http.stopAllRetries();
|
|
42879
42871
|
this.activeStanzaInstance.disconnect();
|
|
@@ -42985,6 +42977,12 @@ class Client extends EventEmitter {
|
|
|
42985
42977
|
this.addInateEventHandlers(stanzaInstance);
|
|
42986
42978
|
this.proxyStanzaEvents(stanzaInstance);
|
|
42987
42979
|
stanzaInstance.pinger = new Ping(this, stanzaInstance);
|
|
42980
|
+
// handle any extension configuration
|
|
42981
|
+
for (const extension of this.extensions) {
|
|
42982
|
+
if (extension.configureNewStanzaInstance) {
|
|
42983
|
+
yield extension.configureNewStanzaInstance(stanzaInstance);
|
|
42984
|
+
}
|
|
42985
|
+
}
|
|
42988
42986
|
this.extensions.forEach(extension => extension.handleStanzaInstanceChange(stanzaInstance));
|
|
42989
42987
|
this.activeStanzaInstance = stanzaInstance;
|
|
42990
42988
|
this.emit('connected');
|
|
@@ -43052,7 +43050,7 @@ class Client extends EventEmitter {
|
|
|
43052
43050
|
return Client.version;
|
|
43053
43051
|
}
|
|
43054
43052
|
static get version() {
|
|
43055
|
-
return '15.0.
|
|
43053
|
+
return '15.0.1';
|
|
43056
43054
|
}
|
|
43057
43055
|
}
|
|
43058
43056
|
|
package/dist/es/webrtc.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import { SessionManager } from 'stanza/jingle';
|
|
4
4
|
import { SessionOpts } from 'stanza/jingle/Session';
|
|
5
5
|
import { GenesysCloudMediaSession } from './types/media-session';
|
|
6
|
-
import Client from '
|
|
6
|
+
import { Client } from './client';
|
|
7
7
|
import { ExtendedRTCIceServer, IClientOptions, SessionTypes, IPendingSession, StreamingClientExtension } from './types/interfaces';
|
|
8
8
|
import { NamedAgent } from './types/named-agent';
|
|
9
9
|
export interface InitRtcSessionOptions {
|
|
@@ -39,7 +39,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
39
39
|
get jid(): string | undefined;
|
|
40
40
|
constructor(client: Client, clientOptions: IClientOptions);
|
|
41
41
|
handleStanzaInstanceChange(stanzaInstance: NamedAgent): Promise<void>;
|
|
42
|
-
|
|
42
|
+
configureNewStanzaInstance(stanzaInstance: NamedAgent): Promise<void>;
|
|
43
43
|
private configureStanzaIceServers;
|
|
44
44
|
handleMessage(msg: any): Promise<void>;
|
|
45
45
|
prepareSession(options: SessionOpts): GenesysCloudMediaSession;
|
|
@@ -72,10 +72,10 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
72
72
|
notifyScreenShareStop(session: GenesysCloudMediaSession): Promise<void>;
|
|
73
73
|
cancelRtcSession(sessionId: string): Promise<void>;
|
|
74
74
|
refreshIceServers(): Promise<ExtendedRTCIceServer[]>;
|
|
75
|
-
_refreshIceServers(): Promise<ExtendedRTCIceServer[]>;
|
|
76
|
-
setIceServers(iceServers: any[]): void;
|
|
75
|
+
_refreshIceServers(stanzaInstance?: NamedAgent): Promise<ExtendedRTCIceServer[]>;
|
|
76
|
+
setIceServers(iceServers: any[], stanzaInstance: NamedAgent): void;
|
|
77
77
|
getIceTransportPolicy(): "all" | "relay" | undefined;
|
|
78
|
-
setIceTransportPolicy(policy: 'relay' | 'all'): void;
|
|
78
|
+
setIceTransportPolicy(policy: 'relay' | 'all', stanzaInstance: NamedAgent): void;
|
|
79
79
|
getSessionTypeByJid(jid: string): SessionTypes;
|
|
80
80
|
getSessionManager(): SessionManager | undefined;
|
|
81
81
|
get expose(): WebrtcExtensionAPI;
|
package/dist/es/webrtc.js
CHANGED
|
@@ -9,7 +9,7 @@ import { isFirefox } from 'browserama';
|
|
|
9
9
|
import { definitions } from './stanza-definitions/webrtc-signaling';
|
|
10
10
|
import { GenesysCloudMediaSession } from './types/media-session';
|
|
11
11
|
import { isAcdJid, isScreenRecordingJid, isSoftphoneJid, isVideoJid, calculatePayloadSize, retryPromise } from './utils';
|
|
12
|
-
import Client from '
|
|
12
|
+
import { Client } from './client';
|
|
13
13
|
import { formatStatsEvent } from './stats-formatter';
|
|
14
14
|
import { SessionTypes } from './types/interfaces';
|
|
15
15
|
const events = {
|
|
@@ -62,21 +62,26 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
get jid() {
|
|
65
|
-
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.jid;
|
|
66
67
|
}
|
|
67
68
|
handleStanzaInstanceChange(stanzaInstance) {
|
|
68
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
70
|
this.stanzaInstance = stanzaInstance;
|
|
70
|
-
|
|
71
|
+
if (this.refreshIceServersTimer) {
|
|
72
|
+
clearInterval(this.refreshIceServersTimer);
|
|
73
|
+
this.refreshIceServersTimer = null;
|
|
74
|
+
}
|
|
75
|
+
this.refreshIceServersTimer = setInterval(this.refreshIceServers.bind(this), ICE_SERVER_REFRESH_PERIOD);
|
|
71
76
|
this.client.emit('sessionManagerChange', stanzaInstance);
|
|
72
77
|
});
|
|
73
78
|
}
|
|
74
|
-
|
|
79
|
+
configureNewStanzaInstance(stanzaInstance) {
|
|
75
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
81
|
Object.assign(stanzaInstance.jingle.config.peerConnectionConfig, {
|
|
77
82
|
sdpSemantics: 'unified-plan'
|
|
78
83
|
});
|
|
79
|
-
yield this.configureStanzaIceServers();
|
|
84
|
+
yield this.configureStanzaIceServers(stanzaInstance);
|
|
80
85
|
stanzaInstance.stanzas.define(definitions);
|
|
81
86
|
stanzaInstance.jingle.prepareSession = this.prepareSession.bind(this);
|
|
82
87
|
stanzaInstance.jingle.on('log', (level, message, data) => {
|
|
@@ -101,24 +106,15 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
101
106
|
}
|
|
102
107
|
});
|
|
103
108
|
}
|
|
104
|
-
configureStanzaIceServers() {
|
|
109
|
+
configureStanzaIceServers(stanzaInstance) {
|
|
105
110
|
/* clear out stanzas default use of google's stun server */
|
|
106
|
-
|
|
111
|
+
stanzaInstance.jingle.config.iceServers = [];
|
|
107
112
|
/**
|
|
108
113
|
* NOTE: calling this here should not interfere with the `webrtc.ts` extension
|
|
109
114
|
* refreshingIceServers since that is async and this constructor is sync
|
|
110
115
|
*/
|
|
111
|
-
this.setIceServers([]);
|
|
112
|
-
|
|
113
|
-
clearInterval(this.refreshIceServersTimer);
|
|
114
|
-
this.refreshIceServersTimer = null;
|
|
115
|
-
}
|
|
116
|
-
this.refreshIceServersTimer = setInterval(this.refreshIceServers.bind(this), ICE_SERVER_REFRESH_PERIOD);
|
|
117
|
-
return this.refreshIceServers()
|
|
118
|
-
.catch((error) => this.logger.error('Error fetching ice servers after streaming-client connected', {
|
|
119
|
-
error,
|
|
120
|
-
channelId: this.client.config.channelId
|
|
121
|
-
}));
|
|
116
|
+
this.setIceServers([], stanzaInstance);
|
|
117
|
+
return this._refreshIceServers(stanzaInstance);
|
|
122
118
|
}
|
|
123
119
|
handleMessage(msg) {
|
|
124
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -508,7 +504,7 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
508
504
|
refreshIceServers() {
|
|
509
505
|
return __awaiter(this, void 0, void 0, function* () {
|
|
510
506
|
if (!this.refreshIceServersRetryPromise) {
|
|
511
|
-
this.refreshIceServersRetryPromise = retryPromise(this._refreshIceServers.bind(this), (error) => {
|
|
507
|
+
this.refreshIceServersRetryPromise = retryPromise(this._refreshIceServers.bind(this, this.stanzaInstance), (error) => {
|
|
512
508
|
if (++this.discoRetries > MAX_DISCO_RETRIES) {
|
|
513
509
|
this.logger.warn('fetching ice servers failed. max retries reached.', {
|
|
514
510
|
retryAttempt: this.discoRetries,
|
|
@@ -533,14 +529,14 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
533
529
|
});
|
|
534
530
|
});
|
|
535
531
|
}
|
|
536
|
-
_refreshIceServers() {
|
|
532
|
+
_refreshIceServers(stanzaInstance) {
|
|
537
533
|
return __awaiter(this, void 0, void 0, function* () {
|
|
538
|
-
if (!
|
|
534
|
+
if (!stanzaInstance) {
|
|
539
535
|
throw new Error('No stanza instance to refresh ice servers');
|
|
540
536
|
}
|
|
541
|
-
const server =
|
|
542
|
-
const turnServersPromise =
|
|
543
|
-
const stunServersPromise =
|
|
537
|
+
const server = stanzaInstance.config.server;
|
|
538
|
+
const turnServersPromise = stanzaInstance.getServices(server, 'turn', '1');
|
|
539
|
+
const stunServersPromise = stanzaInstance.getServices(server, 'stun', '1');
|
|
544
540
|
const servicesPromise = new Promise((resolve, reject) => {
|
|
545
541
|
setTimeout(() => {
|
|
546
542
|
reject(new Error('Timeout waiting for refresh ice servers to finish'));
|
|
@@ -582,30 +578,26 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
582
578
|
}
|
|
583
579
|
return ice;
|
|
584
580
|
});
|
|
585
|
-
this.setIceServers(iceServers);
|
|
581
|
+
this.setIceServers(iceServers, stanzaInstance);
|
|
586
582
|
if (!stunServers.services.length) {
|
|
587
583
|
this.logger.info('No stun servers received, setting iceTransportPolicy to "relay"');
|
|
588
|
-
this.setIceTransportPolicy('relay');
|
|
584
|
+
this.setIceTransportPolicy('relay', stanzaInstance);
|
|
589
585
|
}
|
|
590
586
|
else {
|
|
591
|
-
this.setIceTransportPolicy('all');
|
|
587
|
+
this.setIceTransportPolicy('all', stanzaInstance);
|
|
592
588
|
}
|
|
593
589
|
return iceServers;
|
|
594
590
|
});
|
|
595
591
|
}
|
|
596
|
-
setIceServers(iceServers) {
|
|
597
|
-
|
|
598
|
-
this.stanzaInstance.jingle.iceServers = iceServers;
|
|
599
|
-
}
|
|
592
|
+
setIceServers(iceServers, stanzaInstance) {
|
|
593
|
+
stanzaInstance.jingle.iceServers = iceServers;
|
|
600
594
|
}
|
|
601
595
|
getIceTransportPolicy() {
|
|
602
596
|
var _a;
|
|
603
597
|
return (_a = this.stanzaInstance) === null || _a === void 0 ? void 0 : _a.jingle.config.peerConnectionConfig.iceTransportPolicy;
|
|
604
598
|
}
|
|
605
|
-
setIceTransportPolicy(policy) {
|
|
606
|
-
|
|
607
|
-
this.stanzaInstance.jingle.config.peerConnectionConfig.iceTransportPolicy = policy;
|
|
608
|
-
}
|
|
599
|
+
setIceTransportPolicy(policy, stanzaInstance) {
|
|
600
|
+
stanzaInstance.jingle.config.peerConnectionConfig.iceTransportPolicy = policy;
|
|
609
601
|
}
|
|
610
602
|
getSessionTypeByJid(jid) {
|
|
611
603
|
if (isAcdJid(jid)) {
|
package/dist/npm/CHANGELOG.md
CHANGED
|
@@ -4,10 +4,15 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/
|
|
7
|
+
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v15.0.0...HEAD)
|
|
8
|
+
### Fixed
|
|
9
|
+
* [PCM-2045](https://inindca.atlassian.net/browse/PCM-2045) - fixed various issues with the latest release. 1) error in the streaming-client bundle when sending stats. This was due to a bad import syntax in webrtc.ts. 2) race condition for setting up spigot tests. This is happening because spigot is trying to setup a session before the ice servers have come back during bootstrap. 3) jid issues in webrtc.ts. We used to rely on the client.config.jid for the jid, but now we will pull it directly from the stanzaInstance, or it will be null.
|
|
10
|
+
|
|
11
|
+
# [v15.0.0](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v14.2.4...v15.0.0)
|
|
8
12
|
### Breaking Changes
|
|
9
|
-
* There should not be any unless you are doing things you shouldn't. If you are interacting with the stanza instance
|
|
10
|
-
e.g. `streamingClient._stanzaio`, then you'll likely have issues.
|
|
13
|
+
* There should not be any breaking changes unless you are doing things you shouldn't. If you are interacting with the stanza instance
|
|
14
|
+
itself, e.g. `streamingClient._stanzaio`, then you'll likely have issues. We made this a major version release because of the scale of
|
|
15
|
+
the changes to the connection logic.
|
|
11
16
|
|
|
12
17
|
### Fixed
|
|
13
18
|
* [PCM-2031](https://inindca.atlassian.net/browse/PCM-2031) - Allow specifying response type to fix the "No root element" error when firefox tries to parse empty XHR responses.
|
|
@@ -17,6 +22,8 @@ e.g. `streamingClient._stanzaio`, then you'll likely have issues.
|
|
|
17
22
|
of stanza. The reason for this is now we can guarantee we are not confusing events from old stanza sessions with new stanza sessions. The
|
|
18
23
|
major driver of this methodology change is because stanza's `connect()` function is not atomic and it is possible to receive a mismatched
|
|
19
24
|
number of `connected` and `disconnected` events from stanza.
|
|
25
|
+
|
|
26
|
+
# [v14.2.4](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v14.2.3...v14.2.4)
|
|
20
27
|
* [PCM-2020](https://inindca.atlassian.net/browse/PCM-2020) - Remove data-channel logs to reduce console clutter.
|
|
21
28
|
|
|
22
29
|
# [v14.2.3](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v14.2.2...v14.2.3)
|