@wazo/sdk 0.37.23 → 0.37.24
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/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
package/lib/web-rtc-client.js
CHANGED
|
@@ -111,7 +111,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
111
111
|
|
|
112
112
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
113
113
|
|
|
114
|
-
const logger
|
|
114
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
115
115
|
|
|
116
116
|
// Use a function here to be able to mock it in tests
|
|
117
117
|
const realFetch = () => {
|
|
@@ -250,7 +250,7 @@ class ApiRequester {
|
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
if (this.refreshTokenPromise) {
|
|
253
|
-
logger
|
|
253
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
254
254
|
await this.refreshTokenPromise;
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -270,7 +270,7 @@ class ApiRequester {
|
|
|
270
270
|
return promise.then(async (err ) => {
|
|
271
271
|
// Check if the token is still valid
|
|
272
272
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
273
|
-
logger
|
|
273
|
+
logger.warn('token expired', { error: err.reason });
|
|
274
274
|
// Replay the call after refreshing the token
|
|
275
275
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
276
276
|
}
|
|
@@ -280,7 +280,7 @@ class ApiRequester {
|
|
|
280
280
|
: exceptionClass.fromResponse(err, response.status);
|
|
281
281
|
|
|
282
282
|
if (this.shouldLogErrors) {
|
|
283
|
-
logger
|
|
283
|
+
logger.error('API error', error);
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
throw error;
|
|
@@ -290,7 +290,7 @@ class ApiRequester {
|
|
|
290
290
|
return newParse(response, isJson);
|
|
291
291
|
}).catch(error => {
|
|
292
292
|
if (this.shouldLogErrors) {
|
|
293
|
-
logger
|
|
293
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
throw error;
|
|
@@ -318,13 +318,13 @@ class ApiRequester {
|
|
|
318
318
|
) {
|
|
319
319
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
320
320
|
let newPath = path;
|
|
321
|
-
logger
|
|
321
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
322
322
|
|
|
323
323
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
324
324
|
|
|
325
325
|
return this.refreshTokenPromise.then(() => {
|
|
326
326
|
this.refreshTokenPromise = null;
|
|
327
|
-
logger
|
|
327
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
328
328
|
if (isTokenNotFound) {
|
|
329
329
|
const pathParts = path.split('/');
|
|
330
330
|
pathParts.pop();
|
|
@@ -3165,8 +3165,9 @@ class ExternalApp {
|
|
|
3165
3165
|
|
|
3166
3166
|
|
|
3167
3167
|
|
|
3168
|
-
|
|
3168
|
+
|
|
3169
3169
|
|
|
3170
|
+
|
|
3170
3171
|
|
|
3171
3172
|
|
|
3172
3173
|
class Meeting {
|
|
@@ -3177,9 +3178,10 @@ class Meeting {
|
|
|
3177
3178
|
|
|
3178
3179
|
|
|
3179
3180
|
|
|
3180
|
-
|
|
3181
|
+
|
|
3181
3182
|
|
|
3182
3183
|
|
|
3184
|
+
|
|
3183
3185
|
|
|
3184
3186
|
static parse(plain ) {
|
|
3185
3187
|
return new Meeting({
|
|
@@ -3189,8 +3191,9 @@ class Meeting {
|
|
|
3189
3191
|
ownerUuids: plain.owner_uuids,
|
|
3190
3192
|
port: plain.port,
|
|
3191
3193
|
uuid: plain.uuid,
|
|
3192
|
-
|
|
3194
|
+
extension: plain.exten,
|
|
3193
3195
|
persistent: plain.persistent,
|
|
3196
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3194
3197
|
});
|
|
3195
3198
|
}
|
|
3196
3199
|
|
|
@@ -3212,8 +3215,9 @@ class Meeting {
|
|
|
3212
3215
|
ownerUuids,
|
|
3213
3216
|
port,
|
|
3214
3217
|
uri,
|
|
3215
|
-
|
|
3218
|
+
extension,
|
|
3216
3219
|
persistent,
|
|
3220
|
+
creationTime,
|
|
3217
3221
|
} = {}) {
|
|
3218
3222
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3219
3223
|
this.uri = uri;
|
|
@@ -3221,8 +3225,9 @@ class Meeting {
|
|
|
3221
3225
|
this.ownerUuids = ownerUuids;
|
|
3222
3226
|
this.port = port;
|
|
3223
3227
|
this.uuid = uuid;
|
|
3224
|
-
this.
|
|
3228
|
+
this.extension = extension;
|
|
3225
3229
|
this.persistent = persistent;
|
|
3230
|
+
this.creationTime = creationTime;
|
|
3226
3231
|
|
|
3227
3232
|
// Useful to compare instead of instanceof with minified code
|
|
3228
3233
|
this.type = 'Meeting';
|
|
@@ -4144,7 +4149,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4144
4149
|
|
|
4145
4150
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4146
4151
|
|
|
4147
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4152
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4148
4153
|
|
|
4149
4154
|
/* */
|
|
4150
4155
|
|
|
@@ -5063,7 +5068,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5063
5068
|
const WEBHOOKD_VERSION = '1.0';
|
|
5064
5069
|
const AMID_VERSION = '1.0';
|
|
5065
5070
|
|
|
5066
|
-
const logger$
|
|
5071
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5067
5072
|
|
|
5068
5073
|
class ApiClient {
|
|
5069
5074
|
|
|
@@ -5115,12 +5120,12 @@ class ApiClient {
|
|
|
5115
5120
|
}
|
|
5116
5121
|
|
|
5117
5122
|
async forceRefreshToken() {
|
|
5118
|
-
logger$
|
|
5123
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5119
5124
|
return this.refreshTokenCallback();
|
|
5120
5125
|
}
|
|
5121
5126
|
|
|
5122
5127
|
async refreshTokenCallback() {
|
|
5123
|
-
logger$
|
|
5128
|
+
logger$2.info('refresh token callback called', {
|
|
5124
5129
|
refreshToken: this.refreshToken,
|
|
5125
5130
|
refreshBackend: this.refreshBackend,
|
|
5126
5131
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5138,7 +5143,7 @@ class ApiClient {
|
|
|
5138
5143
|
this.isMobile,
|
|
5139
5144
|
);
|
|
5140
5145
|
|
|
5141
|
-
logger$
|
|
5146
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5142
5147
|
|
|
5143
5148
|
if (this.onRefreshToken) {
|
|
5144
5149
|
this.onRefreshToken(session.token, session);
|
|
@@ -5311,7 +5316,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
5311
5316
|
const SEND_STATS_DELAY = 5000;
|
|
5312
5317
|
|
|
5313
5318
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
5314
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5319
|
+
const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5315
5320
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
5316
5321
|
|
|
5317
5322
|
// events
|
|
@@ -5490,13 +5495,13 @@ class WebRTCClient extends Emitter {
|
|
|
5490
5495
|
|
|
5491
5496
|
createUserAgent(configOverrides ) {
|
|
5492
5497
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
5493
|
-
logger.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5498
|
+
logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5494
5499
|
|
|
5495
5500
|
webRTCConfiguration.delegate = {
|
|
5496
5501
|
onConnect: this.onConnect.bind(this),
|
|
5497
5502
|
onDisconnect: this.onDisconnect.bind(this),
|
|
5498
5503
|
onInvite: (invitation ) => {
|
|
5499
|
-
logger.info('sdk webrtc on invite', {
|
|
5504
|
+
logger$3.info('sdk webrtc on invite', {
|
|
5500
5505
|
method: 'delegate.onInvite',
|
|
5501
5506
|
id: invitation.id,
|
|
5502
5507
|
remoteURI: invitation.remoteURI,
|
|
@@ -5539,7 +5544,7 @@ class WebRTCClient extends Emitter {
|
|
|
5539
5544
|
}
|
|
5540
5545
|
|
|
5541
5546
|
onConnect() {
|
|
5542
|
-
logger.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5547
|
+
logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5543
5548
|
this.eventEmitter.emit(CONNECTED);
|
|
5544
5549
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
5545
5550
|
this.registerer.waitingToggle(false);
|
|
@@ -5548,7 +5553,7 @@ class WebRTCClient extends Emitter {
|
|
|
5548
5553
|
}
|
|
5549
5554
|
|
|
5550
5555
|
async onDisconnect(error ) {
|
|
5551
|
-
logger.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5556
|
+
logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5552
5557
|
this.connectionPromise = null;
|
|
5553
5558
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
5554
5559
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -5573,37 +5578,37 @@ class WebRTCClient extends Emitter {
|
|
|
5573
5578
|
};
|
|
5574
5579
|
|
|
5575
5580
|
if (this.skipRegister) {
|
|
5576
|
-
logger.info('sdk webrtc skip register...', logInfo);
|
|
5581
|
+
logger$3.info('sdk webrtc skip register...', logInfo);
|
|
5577
5582
|
return Promise.resolve();
|
|
5578
5583
|
}
|
|
5579
5584
|
|
|
5580
|
-
logger.info('sdk webrtc registering...', logInfo);
|
|
5585
|
+
logger$3.info('sdk webrtc registering...', logInfo);
|
|
5581
5586
|
|
|
5582
5587
|
if (!this.userAgent) {
|
|
5583
|
-
logger.info('sdk webrtc recreating User Agent');
|
|
5588
|
+
logger$3.info('sdk webrtc recreating User Agent');
|
|
5584
5589
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5585
5590
|
}
|
|
5586
5591
|
if (!this.userAgent || this.isRegistered()) {
|
|
5587
|
-
logger.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5592
|
+
logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5588
5593
|
return Promise.resolve();
|
|
5589
5594
|
}
|
|
5590
5595
|
|
|
5591
5596
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
5592
|
-
logger.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5597
|
+
logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5593
5598
|
return Promise.resolve();
|
|
5594
5599
|
}
|
|
5595
5600
|
|
|
5596
5601
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5597
5602
|
|
|
5598
5603
|
const onRegisterFailed = () => {
|
|
5599
|
-
logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5604
|
+
logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5600
5605
|
this.connectionPromise = null;
|
|
5601
5606
|
if (this.registerer && this.registerer.waiting) {
|
|
5602
5607
|
this.registerer.waitingToggle(false);
|
|
5603
5608
|
}
|
|
5604
5609
|
|
|
5605
5610
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
5606
|
-
logger.info('sdk webrtc registering, retrying...', { tries });
|
|
5611
|
+
logger$3.info('sdk webrtc registering, retrying...', { tries });
|
|
5607
5612
|
setTimeout(() => this.register(tries + 1), 300);
|
|
5608
5613
|
}
|
|
5609
5614
|
};
|
|
@@ -5612,18 +5617,18 @@ class WebRTCClient extends Emitter {
|
|
|
5612
5617
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
5613
5618
|
// during the resolution of the primise.
|
|
5614
5619
|
if (!this.userAgent) {
|
|
5615
|
-
logger.info('sdk webrtc recreating User Agent after connection');
|
|
5620
|
+
logger$3.info('sdk webrtc recreating User Agent after connection');
|
|
5616
5621
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5617
5622
|
}
|
|
5618
5623
|
|
|
5619
|
-
logger.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5624
|
+
logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5620
5625
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
5621
5626
|
this.connectionPromise = null;
|
|
5622
5627
|
this._monkeyPatchRegisterer(this.registerer);
|
|
5623
5628
|
|
|
5624
5629
|
// Bind registerer events
|
|
5625
5630
|
this.registerer.stateChange.addListener(newState => {
|
|
5626
|
-
logger.info('sdk webrtc registering, state changed', { newState });
|
|
5631
|
+
logger$3.info('sdk webrtc registering, state changed', { newState });
|
|
5627
5632
|
|
|
5628
5633
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
5629
5634
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -5636,7 +5641,7 @@ class WebRTCClient extends Emitter {
|
|
|
5636
5641
|
const options = {
|
|
5637
5642
|
requestDelegate: {
|
|
5638
5643
|
onReject: response => {
|
|
5639
|
-
logger.error('sdk webrtc registering, rejected', { response });
|
|
5644
|
+
logger$3.error('sdk webrtc registering, rejected', { response });
|
|
5640
5645
|
|
|
5641
5646
|
onRegisterFailed();
|
|
5642
5647
|
},
|
|
@@ -5644,13 +5649,13 @@ class WebRTCClient extends Emitter {
|
|
|
5644
5649
|
};
|
|
5645
5650
|
|
|
5646
5651
|
return this.registerer.register(options).catch((e) => {
|
|
5647
|
-
logger.error('sdk webrtc registering, error', e);
|
|
5652
|
+
logger$3.error('sdk webrtc registering, error', e);
|
|
5648
5653
|
|
|
5649
5654
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
5650
5655
|
return e;
|
|
5651
5656
|
});
|
|
5652
5657
|
}).catch(error => {
|
|
5653
|
-
logger.error('sdk webrtc registering, transport error', error);
|
|
5658
|
+
logger$3.error('sdk webrtc registering, transport error', error);
|
|
5654
5659
|
onRegisterFailed();
|
|
5655
5660
|
});
|
|
5656
5661
|
}
|
|
@@ -5679,21 +5684,21 @@ class WebRTCClient extends Emitter {
|
|
|
5679
5684
|
}
|
|
5680
5685
|
|
|
5681
5686
|
unregister() {
|
|
5682
|
-
logger.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5687
|
+
logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5683
5688
|
if (!this.registerer) {
|
|
5684
5689
|
return Promise.resolve();
|
|
5685
5690
|
}
|
|
5686
5691
|
|
|
5687
5692
|
try {
|
|
5688
5693
|
return this.registerer.unregister().then(() => {
|
|
5689
|
-
logger.info('sdk webrtc unregistered');
|
|
5694
|
+
logger$3.info('sdk webrtc unregistered');
|
|
5690
5695
|
this._cleanupRegister();
|
|
5691
5696
|
}).catch(e => {
|
|
5692
|
-
logger.error('sdk webrtc unregistering, promise error', e);
|
|
5697
|
+
logger$3.error('sdk webrtc unregistering, promise error', e);
|
|
5693
5698
|
this._cleanupRegister();
|
|
5694
5699
|
});
|
|
5695
5700
|
} catch (e) {
|
|
5696
|
-
logger.error('sdk webrtc unregistering, error', e);
|
|
5701
|
+
logger$3.error('sdk webrtc unregistering, error', e);
|
|
5697
5702
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
5698
5703
|
// error when the registerer is in a bad state
|
|
5699
5704
|
this._cleanupRegister();
|
|
@@ -5701,7 +5706,7 @@ class WebRTCClient extends Emitter {
|
|
|
5701
5706
|
}
|
|
5702
5707
|
|
|
5703
5708
|
stop() {
|
|
5704
|
-
logger.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5709
|
+
logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5705
5710
|
if (!this.userAgent) {
|
|
5706
5711
|
return Promise.resolve();
|
|
5707
5712
|
}
|
|
@@ -5709,12 +5714,12 @@ class WebRTCClient extends Emitter {
|
|
|
5709
5714
|
return this.userAgent.stop().then(() => {
|
|
5710
5715
|
return this._cleanupRegister();
|
|
5711
5716
|
}).catch(e => {
|
|
5712
|
-
logger.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5717
|
+
logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5713
5718
|
});
|
|
5714
5719
|
}
|
|
5715
5720
|
|
|
5716
5721
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
5717
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5722
|
+
logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5718
5723
|
const inviterOptions = {
|
|
5719
5724
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
5720
5725
|
conference,
|
|
@@ -5745,7 +5750,7 @@ class WebRTCClient extends Emitter {
|
|
|
5745
5750
|
this._onAccepted(session, response.session, true);
|
|
5746
5751
|
},
|
|
5747
5752
|
onReject: (response ) => {
|
|
5748
|
-
logger.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5753
|
+
logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5749
5754
|
this._stopSendingStats(session);
|
|
5750
5755
|
this.stopNetworkMonitoring(session);
|
|
5751
5756
|
|
|
@@ -5768,11 +5773,11 @@ class WebRTCClient extends Emitter {
|
|
|
5768
5773
|
}
|
|
5769
5774
|
|
|
5770
5775
|
answer(session , enableVideo ) {
|
|
5771
|
-
logger.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5776
|
+
logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5772
5777
|
|
|
5773
5778
|
if (!session || !session.accept) {
|
|
5774
5779
|
const error = 'No session to answer, or not an invitation';
|
|
5775
|
-
logger.warn(error);
|
|
5780
|
+
logger$3.warn(error);
|
|
5776
5781
|
return Promise.reject(new Error(error));
|
|
5777
5782
|
}
|
|
5778
5783
|
const options = {
|
|
@@ -5782,15 +5787,15 @@ class WebRTCClient extends Emitter {
|
|
|
5782
5787
|
return session.accept(options).then(() => {
|
|
5783
5788
|
if (session.isCanceled) {
|
|
5784
5789
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
5785
|
-
logger.error(message, { id: session.id });
|
|
5790
|
+
logger$3.error(message, { id: session.id });
|
|
5786
5791
|
this.onCallEnded(session);
|
|
5787
5792
|
|
|
5788
5793
|
throw new CanceledCallError(message);
|
|
5789
5794
|
}
|
|
5790
|
-
logger.info('sdk webrtc answer, accepted.');
|
|
5795
|
+
logger$3.info('sdk webrtc answer, accepted.');
|
|
5791
5796
|
this._onAccepted(session);
|
|
5792
5797
|
}).catch(e => {
|
|
5793
|
-
logger.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5798
|
+
logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5794
5799
|
|
|
5795
5800
|
throw e;
|
|
5796
5801
|
});
|
|
@@ -5798,7 +5803,7 @@ class WebRTCClient extends Emitter {
|
|
|
5798
5803
|
|
|
5799
5804
|
hangup(session ) {
|
|
5800
5805
|
const { state, id } = session;
|
|
5801
|
-
logger.info('sdk webrtc hangup call', { id, state });
|
|
5806
|
+
logger$3.info('sdk webrtc hangup call', { id, state });
|
|
5802
5807
|
|
|
5803
5808
|
try {
|
|
5804
5809
|
this._stopSendingStats(session);
|
|
@@ -5827,7 +5832,7 @@ class WebRTCClient extends Emitter {
|
|
|
5827
5832
|
|
|
5828
5833
|
return bye();
|
|
5829
5834
|
} catch (error) {
|
|
5830
|
-
logger.warn('sdk webrtc hangup, error', error);
|
|
5835
|
+
logger$3.warn('sdk webrtc hangup, error', error);
|
|
5831
5836
|
}
|
|
5832
5837
|
|
|
5833
5838
|
return null;
|
|
@@ -5845,7 +5850,7 @@ class WebRTCClient extends Emitter {
|
|
|
5845
5850
|
// Fetch and emit an event at `interval` with session network stats
|
|
5846
5851
|
startNetworkMonitoring(session , interval = 1000) {
|
|
5847
5852
|
const sessionId = this.getSipSessionId(session);
|
|
5848
|
-
logger.info('starting network inspection', { id: sessionId });
|
|
5853
|
+
logger$3.info('starting network inspection', { id: sessionId });
|
|
5849
5854
|
|
|
5850
5855
|
this.sessionNetworkStats[sessionId] = [];
|
|
5851
5856
|
|
|
@@ -5855,7 +5860,7 @@ class WebRTCClient extends Emitter {
|
|
|
5855
5860
|
stopNetworkMonitoring(session ) {
|
|
5856
5861
|
const sessionId = this.getSipSessionId(session);
|
|
5857
5862
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
5858
|
-
logger.info('stopping network inspection', { id: sessionId, exists });
|
|
5863
|
+
logger$3.info('stopping network inspection', { id: sessionId, exists });
|
|
5859
5864
|
|
|
5860
5865
|
if (exists) {
|
|
5861
5866
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -5865,17 +5870,17 @@ class WebRTCClient extends Emitter {
|
|
|
5865
5870
|
}
|
|
5866
5871
|
|
|
5867
5872
|
reject(session ) {
|
|
5868
|
-
logger.info('sdk webrtc reject call', { id: session.id });
|
|
5873
|
+
logger$3.info('sdk webrtc reject call', { id: session.id });
|
|
5869
5874
|
|
|
5870
5875
|
try {
|
|
5871
5876
|
return session.reject ? session.reject() : session.cancel();
|
|
5872
5877
|
} catch (e) {
|
|
5873
|
-
logger.warn('Error when rejecting call', e.message, e.stack);
|
|
5878
|
+
logger$3.warn('Error when rejecting call', e.message, e.stack);
|
|
5874
5879
|
}
|
|
5875
5880
|
}
|
|
5876
5881
|
|
|
5877
5882
|
async close() {
|
|
5878
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5883
|
+
logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5879
5884
|
this._cleanupMedia();
|
|
5880
5885
|
this.connectionPromise = null;
|
|
5881
5886
|
|
|
@@ -5906,7 +5911,7 @@ class WebRTCClient extends Emitter {
|
|
|
5906
5911
|
// eg: "INVITE not rejectable in state Completed"
|
|
5907
5912
|
}
|
|
5908
5913
|
this.userAgent = null;
|
|
5909
|
-
logger.info('sdk webrtc client closed');
|
|
5914
|
+
logger$3.info('sdk webrtc client closed');
|
|
5910
5915
|
}
|
|
5911
5916
|
|
|
5912
5917
|
getNumber(session ) {
|
|
@@ -5919,13 +5924,13 @@ class WebRTCClient extends Emitter {
|
|
|
5919
5924
|
}
|
|
5920
5925
|
|
|
5921
5926
|
mute(session ) {
|
|
5922
|
-
logger.info('sdk webrtc mute', { id: session.id });
|
|
5927
|
+
logger$3.info('sdk webrtc mute', { id: session.id });
|
|
5923
5928
|
|
|
5924
5929
|
this._toggleAudio(session, true);
|
|
5925
5930
|
}
|
|
5926
5931
|
|
|
5927
5932
|
unmute(session ) {
|
|
5928
|
-
logger.info('sdk webrtc unmute', { id: session.id });
|
|
5933
|
+
logger$3.info('sdk webrtc unmute', { id: session.id });
|
|
5929
5934
|
|
|
5930
5935
|
this._toggleAudio(session, false);
|
|
5931
5936
|
}
|
|
@@ -5965,13 +5970,13 @@ class WebRTCClient extends Emitter {
|
|
|
5965
5970
|
}
|
|
5966
5971
|
|
|
5967
5972
|
toggleCameraOn(session ) {
|
|
5968
|
-
logger.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5973
|
+
logger$3.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5969
5974
|
|
|
5970
5975
|
this._toggleVideo(session, false);
|
|
5971
5976
|
}
|
|
5972
5977
|
|
|
5973
5978
|
toggleCameraOff(session ) {
|
|
5974
|
-
logger.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5979
|
+
logger$3.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5975
5980
|
|
|
5976
5981
|
this._toggleVideo(session, true);
|
|
5977
5982
|
}
|
|
@@ -5980,7 +5985,7 @@ class WebRTCClient extends Emitter {
|
|
|
5980
5985
|
const sessionId = this.getSipSessionId(session);
|
|
5981
5986
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
5982
5987
|
|
|
5983
|
-
logger.info('sdk webrtc hold', {
|
|
5988
|
+
logger$3.info('sdk webrtc hold', {
|
|
5984
5989
|
sessionId,
|
|
5985
5990
|
keys: Object.keys(this.heldSessions),
|
|
5986
5991
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6029,7 +6034,7 @@ class WebRTCClient extends Emitter {
|
|
|
6029
6034
|
const sessionId = this.getSipSessionId(session);
|
|
6030
6035
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
6031
6036
|
|
|
6032
|
-
logger.info('sdk webrtc unhold', {
|
|
6037
|
+
logger$3.info('sdk webrtc unhold', {
|
|
6033
6038
|
sessionId,
|
|
6034
6039
|
keys: Object.keys(this.heldSessions),
|
|
6035
6040
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6177,7 +6182,7 @@ class WebRTCClient extends Emitter {
|
|
|
6177
6182
|
if (!session.sessionDescriptionHandler) {
|
|
6178
6183
|
return;
|
|
6179
6184
|
}
|
|
6180
|
-
logger.info('Sending DTMF', {
|
|
6185
|
+
logger$3.info('Sending DTMF', {
|
|
6181
6186
|
id: this.getSipSessionId(session),
|
|
6182
6187
|
tone,
|
|
6183
6188
|
});
|
|
@@ -6193,7 +6198,7 @@ class WebRTCClient extends Emitter {
|
|
|
6193
6198
|
transfer(session , target ) {
|
|
6194
6199
|
this.hold(session);
|
|
6195
6200
|
|
|
6196
|
-
logger.info('Transfering a session', {
|
|
6201
|
+
logger$3.info('Transfering a session', {
|
|
6197
6202
|
id: this.getSipSessionId(session),
|
|
6198
6203
|
target,
|
|
6199
6204
|
});
|
|
@@ -6215,17 +6220,17 @@ class WebRTCClient extends Emitter {
|
|
|
6215
6220
|
atxfer(session ) {
|
|
6216
6221
|
this.hold(session);
|
|
6217
6222
|
|
|
6218
|
-
logger.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6223
|
+
logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6219
6224
|
|
|
6220
6225
|
const result = {
|
|
6221
6226
|
newSession: null,
|
|
6222
6227
|
init: async (target ) => {
|
|
6223
|
-
logger.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6228
|
+
logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6224
6229
|
|
|
6225
6230
|
result.newSession = await this.call(target);
|
|
6226
6231
|
},
|
|
6227
6232
|
complete: () => {
|
|
6228
|
-
logger.info('webrtc transfer completed', {
|
|
6233
|
+
logger$3.info('webrtc transfer completed', {
|
|
6229
6234
|
id: this.getSipSessionId(session),
|
|
6230
6235
|
referId: this.getSipSessionId(result.newSession),
|
|
6231
6236
|
});
|
|
@@ -6246,7 +6251,7 @@ class WebRTCClient extends Emitter {
|
|
|
6246
6251
|
return;
|
|
6247
6252
|
}
|
|
6248
6253
|
|
|
6249
|
-
logger.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6254
|
+
logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6250
6255
|
|
|
6251
6256
|
try {
|
|
6252
6257
|
sipSession.message({
|
|
@@ -6288,7 +6293,7 @@ class WebRTCClient extends Emitter {
|
|
|
6288
6293
|
}
|
|
6289
6294
|
|
|
6290
6295
|
changeAudioOutputVolume(volume ) {
|
|
6291
|
-
logger.info('Changing audio output volume', { volume });
|
|
6296
|
+
logger$3.info('Changing audio output volume', { volume });
|
|
6292
6297
|
|
|
6293
6298
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6294
6299
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -6300,7 +6305,7 @@ class WebRTCClient extends Emitter {
|
|
|
6300
6305
|
}
|
|
6301
6306
|
|
|
6302
6307
|
changeAudioOutputDevice(id ) {
|
|
6303
|
-
logger.info('Changing audio output device', { id });
|
|
6308
|
+
logger$3.info('Changing audio output device', { id });
|
|
6304
6309
|
|
|
6305
6310
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6306
6311
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -6317,7 +6322,7 @@ class WebRTCClient extends Emitter {
|
|
|
6317
6322
|
|
|
6318
6323
|
changeAudioInputDevice(id , session ) {
|
|
6319
6324
|
const currentId = this.getAudioDeviceId();
|
|
6320
|
-
logger.info('setting audio input device', { id, currentId, session: !!session });
|
|
6325
|
+
logger$3.info('setting audio input device', { id, currentId, session: !!session });
|
|
6321
6326
|
|
|
6322
6327
|
if (id === currentId) {
|
|
6323
6328
|
return null;
|
|
@@ -6363,7 +6368,7 @@ class WebRTCClient extends Emitter {
|
|
|
6363
6368
|
|
|
6364
6369
|
setVideoInputDevice(id ) {
|
|
6365
6370
|
const currentId = this.getVideoDeviceId();
|
|
6366
|
-
logger.info('setting video input device', { id, currentId });
|
|
6371
|
+
logger$3.info('setting video input device', { id, currentId });
|
|
6367
6372
|
|
|
6368
6373
|
if (id === currentId) {
|
|
6369
6374
|
return null;
|
|
@@ -6388,7 +6393,7 @@ class WebRTCClient extends Emitter {
|
|
|
6388
6393
|
const sessionId = this.getSipSessionId(session);
|
|
6389
6394
|
const localStream = this.getLocalStream(sessionId);
|
|
6390
6395
|
|
|
6391
|
-
logger.info('changing video input device', { id, sessionId });
|
|
6396
|
+
logger$3.info('changing video input device', { id, sessionId });
|
|
6392
6397
|
|
|
6393
6398
|
// Release old video stream
|
|
6394
6399
|
if (localStream) {
|
|
@@ -6456,7 +6461,7 @@ class WebRTCClient extends Emitter {
|
|
|
6456
6461
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
6457
6462
|
const desktop = newConstraints && newConstraints.desktop;
|
|
6458
6463
|
|
|
6459
|
-
logger.info('Sending reinvite', {
|
|
6464
|
+
logger$3.info('Sending reinvite', {
|
|
6460
6465
|
id: this.getSipSessionId(sipSession),
|
|
6461
6466
|
newConstraints,
|
|
6462
6467
|
conference,
|
|
@@ -6494,7 +6499,7 @@ class WebRTCClient extends Emitter {
|
|
|
6494
6499
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
6495
6500
|
}
|
|
6496
6501
|
|
|
6497
|
-
logger.info('on re-INVITE accepted', {
|
|
6502
|
+
logger$3.info('on re-INVITE accepted', {
|
|
6498
6503
|
id: this.getSipSessionId(sipSession),
|
|
6499
6504
|
wasMuted,
|
|
6500
6505
|
shouldDoScreenSharing,
|
|
@@ -6669,7 +6674,7 @@ class WebRTCClient extends Emitter {
|
|
|
6669
6674
|
}
|
|
6670
6675
|
|
|
6671
6676
|
startHeartbeat() {
|
|
6672
|
-
logger.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6677
|
+
logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6673
6678
|
if (!this.userAgent) {
|
|
6674
6679
|
this.heartbeat.stop();
|
|
6675
6680
|
return;
|
|
@@ -6682,7 +6687,7 @@ class WebRTCClient extends Emitter {
|
|
|
6682
6687
|
}
|
|
6683
6688
|
|
|
6684
6689
|
stopHeartbeat() {
|
|
6685
|
-
logger.info('sdk webrtc stop heartbeat');
|
|
6690
|
+
logger$3.info('sdk webrtc stop heartbeat');
|
|
6686
6691
|
this.heartbeat.stop();
|
|
6687
6692
|
}
|
|
6688
6693
|
|
|
@@ -6703,7 +6708,7 @@ class WebRTCClient extends Emitter {
|
|
|
6703
6708
|
}
|
|
6704
6709
|
|
|
6705
6710
|
attemptReconnection() {
|
|
6706
|
-
logger.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6711
|
+
logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6707
6712
|
if (!this.userAgent) {
|
|
6708
6713
|
return;
|
|
6709
6714
|
}
|
|
@@ -6728,7 +6733,7 @@ class WebRTCClient extends Emitter {
|
|
|
6728
6733
|
return;
|
|
6729
6734
|
}
|
|
6730
6735
|
|
|
6731
|
-
logger.info('setting local media stream', {
|
|
6736
|
+
logger$3.info('setting local media stream', {
|
|
6732
6737
|
sipSessionId,
|
|
6733
6738
|
tracks: newStream ? newStream.getTracks() : null,
|
|
6734
6739
|
});
|
|
@@ -6745,7 +6750,7 @@ class WebRTCClient extends Emitter {
|
|
|
6745
6750
|
|
|
6746
6751
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
6747
6752
|
|
|
6748
|
-
logger.info('updating local stream', {
|
|
6753
|
+
logger$3.info('updating local stream', {
|
|
6749
6754
|
sipSessionId,
|
|
6750
6755
|
oldStream: !!oldStream,
|
|
6751
6756
|
tracks: newStream.getTracks(),
|
|
@@ -6765,7 +6770,7 @@ class WebRTCClient extends Emitter {
|
|
|
6765
6770
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
6766
6771
|
const pc = this.getPeerConnection(sessionId);
|
|
6767
6772
|
|
|
6768
|
-
logger.info('Updating remote stream', {
|
|
6773
|
+
logger$3.info('Updating remote stream', {
|
|
6769
6774
|
sessionId,
|
|
6770
6775
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
6771
6776
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -6791,7 +6796,7 @@ class WebRTCClient extends Emitter {
|
|
|
6791
6796
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
6792
6797
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
6793
6798
|
|
|
6794
|
-
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6799
|
+
logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6795
6800
|
|
|
6796
6801
|
return {
|
|
6797
6802
|
constraints: {
|
|
@@ -6840,7 +6845,7 @@ class WebRTCClient extends Emitter {
|
|
|
6840
6845
|
}
|
|
6841
6846
|
|
|
6842
6847
|
_onTransportError() {
|
|
6843
|
-
logger.error('on transport error');
|
|
6848
|
+
logger$3.error('on transport error');
|
|
6844
6849
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
6845
6850
|
this.attemptReconnection();
|
|
6846
6851
|
}
|
|
@@ -6849,7 +6854,7 @@ class WebRTCClient extends Emitter {
|
|
|
6849
6854
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
6850
6855
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
6851
6856
|
if (this.hasHeartbeat()) {
|
|
6852
|
-
logger.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6857
|
+
logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6853
6858
|
|
|
6854
6859
|
this.heartbeat.onHeartbeat();
|
|
6855
6860
|
if (this.heartbeatCb) {
|
|
@@ -6860,7 +6865,7 @@ class WebRTCClient extends Emitter {
|
|
|
6860
6865
|
}
|
|
6861
6866
|
|
|
6862
6867
|
async _onHeartbeatTimeout() {
|
|
6863
|
-
logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6868
|
+
logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6864
6869
|
|
|
6865
6870
|
if (this.heartbeatTimeoutCb) {
|
|
6866
6871
|
this.heartbeatTimeoutCb();
|
|
@@ -6872,7 +6877,7 @@ class WebRTCClient extends Emitter {
|
|
|
6872
6877
|
try {
|
|
6873
6878
|
await this.userAgent.transport.disconnect();
|
|
6874
6879
|
} catch (e) {
|
|
6875
|
-
logger.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6880
|
+
logger$3.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6876
6881
|
}
|
|
6877
6882
|
}
|
|
6878
6883
|
|
|
@@ -6905,31 +6910,31 @@ class WebRTCClient extends Emitter {
|
|
|
6905
6910
|
}
|
|
6906
6911
|
|
|
6907
6912
|
_connectIfNeeded() {
|
|
6908
|
-
logger.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6913
|
+
logger$3.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6909
6914
|
if (!this.userAgent) {
|
|
6910
|
-
logger.info('need to recreate User Agent');
|
|
6915
|
+
logger$3.info('need to recreate User Agent');
|
|
6911
6916
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6912
6917
|
}
|
|
6913
6918
|
|
|
6914
6919
|
if (this.isConnected()) {
|
|
6915
|
-
logger.info('webrtc sdk, already connected');
|
|
6920
|
+
logger$3.info('webrtc sdk, already connected');
|
|
6916
6921
|
return Promise.resolve();
|
|
6917
6922
|
}
|
|
6918
6923
|
|
|
6919
6924
|
if (this.isConnecting()) {
|
|
6920
|
-
logger.info('webrtc sdk, already connecting...');
|
|
6925
|
+
logger$3.info('webrtc sdk, already connecting...');
|
|
6921
6926
|
|
|
6922
6927
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
6923
6928
|
return this.connectionPromise;
|
|
6924
6929
|
}
|
|
6925
6930
|
|
|
6926
6931
|
if (this.connectionPromise) {
|
|
6927
|
-
logger.info('webrtc sdk, connection promise connecting...');
|
|
6932
|
+
logger$3.info('webrtc sdk, connection promise connecting...');
|
|
6928
6933
|
// $FlowFixMe
|
|
6929
6934
|
return this.connectionPromise;
|
|
6930
6935
|
}
|
|
6931
6936
|
|
|
6932
|
-
logger.info('WebRTC UA needs to connect');
|
|
6937
|
+
logger$3.info('WebRTC UA needs to connect');
|
|
6933
6938
|
|
|
6934
6939
|
// Force UA to reconnect
|
|
6935
6940
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -7054,7 +7059,7 @@ class WebRTCClient extends Emitter {
|
|
|
7054
7059
|
|
|
7055
7060
|
sdh.peerConnectionDelegate = {
|
|
7056
7061
|
onicecandidateerror: (error ) => {
|
|
7057
|
-
logger.error('on icecandidate error', {
|
|
7062
|
+
logger$3.error('on icecandidate error', {
|
|
7058
7063
|
address: error.address,
|
|
7059
7064
|
port: error.port,
|
|
7060
7065
|
errorCode: error.errorCode,
|
|
@@ -7083,7 +7088,7 @@ class WebRTCClient extends Emitter {
|
|
|
7083
7088
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
7084
7089
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
7085
7090
|
}
|
|
7086
|
-
logger.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7091
|
+
logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7087
7092
|
|
|
7088
7093
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
7089
7094
|
|
|
@@ -7104,7 +7109,7 @@ class WebRTCClient extends Emitter {
|
|
|
7104
7109
|
}
|
|
7105
7110
|
|
|
7106
7111
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
7107
|
-
logger.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7112
|
+
logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7108
7113
|
|
|
7109
7114
|
this.storeSipSession(session);
|
|
7110
7115
|
|
|
@@ -7116,7 +7121,7 @@ class WebRTCClient extends Emitter {
|
|
|
7116
7121
|
const onTrack = (event ) => {
|
|
7117
7122
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7118
7123
|
const { kind, label, readyState, id, muted } = event.track;
|
|
7119
|
-
logger.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7124
|
+
logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7120
7125
|
|
|
7121
7126
|
// Stop video track in audio only mode
|
|
7122
7127
|
if (isAudioOnly && kind === 'video') {
|
|
@@ -7133,7 +7138,7 @@ class WebRTCClient extends Emitter {
|
|
|
7133
7138
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7134
7139
|
|
|
7135
7140
|
pc.oniceconnectionstatechange = () => {
|
|
7136
|
-
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7141
|
+
logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7137
7142
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7138
7143
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7139
7144
|
}
|
|
@@ -7306,10 +7311,10 @@ class WebRTCClient extends Emitter {
|
|
|
7306
7311
|
|
|
7307
7312
|
_stopSendingStats(session ) {
|
|
7308
7313
|
const sessionId = this.getSipSessionId(session);
|
|
7309
|
-
logger.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7314
|
+
logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7310
7315
|
|
|
7311
7316
|
if (sessionId in this.statsIntervals) {
|
|
7312
|
-
logger.trace('Stop sending stats for call', { sessionId });
|
|
7317
|
+
logger$3.trace('Stop sending stats for call', { sessionId });
|
|
7313
7318
|
this.statsIntervals[sessionId]();
|
|
7314
7319
|
delete this.statsIntervals[sessionId];
|
|
7315
7320
|
}
|
|
@@ -7325,7 +7330,7 @@ class WebRTCClient extends Emitter {
|
|
|
7325
7330
|
try {
|
|
7326
7331
|
await this.userAgent.transport.disconnect();
|
|
7327
7332
|
} catch (e) {
|
|
7328
|
-
logger.error('WebRTC transport disconnect, error', e);
|
|
7333
|
+
logger$3.error('WebRTC transport disconnect, error', e);
|
|
7329
7334
|
}
|
|
7330
7335
|
}
|
|
7331
7336
|
}
|