genesys-cloud-streaming-client 19.2.0 → 19.2.1-release.1
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 +4 -6
- package/dist/cjs/http-client.d.ts +3 -1
- package/dist/cjs/http-client.js +7 -2
- package/dist/cjs/types/interfaces.d.ts +3 -0
- package/dist/cjs/webrtc.d.ts +1 -1
- package/dist/cjs/webrtc.js +11 -4
- package/dist/deploy-info.json +4 -4
- package/dist/es/client.js +4 -6
- package/dist/es/http-client.d.ts +3 -1
- package/dist/es/http-client.js +4 -2
- package/dist/es/index.bundle.js +19 -12
- package/dist/es/types/interfaces.d.ts +3 -0
- package/dist/es/webrtc.d.ts +1 -1
- package/dist/es/webrtc.js +11 -4
- package/dist/npm/CHANGELOG.md +8 -1
- package/dist/npm/client.js +4 -6
- package/dist/npm/http-client.d.ts +3 -1
- package/dist/npm/http-client.js +7 -2
- package/dist/npm/types/interfaces.d.ts +3 -0
- package/dist/npm/webrtc.d.ts +1 -1
- package/dist/npm/webrtc.js +11 -4
- package/dist/streaming-client.browser.js +4 -4
- package/dist/v19/streaming-client.browser.js +4 -4
- package/dist/v19.2.1/streaming-client.browser.js +17 -0
- package/package.json +119 -117
- package/dist/v19.2.0/streaming-client.browser.js +0 -17
package/dist/cjs/client.js
CHANGED
|
@@ -45,7 +45,7 @@ class Client extends events_1.default {
|
|
|
45
45
|
this.channelReuses = 0;
|
|
46
46
|
this.hasMadeInitialAttempt = false;
|
|
47
47
|
this.jidResource = '';
|
|
48
|
-
this.http = new http_client_1.HttpClient();
|
|
48
|
+
this.http = new http_client_1.HttpClient({ customHeaders: options.customHeaders });
|
|
49
49
|
this.reconnectOnNoLongerSubscribed = options.reconnectOnNoLongerSubscribed !== false;
|
|
50
50
|
this.useServerSidePings = options.useServerSidePings !== false;
|
|
51
51
|
this.config = {
|
|
@@ -537,8 +537,7 @@ class Client extends events_1.default {
|
|
|
537
537
|
method: 'get',
|
|
538
538
|
host: this.config.apiHost,
|
|
539
539
|
authToken: this.config.authToken,
|
|
540
|
-
logger: this.logger
|
|
541
|
-
customHeaders: this.config.customHeaders
|
|
540
|
+
logger: this.logger
|
|
542
541
|
};
|
|
543
542
|
jidPromise = await this.http.requestApi('users/me', jidRequestOpts)
|
|
544
543
|
.then(res => res.data.chat.jabberId);
|
|
@@ -549,8 +548,7 @@ class Client extends events_1.default {
|
|
|
549
548
|
method: 'post',
|
|
550
549
|
host: this.config.apiHost,
|
|
551
550
|
authToken: this.config.authToken,
|
|
552
|
-
logger: this.logger
|
|
553
|
-
customHeaders: this.config.customHeaders
|
|
551
|
+
logger: this.logger
|
|
554
552
|
};
|
|
555
553
|
const channelPromise = await this.http.requestApi('notifications/channels?connectionType=streaming', channelRequestOpts)
|
|
556
554
|
.then(res => res.data.id);
|
|
@@ -586,7 +584,7 @@ class Client extends events_1.default {
|
|
|
586
584
|
return Client.version;
|
|
587
585
|
}
|
|
588
586
|
static get version() {
|
|
589
|
-
return '19.2.
|
|
587
|
+
return '19.2.1';
|
|
590
588
|
}
|
|
591
589
|
}
|
|
592
590
|
exports.Client = Client;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RetryPromise } from './utils';
|
|
2
|
-
import { RequestApiOptions, ISuperagentNetworkError, ISuperagentResponseError, INetworkError, IResponseError } from './types/interfaces';
|
|
2
|
+
import { RequestApiOptions, ISuperagentNetworkError, ISuperagentResponseError, INetworkError, IResponseError, ICustomHeader, IHttpClientOptions } from './types/interfaces';
|
|
3
3
|
export declare class HttpClient {
|
|
4
|
+
customHeaders?: ICustomHeader;
|
|
4
5
|
private _httpRetryingRequests;
|
|
5
6
|
static retryStatusCodes: Set<number>;
|
|
7
|
+
constructor(httpClientOptions?: IHttpClientOptions);
|
|
6
8
|
requestApiWithRetry<T = any>(path: string, opts: RequestApiOptions, retryInterval?: number): RetryPromise<T>;
|
|
7
9
|
requestApi(path: string, opts: RequestApiOptions): Promise<any>;
|
|
8
10
|
private handleResponse;
|
package/dist/cjs/http-client.js
CHANGED
|
@@ -6,8 +6,9 @@ const axios_1 = tslib_1.__importStar(require("axios"));
|
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
const correlationIdHeaderName = 'inin-correlation-id';
|
|
8
8
|
class HttpClient {
|
|
9
|
-
constructor() {
|
|
9
|
+
constructor(httpClientOptions) {
|
|
10
10
|
this._httpRetryingRequests = new Map();
|
|
11
|
+
this.customHeaders = httpClientOptions === null || httpClientOptions === void 0 ? void 0 : httpClientOptions.customHeaders;
|
|
11
12
|
}
|
|
12
13
|
requestApiWithRetry(path, opts, retryInterval) {
|
|
13
14
|
const retry = utils_1.retryPromise(this.requestApi.bind(this, path, opts), (error) => {
|
|
@@ -34,10 +35,14 @@ class HttpClient {
|
|
|
34
35
|
requestApi(path, opts) {
|
|
35
36
|
const logger = opts.logger || console;
|
|
36
37
|
const start = new Date().getTime();
|
|
38
|
+
opts.customHeaders = {
|
|
39
|
+
...(this.customHeaders || {}),
|
|
40
|
+
...(opts.customHeaders || {})
|
|
41
|
+
};
|
|
37
42
|
const url = this._buildUri(opts.host, path, opts.version);
|
|
38
43
|
const headers = {
|
|
39
44
|
'content-type': opts.contentType || 'application/json',
|
|
40
|
-
...
|
|
45
|
+
...opts.customHeaders
|
|
41
46
|
};
|
|
42
47
|
const params = {
|
|
43
48
|
method: opts.method,
|
|
@@ -40,6 +40,9 @@ export interface IClientConfig {
|
|
|
40
40
|
logLevel?: LogLevel;
|
|
41
41
|
customHeaders?: ICustomHeader;
|
|
42
42
|
}
|
|
43
|
+
export interface IHttpClientOptions {
|
|
44
|
+
customHeaders?: ICustomHeader;
|
|
45
|
+
}
|
|
43
46
|
export interface ExtendedRTCIceServer extends RTCIceServer {
|
|
44
47
|
type: string;
|
|
45
48
|
}
|
package/dist/cjs/webrtc.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
43
43
|
private stanzaInstance?;
|
|
44
44
|
private webrtcSessions;
|
|
45
45
|
private reinviteCache;
|
|
46
|
-
private
|
|
46
|
+
private sessionsMap;
|
|
47
47
|
get jid(): string | undefined;
|
|
48
48
|
constructor(client: Client, clientOptions: IClientOptions);
|
|
49
49
|
private onOnlineStatusChange;
|
package/dist/cjs/webrtc.js
CHANGED
|
@@ -63,7 +63,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
63
63
|
max: 5,
|
|
64
64
|
ttl: 1000 * 60 * 3
|
|
65
65
|
});
|
|
66
|
-
this.
|
|
66
|
+
this.sessionsMap = {};
|
|
67
67
|
this.client = client;
|
|
68
68
|
this.config = {
|
|
69
69
|
allowIPv6: clientOptions.allowIPv6 === true,
|
|
@@ -219,6 +219,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
219
219
|
this.webrtcSessions = this.webrtcSessions.filter(s => s.id !== session.id);
|
|
220
220
|
});
|
|
221
221
|
this.webrtcSessions.push(session);
|
|
222
|
+
delete this.sessionsMap[session.id];
|
|
222
223
|
this.logger.info('emitting sdp media-session (offer');
|
|
223
224
|
this.applyEarlyIceCandidates(session);
|
|
224
225
|
return this.emit(events.INCOMING_RTCSESSION, session);
|
|
@@ -301,13 +302,14 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
prepareSession(options) {
|
|
304
|
-
if (this.
|
|
305
|
+
if (options.sid && this.sessionsMap[options.sid]) {
|
|
305
306
|
this.logger.debug('skipping creation of jingle webrtc session due to sdpOverXmpp');
|
|
306
307
|
return;
|
|
307
308
|
}
|
|
308
309
|
const pendingSession = this.pendingSessions[options.sid];
|
|
309
310
|
if (pendingSession) {
|
|
310
311
|
delete this.pendingSessions[pendingSession.sessionId];
|
|
312
|
+
delete this.sessionsMap[pendingSession.sessionId];
|
|
311
313
|
}
|
|
312
314
|
const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_1.isFirefox;
|
|
313
315
|
const gcSessionOpts = {
|
|
@@ -524,8 +526,10 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
524
526
|
sdpOverXmpp: msg.propose.sdpOverXmpp,
|
|
525
527
|
privAnswerMode: msg.propose.privAnswerMode
|
|
526
528
|
};
|
|
527
|
-
|
|
528
|
-
|
|
529
|
+
if (!isDuplicatePropose) {
|
|
530
|
+
this.sessionsMap[sessionInfo.id] = !!sessionInfo.sdpOverXmpp;
|
|
531
|
+
this.pendingSessions[sessionId] = sessionInfo;
|
|
532
|
+
}
|
|
529
533
|
}
|
|
530
534
|
if (sessionInfo.accepted) {
|
|
531
535
|
this.logger.info('proceed already sent for this session, but sending another', loggingParams);
|
|
@@ -536,6 +540,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
536
540
|
}
|
|
537
541
|
handleRetract(sessionId) {
|
|
538
542
|
this.logger.info('retract received', this.getLogDetailsForPendingSessionId(sessionId));
|
|
543
|
+
delete this.sessionsMap[sessionId];
|
|
539
544
|
delete this.pendingSessions[sessionId];
|
|
540
545
|
return this.emit(events.CANCEL_INCOMING_RTCSESSION, sessionId);
|
|
541
546
|
}
|
|
@@ -633,6 +638,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
633
638
|
this.emit(events.RTCSESSION_ERROR, 'Cannot reject session because it is not pending or does not exist');
|
|
634
639
|
return;
|
|
635
640
|
}
|
|
641
|
+
delete this.sessionsMap[sessionId];
|
|
636
642
|
delete this.pendingSessions[sessionId];
|
|
637
643
|
if (ignore) {
|
|
638
644
|
this.ignoredSessions.set(sessionId, true);
|
|
@@ -708,6 +714,7 @@ class WebrtcExtension extends events_1.EventEmitter {
|
|
|
708
714
|
}
|
|
709
715
|
};
|
|
710
716
|
delete this.pendingSessions[sessionId];
|
|
717
|
+
delete this.sessionsMap[sessionId];
|
|
711
718
|
this.logger.info('sending jingle retract', logDetails);
|
|
712
719
|
await this.stanzaInstance.send('message', retract); // send as Message
|
|
713
720
|
this.logger.info('sent jingle retract', logDetails);
|
package/dist/deploy-info.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "developercenter-cdn/streaming-client",
|
|
3
|
-
"version": "19.2.
|
|
3
|
+
"version": "19.2.1",
|
|
4
4
|
"ecosystem": "pc",
|
|
5
5
|
"team": "Client Streaming and Signaling",
|
|
6
6
|
"indexFiles": [
|
|
7
7
|
{
|
|
8
|
-
"file": "v19.2.
|
|
8
|
+
"file": "v19.2.1/streaming-client.browser.js"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"file": "v19/streaming-client.browser.js"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"build": "
|
|
15
|
-
"buildDate": "2025-
|
|
14
|
+
"build": "1",
|
|
15
|
+
"buildDate": "2025-06-02T21:45:04.977002900Z",
|
|
16
16
|
"appName": "developercenter-cdn/streaming-client",
|
|
17
17
|
"gcServiceName": "developercenter-cdn--streaming-client-webui"
|
|
18
18
|
}
|
package/dist/es/client.js
CHANGED
|
@@ -43,7 +43,7 @@ export class Client extends EventEmitter {
|
|
|
43
43
|
this.channelReuses = 0;
|
|
44
44
|
this.hasMadeInitialAttempt = false;
|
|
45
45
|
this.jidResource = '';
|
|
46
|
-
this.http = new HttpClient();
|
|
46
|
+
this.http = new HttpClient({ customHeaders: options.customHeaders });
|
|
47
47
|
this.reconnectOnNoLongerSubscribed = options.reconnectOnNoLongerSubscribed !== false;
|
|
48
48
|
this.useServerSidePings = options.useServerSidePings !== false;
|
|
49
49
|
this.config = {
|
|
@@ -548,8 +548,7 @@ export class Client extends EventEmitter {
|
|
|
548
548
|
method: 'get',
|
|
549
549
|
host: this.config.apiHost,
|
|
550
550
|
authToken: this.config.authToken,
|
|
551
|
-
logger: this.logger
|
|
552
|
-
customHeaders: this.config.customHeaders
|
|
551
|
+
logger: this.logger
|
|
553
552
|
};
|
|
554
553
|
jidPromise = yield this.http.requestApi('users/me', jidRequestOpts)
|
|
555
554
|
.then(res => res.data.chat.jabberId);
|
|
@@ -560,8 +559,7 @@ export class Client extends EventEmitter {
|
|
|
560
559
|
method: 'post',
|
|
561
560
|
host: this.config.apiHost,
|
|
562
561
|
authToken: this.config.authToken,
|
|
563
|
-
logger: this.logger
|
|
564
|
-
customHeaders: this.config.customHeaders
|
|
562
|
+
logger: this.logger
|
|
565
563
|
};
|
|
566
564
|
const channelPromise = yield this.http.requestApi('notifications/channels?connectionType=streaming', channelRequestOpts)
|
|
567
565
|
.then(res => res.data.id);
|
|
@@ -598,6 +596,6 @@ export class Client extends EventEmitter {
|
|
|
598
596
|
return Client.version;
|
|
599
597
|
}
|
|
600
598
|
static get version() {
|
|
601
|
-
return '19.2.
|
|
599
|
+
return '19.2.1';
|
|
602
600
|
}
|
|
603
601
|
}
|
package/dist/es/http-client.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RetryPromise } from './utils';
|
|
2
|
-
import { RequestApiOptions, ISuperagentNetworkError, ISuperagentResponseError, INetworkError, IResponseError } from './types/interfaces';
|
|
2
|
+
import { RequestApiOptions, ISuperagentNetworkError, ISuperagentResponseError, INetworkError, IResponseError, ICustomHeader, IHttpClientOptions } from './types/interfaces';
|
|
3
3
|
export declare class HttpClient {
|
|
4
|
+
customHeaders?: ICustomHeader;
|
|
4
5
|
private _httpRetryingRequests;
|
|
5
6
|
static retryStatusCodes: Set<number>;
|
|
7
|
+
constructor(httpClientOptions?: IHttpClientOptions);
|
|
6
8
|
requestApiWithRetry<T = any>(path: string, opts: RequestApiOptions, retryInterval?: number): RetryPromise<T>;
|
|
7
9
|
requestApi(path: string, opts: RequestApiOptions): Promise<any>;
|
|
8
10
|
private handleResponse;
|
package/dist/es/http-client.js
CHANGED
|
@@ -2,8 +2,9 @@ import axios, { AxiosError } from 'axios';
|
|
|
2
2
|
import { retryPromise } from './utils';
|
|
3
3
|
const correlationIdHeaderName = 'inin-correlation-id';
|
|
4
4
|
export class HttpClient {
|
|
5
|
-
constructor() {
|
|
5
|
+
constructor(httpClientOptions) {
|
|
6
6
|
this._httpRetryingRequests = new Map();
|
|
7
|
+
this.customHeaders = httpClientOptions === null || httpClientOptions === void 0 ? void 0 : httpClientOptions.customHeaders;
|
|
7
8
|
}
|
|
8
9
|
requestApiWithRetry(path, opts, retryInterval) {
|
|
9
10
|
const retry = retryPromise(this.requestApi.bind(this, path, opts), (error) => {
|
|
@@ -30,8 +31,9 @@ export class HttpClient {
|
|
|
30
31
|
requestApi(path, opts) {
|
|
31
32
|
const logger = opts.logger || console;
|
|
32
33
|
const start = new Date().getTime();
|
|
34
|
+
opts.customHeaders = Object.assign(Object.assign({}, (this.customHeaders || {})), (opts.customHeaders || {}));
|
|
33
35
|
const url = this._buildUri(opts.host, path, opts.version);
|
|
34
|
-
const headers = Object.assign({ 'content-type': opts.contentType || 'application/json' },
|
|
36
|
+
const headers = Object.assign({ 'content-type': opts.contentType || 'application/json' }, opts.customHeaders);
|
|
35
37
|
const params = {
|
|
36
38
|
method: opts.method,
|
|
37
39
|
url,
|
package/dist/es/index.bundle.js
CHANGED
|
@@ -31787,8 +31787,9 @@ class GenesysCloudMediaSession {
|
|
|
31787
31787
|
|
|
31788
31788
|
const correlationIdHeaderName = 'inin-correlation-id';
|
|
31789
31789
|
class HttpClient {
|
|
31790
|
-
constructor() {
|
|
31790
|
+
constructor(httpClientOptions) {
|
|
31791
31791
|
this._httpRetryingRequests = new Map();
|
|
31792
|
+
this.customHeaders = httpClientOptions === null || httpClientOptions === void 0 ? void 0 : httpClientOptions.customHeaders;
|
|
31792
31793
|
}
|
|
31793
31794
|
requestApiWithRetry(path, opts, retryInterval) {
|
|
31794
31795
|
const retry = retryPromise(this.requestApi.bind(this, path, opts), (error) => {
|
|
@@ -31815,8 +31816,9 @@ class HttpClient {
|
|
|
31815
31816
|
requestApi(path, opts) {
|
|
31816
31817
|
const logger = opts.logger || console;
|
|
31817
31818
|
const start = new Date().getTime();
|
|
31819
|
+
opts.customHeaders = Object.assign(Object.assign({}, (this.customHeaders || {})), (opts.customHeaders || {}));
|
|
31818
31820
|
const url = this._buildUri(opts.host, path, opts.version);
|
|
31819
|
-
const headers = Object.assign({ 'content-type': opts.contentType || 'application/json' },
|
|
31821
|
+
const headers = Object.assign({ 'content-type': opts.contentType || 'application/json' }, opts.customHeaders);
|
|
31820
31822
|
const params = {
|
|
31821
31823
|
method: opts.method,
|
|
31822
31824
|
url,
|
|
@@ -32001,7 +32003,7 @@ class WebrtcExtension extends EventEmitter {
|
|
|
32001
32003
|
max: 5,
|
|
32002
32004
|
ttl: 1000 * 60 * 3
|
|
32003
32005
|
});
|
|
32004
|
-
this.
|
|
32006
|
+
this.sessionsMap = {};
|
|
32005
32007
|
this.client = client;
|
|
32006
32008
|
this.config = {
|
|
32007
32009
|
allowIPv6: clientOptions.allowIPv6 === true,
|
|
@@ -32156,6 +32158,7 @@ class WebrtcExtension extends EventEmitter {
|
|
|
32156
32158
|
this.webrtcSessions = this.webrtcSessions.filter(s => s.id !== session.id);
|
|
32157
32159
|
});
|
|
32158
32160
|
this.webrtcSessions.push(session);
|
|
32161
|
+
delete this.sessionsMap[session.id];
|
|
32159
32162
|
this.logger.info('emitting sdp media-session (offer');
|
|
32160
32163
|
this.applyEarlyIceCandidates(session);
|
|
32161
32164
|
return this.emit(events.INCOMING_RTCSESSION, session);
|
|
@@ -32251,13 +32254,14 @@ class WebrtcExtension extends EventEmitter {
|
|
|
32251
32254
|
});
|
|
32252
32255
|
}
|
|
32253
32256
|
prepareSession(options) {
|
|
32254
|
-
if (this.
|
|
32257
|
+
if (options.sid && this.sessionsMap[options.sid]) {
|
|
32255
32258
|
this.logger.debug('skipping creation of jingle webrtc session due to sdpOverXmpp');
|
|
32256
32259
|
return;
|
|
32257
32260
|
}
|
|
32258
32261
|
const pendingSession = this.pendingSessions[options.sid];
|
|
32259
32262
|
if (pendingSession) {
|
|
32260
32263
|
delete this.pendingSessions[pendingSession.sessionId];
|
|
32264
|
+
delete this.sessionsMap[pendingSession.sessionId];
|
|
32261
32265
|
}
|
|
32262
32266
|
const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_min.exports.isFirefox;
|
|
32263
32267
|
const gcSessionOpts = {
|
|
@@ -32467,8 +32471,10 @@ class WebrtcExtension extends EventEmitter {
|
|
|
32467
32471
|
sessionInfo = Object.assign(Object.assign({}, msg.propose), { toJid: msg.to, fromJid,
|
|
32468
32472
|
sessionType,
|
|
32469
32473
|
roomJid, id: sessionId, sdpOverXmpp: msg.propose.sdpOverXmpp, privAnswerMode: msg.propose.privAnswerMode });
|
|
32470
|
-
|
|
32471
|
-
|
|
32474
|
+
if (!isDuplicatePropose) {
|
|
32475
|
+
this.sessionsMap[sessionInfo.id] = !!sessionInfo.sdpOverXmpp;
|
|
32476
|
+
this.pendingSessions[sessionId] = sessionInfo;
|
|
32477
|
+
}
|
|
32472
32478
|
}
|
|
32473
32479
|
if (sessionInfo.accepted) {
|
|
32474
32480
|
this.logger.info('proceed already sent for this session, but sending another', loggingParams);
|
|
@@ -32480,6 +32486,7 @@ class WebrtcExtension extends EventEmitter {
|
|
|
32480
32486
|
}
|
|
32481
32487
|
handleRetract(sessionId) {
|
|
32482
32488
|
this.logger.info('retract received', this.getLogDetailsForPendingSessionId(sessionId));
|
|
32489
|
+
delete this.sessionsMap[sessionId];
|
|
32483
32490
|
delete this.pendingSessions[sessionId];
|
|
32484
32491
|
return this.emit(events.CANCEL_INCOMING_RTCSESSION, sessionId);
|
|
32485
32492
|
}
|
|
@@ -32582,6 +32589,7 @@ class WebrtcExtension extends EventEmitter {
|
|
|
32582
32589
|
this.emit(events.RTCSESSION_ERROR, 'Cannot reject session because it is not pending or does not exist');
|
|
32583
32590
|
return;
|
|
32584
32591
|
}
|
|
32592
|
+
delete this.sessionsMap[sessionId];
|
|
32585
32593
|
delete this.pendingSessions[sessionId];
|
|
32586
32594
|
if (ignore) {
|
|
32587
32595
|
this.ignoredSessions.set(sessionId, true);
|
|
@@ -32665,6 +32673,7 @@ class WebrtcExtension extends EventEmitter {
|
|
|
32665
32673
|
}
|
|
32666
32674
|
};
|
|
32667
32675
|
delete this.pendingSessions[sessionId];
|
|
32676
|
+
delete this.sessionsMap[sessionId];
|
|
32668
32677
|
this.logger.info('sending jingle retract', logDetails);
|
|
32669
32678
|
yield this.stanzaInstance.send('message', retract); // send as Message
|
|
32670
32679
|
this.logger.info('sent jingle retract', logDetails);
|
|
@@ -42917,7 +42926,7 @@ class Client extends EventEmitter {
|
|
|
42917
42926
|
this.channelReuses = 0;
|
|
42918
42927
|
this.hasMadeInitialAttempt = false;
|
|
42919
42928
|
this.jidResource = '';
|
|
42920
|
-
this.http = new HttpClient();
|
|
42929
|
+
this.http = new HttpClient({ customHeaders: options.customHeaders });
|
|
42921
42930
|
this.reconnectOnNoLongerSubscribed = options.reconnectOnNoLongerSubscribed !== false;
|
|
42922
42931
|
this.useServerSidePings = options.useServerSidePings !== false;
|
|
42923
42932
|
this.config = {
|
|
@@ -43422,8 +43431,7 @@ class Client extends EventEmitter {
|
|
|
43422
43431
|
method: 'get',
|
|
43423
43432
|
host: this.config.apiHost,
|
|
43424
43433
|
authToken: this.config.authToken,
|
|
43425
|
-
logger: this.logger
|
|
43426
|
-
customHeaders: this.config.customHeaders
|
|
43434
|
+
logger: this.logger
|
|
43427
43435
|
};
|
|
43428
43436
|
jidPromise = yield this.http.requestApi('users/me', jidRequestOpts)
|
|
43429
43437
|
.then(res => res.data.chat.jabberId);
|
|
@@ -43434,8 +43442,7 @@ class Client extends EventEmitter {
|
|
|
43434
43442
|
method: 'post',
|
|
43435
43443
|
host: this.config.apiHost,
|
|
43436
43444
|
authToken: this.config.authToken,
|
|
43437
|
-
logger: this.logger
|
|
43438
|
-
customHeaders: this.config.customHeaders
|
|
43445
|
+
logger: this.logger
|
|
43439
43446
|
};
|
|
43440
43447
|
const channelPromise = yield this.http.requestApi('notifications/channels?connectionType=streaming', channelRequestOpts)
|
|
43441
43448
|
.then(res => res.data.id);
|
|
@@ -43472,7 +43479,7 @@ class Client extends EventEmitter {
|
|
|
43472
43479
|
return Client.version;
|
|
43473
43480
|
}
|
|
43474
43481
|
static get version() {
|
|
43475
|
-
return '19.2.
|
|
43482
|
+
return '19.2.1';
|
|
43476
43483
|
}
|
|
43477
43484
|
}
|
|
43478
43485
|
|
|
@@ -40,6 +40,9 @@ export interface IClientConfig {
|
|
|
40
40
|
logLevel?: LogLevel;
|
|
41
41
|
customHeaders?: ICustomHeader;
|
|
42
42
|
}
|
|
43
|
+
export interface IHttpClientOptions {
|
|
44
|
+
customHeaders?: ICustomHeader;
|
|
45
|
+
}
|
|
43
46
|
export interface ExtendedRTCIceServer extends RTCIceServer {
|
|
44
47
|
type: string;
|
|
45
48
|
}
|
package/dist/es/webrtc.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
43
43
|
private stanzaInstance?;
|
|
44
44
|
private webrtcSessions;
|
|
45
45
|
private reinviteCache;
|
|
46
|
-
private
|
|
46
|
+
private sessionsMap;
|
|
47
47
|
get jid(): string | undefined;
|
|
48
48
|
constructor(client: Client, clientOptions: IClientOptions);
|
|
49
49
|
private onOnlineStatusChange;
|
package/dist/es/webrtc.js
CHANGED
|
@@ -60,7 +60,7 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
60
60
|
max: 5,
|
|
61
61
|
ttl: 1000 * 60 * 3
|
|
62
62
|
});
|
|
63
|
-
this.
|
|
63
|
+
this.sessionsMap = {};
|
|
64
64
|
this.client = client;
|
|
65
65
|
this.config = {
|
|
66
66
|
allowIPv6: clientOptions.allowIPv6 === true,
|
|
@@ -215,6 +215,7 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
215
215
|
this.webrtcSessions = this.webrtcSessions.filter(s => s.id !== session.id);
|
|
216
216
|
});
|
|
217
217
|
this.webrtcSessions.push(session);
|
|
218
|
+
delete this.sessionsMap[session.id];
|
|
218
219
|
this.logger.info('emitting sdp media-session (offer');
|
|
219
220
|
this.applyEarlyIceCandidates(session);
|
|
220
221
|
return this.emit(events.INCOMING_RTCSESSION, session);
|
|
@@ -310,13 +311,14 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
310
311
|
});
|
|
311
312
|
}
|
|
312
313
|
prepareSession(options) {
|
|
313
|
-
if (this.
|
|
314
|
+
if (options.sid && this.sessionsMap[options.sid]) {
|
|
314
315
|
this.logger.debug('skipping creation of jingle webrtc session due to sdpOverXmpp');
|
|
315
316
|
return;
|
|
316
317
|
}
|
|
317
318
|
const pendingSession = this.pendingSessions[options.sid];
|
|
318
319
|
if (pendingSession) {
|
|
319
320
|
delete this.pendingSessions[pendingSession.sessionId];
|
|
321
|
+
delete this.sessionsMap[pendingSession.sessionId];
|
|
320
322
|
}
|
|
321
323
|
const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && isFirefox;
|
|
322
324
|
const gcSessionOpts = {
|
|
@@ -526,8 +528,10 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
526
528
|
sessionInfo = Object.assign(Object.assign({}, msg.propose), { toJid: msg.to, fromJid,
|
|
527
529
|
sessionType,
|
|
528
530
|
roomJid, id: sessionId, sdpOverXmpp: msg.propose.sdpOverXmpp, privAnswerMode: msg.propose.privAnswerMode });
|
|
529
|
-
|
|
530
|
-
|
|
531
|
+
if (!isDuplicatePropose) {
|
|
532
|
+
this.sessionsMap[sessionInfo.id] = !!sessionInfo.sdpOverXmpp;
|
|
533
|
+
this.pendingSessions[sessionId] = sessionInfo;
|
|
534
|
+
}
|
|
531
535
|
}
|
|
532
536
|
if (sessionInfo.accepted) {
|
|
533
537
|
this.logger.info('proceed already sent for this session, but sending another', loggingParams);
|
|
@@ -539,6 +543,7 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
539
543
|
}
|
|
540
544
|
handleRetract(sessionId) {
|
|
541
545
|
this.logger.info('retract received', this.getLogDetailsForPendingSessionId(sessionId));
|
|
546
|
+
delete this.sessionsMap[sessionId];
|
|
542
547
|
delete this.pendingSessions[sessionId];
|
|
543
548
|
return this.emit(events.CANCEL_INCOMING_RTCSESSION, sessionId);
|
|
544
549
|
}
|
|
@@ -641,6 +646,7 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
641
646
|
this.emit(events.RTCSESSION_ERROR, 'Cannot reject session because it is not pending or does not exist');
|
|
642
647
|
return;
|
|
643
648
|
}
|
|
649
|
+
delete this.sessionsMap[sessionId];
|
|
644
650
|
delete this.pendingSessions[sessionId];
|
|
645
651
|
if (ignore) {
|
|
646
652
|
this.ignoredSessions.set(sessionId, true);
|
|
@@ -724,6 +730,7 @@ export class WebrtcExtension extends EventEmitter {
|
|
|
724
730
|
}
|
|
725
731
|
};
|
|
726
732
|
delete this.pendingSessions[sessionId];
|
|
733
|
+
delete this.sessionsMap[sessionId];
|
|
727
734
|
this.logger.info('sending jingle retract', logDetails);
|
|
728
735
|
yield this.stanzaInstance.send('message', retract); // send as Message
|
|
729
736
|
this.logger.info('sent jingle retract', logDetails);
|
package/dist/npm/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,14 @@ 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/v19.2.
|
|
7
|
+
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.2.1...HEAD)
|
|
8
|
+
|
|
9
|
+
# [v19.2.1](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.2.0...v19.2.1)
|
|
10
|
+
### Fixed
|
|
11
|
+
* [STREAM-524](https://inindca.atlassian.net/browse/STREAM-524) - Fix issue where sdpOverXmpp flag could be overridden by a subsequent propose.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
* [STREAM-63](https://inindca.atlassian.net/browse/STREAM-63) - Added in check to ensure customHeaders is passed in for every API request call
|
|
8
15
|
|
|
9
16
|
# [v19.2.0](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.1.0...v19.2.0)
|
|
10
17
|
### Changed
|
package/dist/npm/client.js
CHANGED
|
@@ -45,7 +45,7 @@ class Client extends events_1.default {
|
|
|
45
45
|
this.channelReuses = 0;
|
|
46
46
|
this.hasMadeInitialAttempt = false;
|
|
47
47
|
this.jidResource = '';
|
|
48
|
-
this.http = new http_client_1.HttpClient();
|
|
48
|
+
this.http = new http_client_1.HttpClient({ customHeaders: options.customHeaders });
|
|
49
49
|
this.reconnectOnNoLongerSubscribed = options.reconnectOnNoLongerSubscribed !== false;
|
|
50
50
|
this.useServerSidePings = options.useServerSidePings !== false;
|
|
51
51
|
this.config = {
|
|
@@ -537,8 +537,7 @@ class Client extends events_1.default {
|
|
|
537
537
|
method: 'get',
|
|
538
538
|
host: this.config.apiHost,
|
|
539
539
|
authToken: this.config.authToken,
|
|
540
|
-
logger: this.logger
|
|
541
|
-
customHeaders: this.config.customHeaders
|
|
540
|
+
logger: this.logger
|
|
542
541
|
};
|
|
543
542
|
jidPromise = await this.http.requestApi('users/me', jidRequestOpts)
|
|
544
543
|
.then(res => res.data.chat.jabberId);
|
|
@@ -549,8 +548,7 @@ class Client extends events_1.default {
|
|
|
549
548
|
method: 'post',
|
|
550
549
|
host: this.config.apiHost,
|
|
551
550
|
authToken: this.config.authToken,
|
|
552
|
-
logger: this.logger
|
|
553
|
-
customHeaders: this.config.customHeaders
|
|
551
|
+
logger: this.logger
|
|
554
552
|
};
|
|
555
553
|
const channelPromise = await this.http.requestApi('notifications/channels?connectionType=streaming', channelRequestOpts)
|
|
556
554
|
.then(res => res.data.id);
|
|
@@ -586,7 +584,7 @@ class Client extends events_1.default {
|
|
|
586
584
|
return Client.version;
|
|
587
585
|
}
|
|
588
586
|
static get version() {
|
|
589
|
-
return '19.2.
|
|
587
|
+
return '19.2.1';
|
|
590
588
|
}
|
|
591
589
|
}
|
|
592
590
|
exports.Client = Client;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RetryPromise } from './utils';
|
|
2
|
-
import { RequestApiOptions, ISuperagentNetworkError, ISuperagentResponseError, INetworkError, IResponseError } from './types/interfaces';
|
|
2
|
+
import { RequestApiOptions, ISuperagentNetworkError, ISuperagentResponseError, INetworkError, IResponseError, ICustomHeader, IHttpClientOptions } from './types/interfaces';
|
|
3
3
|
export declare class HttpClient {
|
|
4
|
+
customHeaders?: ICustomHeader;
|
|
4
5
|
private _httpRetryingRequests;
|
|
5
6
|
static retryStatusCodes: Set<number>;
|
|
7
|
+
constructor(httpClientOptions?: IHttpClientOptions);
|
|
6
8
|
requestApiWithRetry<T = any>(path: string, opts: RequestApiOptions, retryInterval?: number): RetryPromise<T>;
|
|
7
9
|
requestApi(path: string, opts: RequestApiOptions): Promise<any>;
|
|
8
10
|
private handleResponse;
|
package/dist/npm/http-client.js
CHANGED
|
@@ -6,8 +6,9 @@ const axios_1 = tslib_1.__importStar(require("axios"));
|
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
const correlationIdHeaderName = 'inin-correlation-id';
|
|
8
8
|
class HttpClient {
|
|
9
|
-
constructor() {
|
|
9
|
+
constructor(httpClientOptions) {
|
|
10
10
|
this._httpRetryingRequests = new Map();
|
|
11
|
+
this.customHeaders = httpClientOptions === null || httpClientOptions === void 0 ? void 0 : httpClientOptions.customHeaders;
|
|
11
12
|
}
|
|
12
13
|
requestApiWithRetry(path, opts, retryInterval) {
|
|
13
14
|
const retry = utils_1.retryPromise(this.requestApi.bind(this, path, opts), (error) => {
|
|
@@ -34,10 +35,14 @@ class HttpClient {
|
|
|
34
35
|
requestApi(path, opts) {
|
|
35
36
|
const logger = opts.logger || console;
|
|
36
37
|
const start = new Date().getTime();
|
|
38
|
+
opts.customHeaders = {
|
|
39
|
+
...(this.customHeaders || {}),
|
|
40
|
+
...(opts.customHeaders || {})
|
|
41
|
+
};
|
|
37
42
|
const url = this._buildUri(opts.host, path, opts.version);
|
|
38
43
|
const headers = {
|
|
39
44
|
'content-type': opts.contentType || 'application/json',
|
|
40
|
-
...
|
|
45
|
+
...opts.customHeaders
|
|
41
46
|
};
|
|
42
47
|
const params = {
|
|
43
48
|
method: opts.method,
|
|
@@ -40,6 +40,9 @@ export interface IClientConfig {
|
|
|
40
40
|
logLevel?: LogLevel;
|
|
41
41
|
customHeaders?: ICustomHeader;
|
|
42
42
|
}
|
|
43
|
+
export interface IHttpClientOptions {
|
|
44
|
+
customHeaders?: ICustomHeader;
|
|
45
|
+
}
|
|
43
46
|
export interface ExtendedRTCIceServer extends RTCIceServer {
|
|
44
47
|
type: string;
|
|
45
48
|
}
|
package/dist/npm/webrtc.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
|
|
|
43
43
|
private stanzaInstance?;
|
|
44
44
|
private webrtcSessions;
|
|
45
45
|
private reinviteCache;
|
|
46
|
-
private
|
|
46
|
+
private sessionsMap;
|
|
47
47
|
get jid(): string | undefined;
|
|
48
48
|
constructor(client: Client, clientOptions: IClientOptions);
|
|
49
49
|
private onOnlineStatusChange;
|