@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
|
@@ -109,7 +109,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
109
109
|
|
|
110
110
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
111
111
|
|
|
112
|
-
const logger
|
|
112
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
113
113
|
|
|
114
114
|
// Use a function here to be able to mock it in tests
|
|
115
115
|
const realFetch = () => {
|
|
@@ -248,7 +248,7 @@ class ApiRequester {
|
|
|
248
248
|
};
|
|
249
249
|
|
|
250
250
|
if (this.refreshTokenPromise) {
|
|
251
|
-
logger
|
|
251
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
252
252
|
await this.refreshTokenPromise;
|
|
253
253
|
}
|
|
254
254
|
|
|
@@ -268,7 +268,7 @@ class ApiRequester {
|
|
|
268
268
|
return promise.then(async (err ) => {
|
|
269
269
|
// Check if the token is still valid
|
|
270
270
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
271
|
-
logger
|
|
271
|
+
logger.warn('token expired', { error: err.reason });
|
|
272
272
|
// Replay the call after refreshing the token
|
|
273
273
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
274
274
|
}
|
|
@@ -278,7 +278,7 @@ class ApiRequester {
|
|
|
278
278
|
: exceptionClass.fromResponse(err, response.status);
|
|
279
279
|
|
|
280
280
|
if (this.shouldLogErrors) {
|
|
281
|
-
logger
|
|
281
|
+
logger.error('API error', error);
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
throw error;
|
|
@@ -288,7 +288,7 @@ class ApiRequester {
|
|
|
288
288
|
return newParse(response, isJson);
|
|
289
289
|
}).catch(error => {
|
|
290
290
|
if (this.shouldLogErrors) {
|
|
291
|
-
logger
|
|
291
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
throw error;
|
|
@@ -316,13 +316,13 @@ class ApiRequester {
|
|
|
316
316
|
) {
|
|
317
317
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
318
318
|
let newPath = path;
|
|
319
|
-
logger
|
|
319
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
320
320
|
|
|
321
321
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
322
322
|
|
|
323
323
|
return this.refreshTokenPromise.then(() => {
|
|
324
324
|
this.refreshTokenPromise = null;
|
|
325
|
-
logger
|
|
325
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
326
326
|
if (isTokenNotFound) {
|
|
327
327
|
const pathParts = path.split('/');
|
|
328
328
|
pathParts.pop();
|
|
@@ -3163,8 +3163,9 @@ class ExternalApp {
|
|
|
3163
3163
|
|
|
3164
3164
|
|
|
3165
3165
|
|
|
3166
|
-
|
|
3166
|
+
|
|
3167
3167
|
|
|
3168
|
+
|
|
3168
3169
|
|
|
3169
3170
|
|
|
3170
3171
|
class Meeting {
|
|
@@ -3175,9 +3176,10 @@ class Meeting {
|
|
|
3175
3176
|
|
|
3176
3177
|
|
|
3177
3178
|
|
|
3178
|
-
|
|
3179
|
+
|
|
3179
3180
|
|
|
3180
3181
|
|
|
3182
|
+
|
|
3181
3183
|
|
|
3182
3184
|
static parse(plain ) {
|
|
3183
3185
|
return new Meeting({
|
|
@@ -3187,8 +3189,9 @@ class Meeting {
|
|
|
3187
3189
|
ownerUuids: plain.owner_uuids,
|
|
3188
3190
|
port: plain.port,
|
|
3189
3191
|
uuid: plain.uuid,
|
|
3190
|
-
|
|
3192
|
+
extension: plain.exten,
|
|
3191
3193
|
persistent: plain.persistent,
|
|
3194
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3192
3195
|
});
|
|
3193
3196
|
}
|
|
3194
3197
|
|
|
@@ -3210,8 +3213,9 @@ class Meeting {
|
|
|
3210
3213
|
ownerUuids,
|
|
3211
3214
|
port,
|
|
3212
3215
|
uri,
|
|
3213
|
-
|
|
3216
|
+
extension,
|
|
3214
3217
|
persistent,
|
|
3218
|
+
creationTime,
|
|
3215
3219
|
} = {}) {
|
|
3216
3220
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3217
3221
|
this.uri = uri;
|
|
@@ -3219,8 +3223,9 @@ class Meeting {
|
|
|
3219
3223
|
this.ownerUuids = ownerUuids;
|
|
3220
3224
|
this.port = port;
|
|
3221
3225
|
this.uuid = uuid;
|
|
3222
|
-
this.
|
|
3226
|
+
this.extension = extension;
|
|
3223
3227
|
this.persistent = persistent;
|
|
3228
|
+
this.creationTime = creationTime;
|
|
3224
3229
|
|
|
3225
3230
|
// Useful to compare instead of instanceof with minified code
|
|
3226
3231
|
this.type = 'Meeting';
|
|
@@ -4142,7 +4147,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4142
4147
|
|
|
4143
4148
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4144
4149
|
|
|
4145
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4150
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4146
4151
|
|
|
4147
4152
|
/* */
|
|
4148
4153
|
|
|
@@ -5061,7 +5066,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5061
5066
|
const WEBHOOKD_VERSION = '1.0';
|
|
5062
5067
|
const AMID_VERSION = '1.0';
|
|
5063
5068
|
|
|
5064
|
-
const logger$
|
|
5069
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5065
5070
|
|
|
5066
5071
|
class ApiClient {
|
|
5067
5072
|
|
|
@@ -5113,12 +5118,12 @@ class ApiClient {
|
|
|
5113
5118
|
}
|
|
5114
5119
|
|
|
5115
5120
|
async forceRefreshToken() {
|
|
5116
|
-
logger$
|
|
5121
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5117
5122
|
return this.refreshTokenCallback();
|
|
5118
5123
|
}
|
|
5119
5124
|
|
|
5120
5125
|
async refreshTokenCallback() {
|
|
5121
|
-
logger$
|
|
5126
|
+
logger$2.info('refresh token callback called', {
|
|
5122
5127
|
refreshToken: this.refreshToken,
|
|
5123
5128
|
refreshBackend: this.refreshBackend,
|
|
5124
5129
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5136,7 +5141,7 @@ class ApiClient {
|
|
|
5136
5141
|
this.isMobile,
|
|
5137
5142
|
);
|
|
5138
5143
|
|
|
5139
|
-
logger$
|
|
5144
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5140
5145
|
|
|
5141
5146
|
if (this.onRefreshToken) {
|
|
5142
5147
|
this.onRefreshToken(session.token, session);
|
|
@@ -5309,7 +5314,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
5309
5314
|
const SEND_STATS_DELAY = 5000;
|
|
5310
5315
|
|
|
5311
5316
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
5312
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5317
|
+
const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5313
5318
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
5314
5319
|
|
|
5315
5320
|
// events
|
|
@@ -5485,13 +5490,13 @@ class WebRTCClient extends Emitter {
|
|
|
5485
5490
|
|
|
5486
5491
|
createUserAgent(configOverrides ) {
|
|
5487
5492
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
5488
|
-
logger.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5493
|
+
logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5489
5494
|
|
|
5490
5495
|
webRTCConfiguration.delegate = {
|
|
5491
5496
|
onConnect: this.onConnect.bind(this),
|
|
5492
5497
|
onDisconnect: this.onDisconnect.bind(this),
|
|
5493
5498
|
onInvite: (invitation ) => {
|
|
5494
|
-
logger.info('sdk webrtc on invite', {
|
|
5499
|
+
logger$3.info('sdk webrtc on invite', {
|
|
5495
5500
|
method: 'delegate.onInvite',
|
|
5496
5501
|
id: invitation.id,
|
|
5497
5502
|
remoteURI: invitation.remoteURI,
|
|
@@ -5534,7 +5539,7 @@ class WebRTCClient extends Emitter {
|
|
|
5534
5539
|
}
|
|
5535
5540
|
|
|
5536
5541
|
onConnect() {
|
|
5537
|
-
logger.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5542
|
+
logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5538
5543
|
this.eventEmitter.emit(CONNECTED);
|
|
5539
5544
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
5540
5545
|
this.registerer.waitingToggle(false);
|
|
@@ -5543,7 +5548,7 @@ class WebRTCClient extends Emitter {
|
|
|
5543
5548
|
}
|
|
5544
5549
|
|
|
5545
5550
|
async onDisconnect(error ) {
|
|
5546
|
-
logger.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5551
|
+
logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5547
5552
|
this.connectionPromise = null;
|
|
5548
5553
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
5549
5554
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -5568,37 +5573,37 @@ class WebRTCClient extends Emitter {
|
|
|
5568
5573
|
};
|
|
5569
5574
|
|
|
5570
5575
|
if (this.skipRegister) {
|
|
5571
|
-
logger.info('sdk webrtc skip register...', logInfo);
|
|
5576
|
+
logger$3.info('sdk webrtc skip register...', logInfo);
|
|
5572
5577
|
return Promise.resolve();
|
|
5573
5578
|
}
|
|
5574
5579
|
|
|
5575
|
-
logger.info('sdk webrtc registering...', logInfo);
|
|
5580
|
+
logger$3.info('sdk webrtc registering...', logInfo);
|
|
5576
5581
|
|
|
5577
5582
|
if (!this.userAgent) {
|
|
5578
|
-
logger.info('sdk webrtc recreating User Agent');
|
|
5583
|
+
logger$3.info('sdk webrtc recreating User Agent');
|
|
5579
5584
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5580
5585
|
}
|
|
5581
5586
|
if (!this.userAgent || this.isRegistered()) {
|
|
5582
|
-
logger.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5587
|
+
logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5583
5588
|
return Promise.resolve();
|
|
5584
5589
|
}
|
|
5585
5590
|
|
|
5586
5591
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
5587
|
-
logger.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5592
|
+
logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5588
5593
|
return Promise.resolve();
|
|
5589
5594
|
}
|
|
5590
5595
|
|
|
5591
5596
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5592
5597
|
|
|
5593
5598
|
const onRegisterFailed = () => {
|
|
5594
|
-
logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5599
|
+
logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5595
5600
|
this.connectionPromise = null;
|
|
5596
5601
|
if (this.registerer && this.registerer.waiting) {
|
|
5597
5602
|
this.registerer.waitingToggle(false);
|
|
5598
5603
|
}
|
|
5599
5604
|
|
|
5600
5605
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
5601
|
-
logger.info('sdk webrtc registering, retrying...', { tries });
|
|
5606
|
+
logger$3.info('sdk webrtc registering, retrying...', { tries });
|
|
5602
5607
|
setTimeout(() => this.register(tries + 1), 300);
|
|
5603
5608
|
}
|
|
5604
5609
|
};
|
|
@@ -5607,18 +5612,18 @@ class WebRTCClient extends Emitter {
|
|
|
5607
5612
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
5608
5613
|
// during the resolution of the primise.
|
|
5609
5614
|
if (!this.userAgent) {
|
|
5610
|
-
logger.info('sdk webrtc recreating User Agent after connection');
|
|
5615
|
+
logger$3.info('sdk webrtc recreating User Agent after connection');
|
|
5611
5616
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5612
5617
|
}
|
|
5613
5618
|
|
|
5614
|
-
logger.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5619
|
+
logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5615
5620
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
5616
5621
|
this.connectionPromise = null;
|
|
5617
5622
|
this._monkeyPatchRegisterer(this.registerer);
|
|
5618
5623
|
|
|
5619
5624
|
// Bind registerer events
|
|
5620
5625
|
this.registerer.stateChange.addListener(newState => {
|
|
5621
|
-
logger.info('sdk webrtc registering, state changed', { newState });
|
|
5626
|
+
logger$3.info('sdk webrtc registering, state changed', { newState });
|
|
5622
5627
|
|
|
5623
5628
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
5624
5629
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -5631,7 +5636,7 @@ class WebRTCClient extends Emitter {
|
|
|
5631
5636
|
const options = {
|
|
5632
5637
|
requestDelegate: {
|
|
5633
5638
|
onReject: response => {
|
|
5634
|
-
logger.error('sdk webrtc registering, rejected', { response });
|
|
5639
|
+
logger$3.error('sdk webrtc registering, rejected', { response });
|
|
5635
5640
|
|
|
5636
5641
|
onRegisterFailed();
|
|
5637
5642
|
},
|
|
@@ -5639,13 +5644,13 @@ class WebRTCClient extends Emitter {
|
|
|
5639
5644
|
};
|
|
5640
5645
|
|
|
5641
5646
|
return this.registerer.register(options).catch((e) => {
|
|
5642
|
-
logger.error('sdk webrtc registering, error', e);
|
|
5647
|
+
logger$3.error('sdk webrtc registering, error', e);
|
|
5643
5648
|
|
|
5644
5649
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
5645
5650
|
return e;
|
|
5646
5651
|
});
|
|
5647
5652
|
}).catch(error => {
|
|
5648
|
-
logger.error('sdk webrtc registering, transport error', error);
|
|
5653
|
+
logger$3.error('sdk webrtc registering, transport error', error);
|
|
5649
5654
|
onRegisterFailed();
|
|
5650
5655
|
});
|
|
5651
5656
|
}
|
|
@@ -5674,21 +5679,21 @@ class WebRTCClient extends Emitter {
|
|
|
5674
5679
|
}
|
|
5675
5680
|
|
|
5676
5681
|
unregister() {
|
|
5677
|
-
logger.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5682
|
+
logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5678
5683
|
if (!this.registerer) {
|
|
5679
5684
|
return Promise.resolve();
|
|
5680
5685
|
}
|
|
5681
5686
|
|
|
5682
5687
|
try {
|
|
5683
5688
|
return this.registerer.unregister().then(() => {
|
|
5684
|
-
logger.info('sdk webrtc unregistered');
|
|
5689
|
+
logger$3.info('sdk webrtc unregistered');
|
|
5685
5690
|
this._cleanupRegister();
|
|
5686
5691
|
}).catch(e => {
|
|
5687
|
-
logger.error('sdk webrtc unregistering, promise error', e);
|
|
5692
|
+
logger$3.error('sdk webrtc unregistering, promise error', e);
|
|
5688
5693
|
this._cleanupRegister();
|
|
5689
5694
|
});
|
|
5690
5695
|
} catch (e) {
|
|
5691
|
-
logger.error('sdk webrtc unregistering, error', e);
|
|
5696
|
+
logger$3.error('sdk webrtc unregistering, error', e);
|
|
5692
5697
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
5693
5698
|
// error when the registerer is in a bad state
|
|
5694
5699
|
this._cleanupRegister();
|
|
@@ -5696,7 +5701,7 @@ class WebRTCClient extends Emitter {
|
|
|
5696
5701
|
}
|
|
5697
5702
|
|
|
5698
5703
|
stop() {
|
|
5699
|
-
logger.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5704
|
+
logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5700
5705
|
if (!this.userAgent) {
|
|
5701
5706
|
return Promise.resolve();
|
|
5702
5707
|
}
|
|
@@ -5704,12 +5709,12 @@ class WebRTCClient extends Emitter {
|
|
|
5704
5709
|
return this.userAgent.stop().then(() => {
|
|
5705
5710
|
return this._cleanupRegister();
|
|
5706
5711
|
}).catch(e => {
|
|
5707
|
-
logger.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5712
|
+
logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5708
5713
|
});
|
|
5709
5714
|
}
|
|
5710
5715
|
|
|
5711
5716
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
5712
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5717
|
+
logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5713
5718
|
const inviterOptions = {
|
|
5714
5719
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
5715
5720
|
conference,
|
|
@@ -5740,7 +5745,7 @@ class WebRTCClient extends Emitter {
|
|
|
5740
5745
|
this._onAccepted(session, response.session, true);
|
|
5741
5746
|
},
|
|
5742
5747
|
onReject: (response ) => {
|
|
5743
|
-
logger.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5748
|
+
logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5744
5749
|
this._stopSendingStats(session);
|
|
5745
5750
|
this.stopNetworkMonitoring(session);
|
|
5746
5751
|
|
|
@@ -5763,11 +5768,11 @@ class WebRTCClient extends Emitter {
|
|
|
5763
5768
|
}
|
|
5764
5769
|
|
|
5765
5770
|
answer(session , enableVideo ) {
|
|
5766
|
-
logger.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5771
|
+
logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5767
5772
|
|
|
5768
5773
|
if (!session || !session.accept) {
|
|
5769
5774
|
const error = 'No session to answer, or not an invitation';
|
|
5770
|
-
logger.warn(error);
|
|
5775
|
+
logger$3.warn(error);
|
|
5771
5776
|
return Promise.reject(new Error(error));
|
|
5772
5777
|
}
|
|
5773
5778
|
const options = {
|
|
@@ -5777,15 +5782,15 @@ class WebRTCClient extends Emitter {
|
|
|
5777
5782
|
return session.accept(options).then(() => {
|
|
5778
5783
|
if (session.isCanceled) {
|
|
5779
5784
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
5780
|
-
logger.error(message, { id: session.id });
|
|
5785
|
+
logger$3.error(message, { id: session.id });
|
|
5781
5786
|
this.onCallEnded(session);
|
|
5782
5787
|
|
|
5783
5788
|
throw new CanceledCallError(message);
|
|
5784
5789
|
}
|
|
5785
|
-
logger.info('sdk webrtc answer, accepted.');
|
|
5790
|
+
logger$3.info('sdk webrtc answer, accepted.');
|
|
5786
5791
|
this._onAccepted(session);
|
|
5787
5792
|
}).catch(e => {
|
|
5788
|
-
logger.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5793
|
+
logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5789
5794
|
|
|
5790
5795
|
throw e;
|
|
5791
5796
|
});
|
|
@@ -5793,7 +5798,7 @@ class WebRTCClient extends Emitter {
|
|
|
5793
5798
|
|
|
5794
5799
|
hangup(session ) {
|
|
5795
5800
|
const { state, id } = session;
|
|
5796
|
-
logger.info('sdk webrtc hangup call', { id, state });
|
|
5801
|
+
logger$3.info('sdk webrtc hangup call', { id, state });
|
|
5797
5802
|
|
|
5798
5803
|
try {
|
|
5799
5804
|
this._stopSendingStats(session);
|
|
@@ -5822,7 +5827,7 @@ class WebRTCClient extends Emitter {
|
|
|
5822
5827
|
|
|
5823
5828
|
return bye();
|
|
5824
5829
|
} catch (error) {
|
|
5825
|
-
logger.warn('sdk webrtc hangup, error', error);
|
|
5830
|
+
logger$3.warn('sdk webrtc hangup, error', error);
|
|
5826
5831
|
}
|
|
5827
5832
|
|
|
5828
5833
|
return null;
|
|
@@ -5840,7 +5845,7 @@ class WebRTCClient extends Emitter {
|
|
|
5840
5845
|
// Fetch and emit an event at `interval` with session network stats
|
|
5841
5846
|
startNetworkMonitoring(session , interval = 1000) {
|
|
5842
5847
|
const sessionId = this.getSipSessionId(session);
|
|
5843
|
-
logger.info('starting network inspection', { id: sessionId });
|
|
5848
|
+
logger$3.info('starting network inspection', { id: sessionId });
|
|
5844
5849
|
|
|
5845
5850
|
this.sessionNetworkStats[sessionId] = [];
|
|
5846
5851
|
|
|
@@ -5850,7 +5855,7 @@ class WebRTCClient extends Emitter {
|
|
|
5850
5855
|
stopNetworkMonitoring(session ) {
|
|
5851
5856
|
const sessionId = this.getSipSessionId(session);
|
|
5852
5857
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
5853
|
-
logger.info('stopping network inspection', { id: sessionId, exists });
|
|
5858
|
+
logger$3.info('stopping network inspection', { id: sessionId, exists });
|
|
5854
5859
|
|
|
5855
5860
|
if (exists) {
|
|
5856
5861
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -5860,17 +5865,17 @@ class WebRTCClient extends Emitter {
|
|
|
5860
5865
|
}
|
|
5861
5866
|
|
|
5862
5867
|
reject(session ) {
|
|
5863
|
-
logger.info('sdk webrtc reject call', { id: session.id });
|
|
5868
|
+
logger$3.info('sdk webrtc reject call', { id: session.id });
|
|
5864
5869
|
|
|
5865
5870
|
try {
|
|
5866
5871
|
return session.reject ? session.reject() : session.cancel();
|
|
5867
5872
|
} catch (e) {
|
|
5868
|
-
logger.warn('Error when rejecting call', e.message, e.stack);
|
|
5873
|
+
logger$3.warn('Error when rejecting call', e.message, e.stack);
|
|
5869
5874
|
}
|
|
5870
5875
|
}
|
|
5871
5876
|
|
|
5872
5877
|
async close() {
|
|
5873
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5878
|
+
logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5874
5879
|
this._cleanupMedia();
|
|
5875
5880
|
this.connectionPromise = null;
|
|
5876
5881
|
|
|
@@ -5901,7 +5906,7 @@ class WebRTCClient extends Emitter {
|
|
|
5901
5906
|
// eg: "INVITE not rejectable in state Completed"
|
|
5902
5907
|
}
|
|
5903
5908
|
this.userAgent = null;
|
|
5904
|
-
logger.info('sdk webrtc client closed');
|
|
5909
|
+
logger$3.info('sdk webrtc client closed');
|
|
5905
5910
|
}
|
|
5906
5911
|
|
|
5907
5912
|
getNumber(session ) {
|
|
@@ -5914,13 +5919,13 @@ class WebRTCClient extends Emitter {
|
|
|
5914
5919
|
}
|
|
5915
5920
|
|
|
5916
5921
|
mute(session ) {
|
|
5917
|
-
logger.info('sdk webrtc mute', { id: session.id });
|
|
5922
|
+
logger$3.info('sdk webrtc mute', { id: session.id });
|
|
5918
5923
|
|
|
5919
5924
|
this._toggleAudio(session, true);
|
|
5920
5925
|
}
|
|
5921
5926
|
|
|
5922
5927
|
unmute(session ) {
|
|
5923
|
-
logger.info('sdk webrtc unmute', { id: session.id });
|
|
5928
|
+
logger$3.info('sdk webrtc unmute', { id: session.id });
|
|
5924
5929
|
|
|
5925
5930
|
this._toggleAudio(session, false);
|
|
5926
5931
|
}
|
|
@@ -5960,13 +5965,13 @@ class WebRTCClient extends Emitter {
|
|
|
5960
5965
|
}
|
|
5961
5966
|
|
|
5962
5967
|
toggleCameraOn(session ) {
|
|
5963
|
-
logger.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5968
|
+
logger$3.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5964
5969
|
|
|
5965
5970
|
this._toggleVideo(session, false);
|
|
5966
5971
|
}
|
|
5967
5972
|
|
|
5968
5973
|
toggleCameraOff(session ) {
|
|
5969
|
-
logger.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5974
|
+
logger$3.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5970
5975
|
|
|
5971
5976
|
this._toggleVideo(session, true);
|
|
5972
5977
|
}
|
|
@@ -5975,7 +5980,7 @@ class WebRTCClient extends Emitter {
|
|
|
5975
5980
|
const sessionId = this.getSipSessionId(session);
|
|
5976
5981
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
5977
5982
|
|
|
5978
|
-
logger.info('sdk webrtc hold', {
|
|
5983
|
+
logger$3.info('sdk webrtc hold', {
|
|
5979
5984
|
sessionId,
|
|
5980
5985
|
keys: Object.keys(this.heldSessions),
|
|
5981
5986
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6024,7 +6029,7 @@ class WebRTCClient extends Emitter {
|
|
|
6024
6029
|
const sessionId = this.getSipSessionId(session);
|
|
6025
6030
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
6026
6031
|
|
|
6027
|
-
logger.info('sdk webrtc unhold', {
|
|
6032
|
+
logger$3.info('sdk webrtc unhold', {
|
|
6028
6033
|
sessionId,
|
|
6029
6034
|
keys: Object.keys(this.heldSessions),
|
|
6030
6035
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6172,7 +6177,7 @@ class WebRTCClient extends Emitter {
|
|
|
6172
6177
|
if (!session.sessionDescriptionHandler) {
|
|
6173
6178
|
return;
|
|
6174
6179
|
}
|
|
6175
|
-
logger.info('Sending DTMF', {
|
|
6180
|
+
logger$3.info('Sending DTMF', {
|
|
6176
6181
|
id: this.getSipSessionId(session),
|
|
6177
6182
|
tone,
|
|
6178
6183
|
});
|
|
@@ -6188,7 +6193,7 @@ class WebRTCClient extends Emitter {
|
|
|
6188
6193
|
transfer(session , target ) {
|
|
6189
6194
|
this.hold(session);
|
|
6190
6195
|
|
|
6191
|
-
logger.info('Transfering a session', {
|
|
6196
|
+
logger$3.info('Transfering a session', {
|
|
6192
6197
|
id: this.getSipSessionId(session),
|
|
6193
6198
|
target,
|
|
6194
6199
|
});
|
|
@@ -6210,17 +6215,17 @@ class WebRTCClient extends Emitter {
|
|
|
6210
6215
|
atxfer(session ) {
|
|
6211
6216
|
this.hold(session);
|
|
6212
6217
|
|
|
6213
|
-
logger.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6218
|
+
logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6214
6219
|
|
|
6215
6220
|
const result = {
|
|
6216
6221
|
newSession: null,
|
|
6217
6222
|
init: async (target ) => {
|
|
6218
|
-
logger.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6223
|
+
logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6219
6224
|
|
|
6220
6225
|
result.newSession = await this.call(target);
|
|
6221
6226
|
},
|
|
6222
6227
|
complete: () => {
|
|
6223
|
-
logger.info('webrtc transfer completed', {
|
|
6228
|
+
logger$3.info('webrtc transfer completed', {
|
|
6224
6229
|
id: this.getSipSessionId(session),
|
|
6225
6230
|
referId: this.getSipSessionId(result.newSession),
|
|
6226
6231
|
});
|
|
@@ -6241,7 +6246,7 @@ class WebRTCClient extends Emitter {
|
|
|
6241
6246
|
return;
|
|
6242
6247
|
}
|
|
6243
6248
|
|
|
6244
|
-
logger.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6249
|
+
logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6245
6250
|
|
|
6246
6251
|
try {
|
|
6247
6252
|
sipSession.message({
|
|
@@ -6283,7 +6288,7 @@ class WebRTCClient extends Emitter {
|
|
|
6283
6288
|
}
|
|
6284
6289
|
|
|
6285
6290
|
changeAudioOutputVolume(volume ) {
|
|
6286
|
-
logger.info('Changing audio output volume', { volume });
|
|
6291
|
+
logger$3.info('Changing audio output volume', { volume });
|
|
6287
6292
|
|
|
6288
6293
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6289
6294
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -6295,7 +6300,7 @@ class WebRTCClient extends Emitter {
|
|
|
6295
6300
|
}
|
|
6296
6301
|
|
|
6297
6302
|
changeAudioOutputDevice(id ) {
|
|
6298
|
-
logger.info('Changing audio output device', { id });
|
|
6303
|
+
logger$3.info('Changing audio output device', { id });
|
|
6299
6304
|
|
|
6300
6305
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6301
6306
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -6312,7 +6317,7 @@ class WebRTCClient extends Emitter {
|
|
|
6312
6317
|
|
|
6313
6318
|
changeAudioInputDevice(id , session ) {
|
|
6314
6319
|
const currentId = this.getAudioDeviceId();
|
|
6315
|
-
logger.info('setting audio input device', { id, currentId, session: !!session });
|
|
6320
|
+
logger$3.info('setting audio input device', { id, currentId, session: !!session });
|
|
6316
6321
|
|
|
6317
6322
|
if (id === currentId) {
|
|
6318
6323
|
return null;
|
|
@@ -6358,7 +6363,7 @@ class WebRTCClient extends Emitter {
|
|
|
6358
6363
|
|
|
6359
6364
|
setVideoInputDevice(id ) {
|
|
6360
6365
|
const currentId = this.getVideoDeviceId();
|
|
6361
|
-
logger.info('setting video input device', { id, currentId });
|
|
6366
|
+
logger$3.info('setting video input device', { id, currentId });
|
|
6362
6367
|
|
|
6363
6368
|
if (id === currentId) {
|
|
6364
6369
|
return null;
|
|
@@ -6383,7 +6388,7 @@ class WebRTCClient extends Emitter {
|
|
|
6383
6388
|
const sessionId = this.getSipSessionId(session);
|
|
6384
6389
|
const localStream = this.getLocalStream(sessionId);
|
|
6385
6390
|
|
|
6386
|
-
logger.info('changing video input device', { id, sessionId });
|
|
6391
|
+
logger$3.info('changing video input device', { id, sessionId });
|
|
6387
6392
|
|
|
6388
6393
|
// Release old video stream
|
|
6389
6394
|
if (localStream) {
|
|
@@ -6451,7 +6456,7 @@ class WebRTCClient extends Emitter {
|
|
|
6451
6456
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
6452
6457
|
const desktop = newConstraints && newConstraints.desktop;
|
|
6453
6458
|
|
|
6454
|
-
logger.info('Sending reinvite', {
|
|
6459
|
+
logger$3.info('Sending reinvite', {
|
|
6455
6460
|
id: this.getSipSessionId(sipSession),
|
|
6456
6461
|
newConstraints,
|
|
6457
6462
|
conference,
|
|
@@ -6489,7 +6494,7 @@ class WebRTCClient extends Emitter {
|
|
|
6489
6494
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
6490
6495
|
}
|
|
6491
6496
|
|
|
6492
|
-
logger.info('on re-INVITE accepted', {
|
|
6497
|
+
logger$3.info('on re-INVITE accepted', {
|
|
6493
6498
|
id: this.getSipSessionId(sipSession),
|
|
6494
6499
|
wasMuted,
|
|
6495
6500
|
shouldDoScreenSharing,
|
|
@@ -6664,7 +6669,7 @@ class WebRTCClient extends Emitter {
|
|
|
6664
6669
|
}
|
|
6665
6670
|
|
|
6666
6671
|
startHeartbeat() {
|
|
6667
|
-
logger.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6672
|
+
logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6668
6673
|
if (!this.userAgent) {
|
|
6669
6674
|
this.heartbeat.stop();
|
|
6670
6675
|
return;
|
|
@@ -6677,7 +6682,7 @@ class WebRTCClient extends Emitter {
|
|
|
6677
6682
|
}
|
|
6678
6683
|
|
|
6679
6684
|
stopHeartbeat() {
|
|
6680
|
-
logger.info('sdk webrtc stop heartbeat');
|
|
6685
|
+
logger$3.info('sdk webrtc stop heartbeat');
|
|
6681
6686
|
this.heartbeat.stop();
|
|
6682
6687
|
}
|
|
6683
6688
|
|
|
@@ -6698,7 +6703,7 @@ class WebRTCClient extends Emitter {
|
|
|
6698
6703
|
}
|
|
6699
6704
|
|
|
6700
6705
|
attemptReconnection() {
|
|
6701
|
-
logger.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6706
|
+
logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6702
6707
|
if (!this.userAgent) {
|
|
6703
6708
|
return;
|
|
6704
6709
|
}
|
|
@@ -6723,7 +6728,7 @@ class WebRTCClient extends Emitter {
|
|
|
6723
6728
|
return;
|
|
6724
6729
|
}
|
|
6725
6730
|
|
|
6726
|
-
logger.info('setting local media stream', {
|
|
6731
|
+
logger$3.info('setting local media stream', {
|
|
6727
6732
|
sipSessionId,
|
|
6728
6733
|
tracks: newStream ? newStream.getTracks() : null,
|
|
6729
6734
|
});
|
|
@@ -6740,7 +6745,7 @@ class WebRTCClient extends Emitter {
|
|
|
6740
6745
|
|
|
6741
6746
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
6742
6747
|
|
|
6743
|
-
logger.info('updating local stream', {
|
|
6748
|
+
logger$3.info('updating local stream', {
|
|
6744
6749
|
sipSessionId,
|
|
6745
6750
|
oldStream: !!oldStream,
|
|
6746
6751
|
tracks: newStream.getTracks(),
|
|
@@ -6760,7 +6765,7 @@ class WebRTCClient extends Emitter {
|
|
|
6760
6765
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
6761
6766
|
const pc = this.getPeerConnection(sessionId);
|
|
6762
6767
|
|
|
6763
|
-
logger.info('Updating remote stream', {
|
|
6768
|
+
logger$3.info('Updating remote stream', {
|
|
6764
6769
|
sessionId,
|
|
6765
6770
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
6766
6771
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -6786,7 +6791,7 @@ class WebRTCClient extends Emitter {
|
|
|
6786
6791
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
6787
6792
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
6788
6793
|
|
|
6789
|
-
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6794
|
+
logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6790
6795
|
|
|
6791
6796
|
return {
|
|
6792
6797
|
constraints: {
|
|
@@ -6835,7 +6840,7 @@ class WebRTCClient extends Emitter {
|
|
|
6835
6840
|
}
|
|
6836
6841
|
|
|
6837
6842
|
_onTransportError() {
|
|
6838
|
-
logger.error('on transport error');
|
|
6843
|
+
logger$3.error('on transport error');
|
|
6839
6844
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
6840
6845
|
this.attemptReconnection();
|
|
6841
6846
|
}
|
|
@@ -6844,7 +6849,7 @@ class WebRTCClient extends Emitter {
|
|
|
6844
6849
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
6845
6850
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
6846
6851
|
if (this.hasHeartbeat()) {
|
|
6847
|
-
logger.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6852
|
+
logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6848
6853
|
|
|
6849
6854
|
this.heartbeat.onHeartbeat();
|
|
6850
6855
|
if (this.heartbeatCb) {
|
|
@@ -6855,7 +6860,7 @@ class WebRTCClient extends Emitter {
|
|
|
6855
6860
|
}
|
|
6856
6861
|
|
|
6857
6862
|
async _onHeartbeatTimeout() {
|
|
6858
|
-
logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6863
|
+
logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6859
6864
|
|
|
6860
6865
|
if (this.heartbeatTimeoutCb) {
|
|
6861
6866
|
this.heartbeatTimeoutCb();
|
|
@@ -6867,7 +6872,7 @@ class WebRTCClient extends Emitter {
|
|
|
6867
6872
|
try {
|
|
6868
6873
|
await this.userAgent.transport.disconnect();
|
|
6869
6874
|
} catch (e) {
|
|
6870
|
-
logger.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6875
|
+
logger$3.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6871
6876
|
}
|
|
6872
6877
|
}
|
|
6873
6878
|
|
|
@@ -6900,31 +6905,31 @@ class WebRTCClient extends Emitter {
|
|
|
6900
6905
|
}
|
|
6901
6906
|
|
|
6902
6907
|
_connectIfNeeded() {
|
|
6903
|
-
logger.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6908
|
+
logger$3.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6904
6909
|
if (!this.userAgent) {
|
|
6905
|
-
logger.info('need to recreate User Agent');
|
|
6910
|
+
logger$3.info('need to recreate User Agent');
|
|
6906
6911
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6907
6912
|
}
|
|
6908
6913
|
|
|
6909
6914
|
if (this.isConnected()) {
|
|
6910
|
-
logger.info('webrtc sdk, already connected');
|
|
6915
|
+
logger$3.info('webrtc sdk, already connected');
|
|
6911
6916
|
return Promise.resolve();
|
|
6912
6917
|
}
|
|
6913
6918
|
|
|
6914
6919
|
if (this.isConnecting()) {
|
|
6915
|
-
logger.info('webrtc sdk, already connecting...');
|
|
6920
|
+
logger$3.info('webrtc sdk, already connecting...');
|
|
6916
6921
|
|
|
6917
6922
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
6918
6923
|
return this.connectionPromise;
|
|
6919
6924
|
}
|
|
6920
6925
|
|
|
6921
6926
|
if (this.connectionPromise) {
|
|
6922
|
-
logger.info('webrtc sdk, connection promise connecting...');
|
|
6927
|
+
logger$3.info('webrtc sdk, connection promise connecting...');
|
|
6923
6928
|
// $FlowFixMe
|
|
6924
6929
|
return this.connectionPromise;
|
|
6925
6930
|
}
|
|
6926
6931
|
|
|
6927
|
-
logger.info('WebRTC UA needs to connect');
|
|
6932
|
+
logger$3.info('WebRTC UA needs to connect');
|
|
6928
6933
|
|
|
6929
6934
|
// Force UA to reconnect
|
|
6930
6935
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -7049,7 +7054,7 @@ class WebRTCClient extends Emitter {
|
|
|
7049
7054
|
|
|
7050
7055
|
sdh.peerConnectionDelegate = {
|
|
7051
7056
|
onicecandidateerror: (error ) => {
|
|
7052
|
-
logger.error('on icecandidate error', {
|
|
7057
|
+
logger$3.error('on icecandidate error', {
|
|
7053
7058
|
address: error.address,
|
|
7054
7059
|
port: error.port,
|
|
7055
7060
|
errorCode: error.errorCode,
|
|
@@ -7078,7 +7083,7 @@ class WebRTCClient extends Emitter {
|
|
|
7078
7083
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
7079
7084
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
7080
7085
|
}
|
|
7081
|
-
logger.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7086
|
+
logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7082
7087
|
|
|
7083
7088
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
7084
7089
|
|
|
@@ -7099,7 +7104,7 @@ class WebRTCClient extends Emitter {
|
|
|
7099
7104
|
}
|
|
7100
7105
|
|
|
7101
7106
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
7102
|
-
logger.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7107
|
+
logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7103
7108
|
|
|
7104
7109
|
this.storeSipSession(session);
|
|
7105
7110
|
|
|
@@ -7111,7 +7116,7 @@ class WebRTCClient extends Emitter {
|
|
|
7111
7116
|
const onTrack = (event ) => {
|
|
7112
7117
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7113
7118
|
const { kind, label, readyState, id, muted } = event.track;
|
|
7114
|
-
logger.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7119
|
+
logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7115
7120
|
|
|
7116
7121
|
// Stop video track in audio only mode
|
|
7117
7122
|
if (isAudioOnly && kind === 'video') {
|
|
@@ -7128,7 +7133,7 @@ class WebRTCClient extends Emitter {
|
|
|
7128
7133
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7129
7134
|
|
|
7130
7135
|
pc.oniceconnectionstatechange = () => {
|
|
7131
|
-
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7136
|
+
logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7132
7137
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7133
7138
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7134
7139
|
}
|
|
@@ -7301,10 +7306,10 @@ class WebRTCClient extends Emitter {
|
|
|
7301
7306
|
|
|
7302
7307
|
_stopSendingStats(session ) {
|
|
7303
7308
|
const sessionId = this.getSipSessionId(session);
|
|
7304
|
-
logger.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7309
|
+
logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7305
7310
|
|
|
7306
7311
|
if (sessionId in this.statsIntervals) {
|
|
7307
|
-
logger.trace('Stop sending stats for call', { sessionId });
|
|
7312
|
+
logger$3.trace('Stop sending stats for call', { sessionId });
|
|
7308
7313
|
this.statsIntervals[sessionId]();
|
|
7309
7314
|
delete this.statsIntervals[sessionId];
|
|
7310
7315
|
}
|
|
@@ -7320,7 +7325,7 @@ class WebRTCClient extends Emitter {
|
|
|
7320
7325
|
try {
|
|
7321
7326
|
await this.userAgent.transport.disconnect();
|
|
7322
7327
|
} catch (e) {
|
|
7323
|
-
logger.error('WebRTC transport disconnect, error', e);
|
|
7328
|
+
logger$3.error('WebRTC transport disconnect, error', e);
|
|
7324
7329
|
}
|
|
7325
7330
|
}
|
|
7326
7331
|
}
|