@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/esm/web-rtc-client.js
CHANGED
|
@@ -100,7 +100,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
100
100
|
|
|
101
101
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
102
102
|
|
|
103
|
-
const logger
|
|
103
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
104
104
|
|
|
105
105
|
// Use a function here to be able to mock it in tests
|
|
106
106
|
const realFetch = () => {
|
|
@@ -239,7 +239,7 @@ class ApiRequester {
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
if (this.refreshTokenPromise) {
|
|
242
|
-
logger
|
|
242
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
243
243
|
await this.refreshTokenPromise;
|
|
244
244
|
}
|
|
245
245
|
|
|
@@ -259,7 +259,7 @@ class ApiRequester {
|
|
|
259
259
|
return promise.then(async (err ) => {
|
|
260
260
|
// Check if the token is still valid
|
|
261
261
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
262
|
-
logger
|
|
262
|
+
logger.warn('token expired', { error: err.reason });
|
|
263
263
|
// Replay the call after refreshing the token
|
|
264
264
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
265
265
|
}
|
|
@@ -269,7 +269,7 @@ class ApiRequester {
|
|
|
269
269
|
: exceptionClass.fromResponse(err, response.status);
|
|
270
270
|
|
|
271
271
|
if (this.shouldLogErrors) {
|
|
272
|
-
logger
|
|
272
|
+
logger.error('API error', error);
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
throw error;
|
|
@@ -279,7 +279,7 @@ class ApiRequester {
|
|
|
279
279
|
return newParse(response, isJson);
|
|
280
280
|
}).catch(error => {
|
|
281
281
|
if (this.shouldLogErrors) {
|
|
282
|
-
logger
|
|
282
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
throw error;
|
|
@@ -307,13 +307,13 @@ class ApiRequester {
|
|
|
307
307
|
) {
|
|
308
308
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
309
309
|
let newPath = path;
|
|
310
|
-
logger
|
|
310
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
311
311
|
|
|
312
312
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
313
313
|
|
|
314
314
|
return this.refreshTokenPromise.then(() => {
|
|
315
315
|
this.refreshTokenPromise = null;
|
|
316
|
-
logger
|
|
316
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
317
317
|
if (isTokenNotFound) {
|
|
318
318
|
const pathParts = path.split('/');
|
|
319
319
|
pathParts.pop();
|
|
@@ -3154,8 +3154,9 @@ class ExternalApp {
|
|
|
3154
3154
|
|
|
3155
3155
|
|
|
3156
3156
|
|
|
3157
|
-
|
|
3157
|
+
|
|
3158
3158
|
|
|
3159
|
+
|
|
3159
3160
|
|
|
3160
3161
|
|
|
3161
3162
|
class Meeting {
|
|
@@ -3166,9 +3167,10 @@ class Meeting {
|
|
|
3166
3167
|
|
|
3167
3168
|
|
|
3168
3169
|
|
|
3169
|
-
|
|
3170
|
+
|
|
3170
3171
|
|
|
3171
3172
|
|
|
3173
|
+
|
|
3172
3174
|
|
|
3173
3175
|
static parse(plain ) {
|
|
3174
3176
|
return new Meeting({
|
|
@@ -3178,8 +3180,9 @@ class Meeting {
|
|
|
3178
3180
|
ownerUuids: plain.owner_uuids,
|
|
3179
3181
|
port: plain.port,
|
|
3180
3182
|
uuid: plain.uuid,
|
|
3181
|
-
|
|
3183
|
+
extension: plain.exten,
|
|
3182
3184
|
persistent: plain.persistent,
|
|
3185
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
3183
3186
|
});
|
|
3184
3187
|
}
|
|
3185
3188
|
|
|
@@ -3201,8 +3204,9 @@ class Meeting {
|
|
|
3201
3204
|
ownerUuids,
|
|
3202
3205
|
port,
|
|
3203
3206
|
uri,
|
|
3204
|
-
|
|
3207
|
+
extension,
|
|
3205
3208
|
persistent,
|
|
3209
|
+
creationTime,
|
|
3206
3210
|
} = {}) {
|
|
3207
3211
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3208
3212
|
this.uri = uri;
|
|
@@ -3210,8 +3214,9 @@ class Meeting {
|
|
|
3210
3214
|
this.ownerUuids = ownerUuids;
|
|
3211
3215
|
this.port = port;
|
|
3212
3216
|
this.uuid = uuid;
|
|
3213
|
-
this.
|
|
3217
|
+
this.extension = extension;
|
|
3214
3218
|
this.persistent = persistent;
|
|
3219
|
+
this.creationTime = creationTime;
|
|
3215
3220
|
|
|
3216
3221
|
// Useful to compare instead of instanceof with minified code
|
|
3217
3222
|
this.type = 'Meeting';
|
|
@@ -4133,7 +4138,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4133
4138
|
|
|
4134
4139
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4135
4140
|
|
|
4136
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4141
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4137
4142
|
|
|
4138
4143
|
/* */
|
|
4139
4144
|
|
|
@@ -5052,7 +5057,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5052
5057
|
const WEBHOOKD_VERSION = '1.0';
|
|
5053
5058
|
const AMID_VERSION = '1.0';
|
|
5054
5059
|
|
|
5055
|
-
const logger$
|
|
5060
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5056
5061
|
|
|
5057
5062
|
class ApiClient {
|
|
5058
5063
|
|
|
@@ -5104,12 +5109,12 @@ class ApiClient {
|
|
|
5104
5109
|
}
|
|
5105
5110
|
|
|
5106
5111
|
async forceRefreshToken() {
|
|
5107
|
-
logger$
|
|
5112
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5108
5113
|
return this.refreshTokenCallback();
|
|
5109
5114
|
}
|
|
5110
5115
|
|
|
5111
5116
|
async refreshTokenCallback() {
|
|
5112
|
-
logger$
|
|
5117
|
+
logger$2.info('refresh token callback called', {
|
|
5113
5118
|
refreshToken: this.refreshToken,
|
|
5114
5119
|
refreshBackend: this.refreshBackend,
|
|
5115
5120
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5127,7 +5132,7 @@ class ApiClient {
|
|
|
5127
5132
|
this.isMobile,
|
|
5128
5133
|
);
|
|
5129
5134
|
|
|
5130
|
-
logger$
|
|
5135
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5131
5136
|
|
|
5132
5137
|
if (this.onRefreshToken) {
|
|
5133
5138
|
this.onRefreshToken(session.token, session);
|
|
@@ -5300,7 +5305,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
5300
5305
|
const SEND_STATS_DELAY = 5000;
|
|
5301
5306
|
|
|
5302
5307
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
5303
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5308
|
+
const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5304
5309
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
5305
5310
|
|
|
5306
5311
|
// events
|
|
@@ -5479,13 +5484,13 @@ class WebRTCClient extends Emitter {
|
|
|
5479
5484
|
|
|
5480
5485
|
createUserAgent(configOverrides ) {
|
|
5481
5486
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
5482
|
-
logger.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5487
|
+
logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5483
5488
|
|
|
5484
5489
|
webRTCConfiguration.delegate = {
|
|
5485
5490
|
onConnect: this.onConnect.bind(this),
|
|
5486
5491
|
onDisconnect: this.onDisconnect.bind(this),
|
|
5487
5492
|
onInvite: (invitation ) => {
|
|
5488
|
-
logger.info('sdk webrtc on invite', {
|
|
5493
|
+
logger$3.info('sdk webrtc on invite', {
|
|
5489
5494
|
method: 'delegate.onInvite',
|
|
5490
5495
|
id: invitation.id,
|
|
5491
5496
|
remoteURI: invitation.remoteURI,
|
|
@@ -5528,7 +5533,7 @@ class WebRTCClient extends Emitter {
|
|
|
5528
5533
|
}
|
|
5529
5534
|
|
|
5530
5535
|
onConnect() {
|
|
5531
|
-
logger.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5536
|
+
logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5532
5537
|
this.eventEmitter.emit(CONNECTED);
|
|
5533
5538
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
5534
5539
|
this.registerer.waitingToggle(false);
|
|
@@ -5537,7 +5542,7 @@ class WebRTCClient extends Emitter {
|
|
|
5537
5542
|
}
|
|
5538
5543
|
|
|
5539
5544
|
async onDisconnect(error ) {
|
|
5540
|
-
logger.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5545
|
+
logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5541
5546
|
this.connectionPromise = null;
|
|
5542
5547
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
5543
5548
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -5562,37 +5567,37 @@ class WebRTCClient extends Emitter {
|
|
|
5562
5567
|
};
|
|
5563
5568
|
|
|
5564
5569
|
if (this.skipRegister) {
|
|
5565
|
-
logger.info('sdk webrtc skip register...', logInfo);
|
|
5570
|
+
logger$3.info('sdk webrtc skip register...', logInfo);
|
|
5566
5571
|
return Promise.resolve();
|
|
5567
5572
|
}
|
|
5568
5573
|
|
|
5569
|
-
logger.info('sdk webrtc registering...', logInfo);
|
|
5574
|
+
logger$3.info('sdk webrtc registering...', logInfo);
|
|
5570
5575
|
|
|
5571
5576
|
if (!this.userAgent) {
|
|
5572
|
-
logger.info('sdk webrtc recreating User Agent');
|
|
5577
|
+
logger$3.info('sdk webrtc recreating User Agent');
|
|
5573
5578
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5574
5579
|
}
|
|
5575
5580
|
if (!this.userAgent || this.isRegistered()) {
|
|
5576
|
-
logger.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5581
|
+
logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5577
5582
|
return Promise.resolve();
|
|
5578
5583
|
}
|
|
5579
5584
|
|
|
5580
5585
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
5581
|
-
logger.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5586
|
+
logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5582
5587
|
return Promise.resolve();
|
|
5583
5588
|
}
|
|
5584
5589
|
|
|
5585
5590
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5586
5591
|
|
|
5587
5592
|
const onRegisterFailed = () => {
|
|
5588
|
-
logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5593
|
+
logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5589
5594
|
this.connectionPromise = null;
|
|
5590
5595
|
if (this.registerer && this.registerer.waiting) {
|
|
5591
5596
|
this.registerer.waitingToggle(false);
|
|
5592
5597
|
}
|
|
5593
5598
|
|
|
5594
5599
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
5595
|
-
logger.info('sdk webrtc registering, retrying...', { tries });
|
|
5600
|
+
logger$3.info('sdk webrtc registering, retrying...', { tries });
|
|
5596
5601
|
setTimeout(() => this.register(tries + 1), 300);
|
|
5597
5602
|
}
|
|
5598
5603
|
};
|
|
@@ -5601,18 +5606,18 @@ class WebRTCClient extends Emitter {
|
|
|
5601
5606
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
5602
5607
|
// during the resolution of the primise.
|
|
5603
5608
|
if (!this.userAgent) {
|
|
5604
|
-
logger.info('sdk webrtc recreating User Agent after connection');
|
|
5609
|
+
logger$3.info('sdk webrtc recreating User Agent after connection');
|
|
5605
5610
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5606
5611
|
}
|
|
5607
5612
|
|
|
5608
|
-
logger.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5613
|
+
logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5609
5614
|
this.registerer = new Registerer(this.userAgent, registerOptions);
|
|
5610
5615
|
this.connectionPromise = null;
|
|
5611
5616
|
this._monkeyPatchRegisterer(this.registerer);
|
|
5612
5617
|
|
|
5613
5618
|
// Bind registerer events
|
|
5614
5619
|
this.registerer.stateChange.addListener(newState => {
|
|
5615
|
-
logger.info('sdk webrtc registering, state changed', { newState });
|
|
5620
|
+
logger$3.info('sdk webrtc registering, state changed', { newState });
|
|
5616
5621
|
|
|
5617
5622
|
if (newState === RegistererState.Registered && this.registerer
|
|
5618
5623
|
&& this.registerer.state === RegistererState.Registered) {
|
|
@@ -5625,7 +5630,7 @@ class WebRTCClient extends Emitter {
|
|
|
5625
5630
|
const options = {
|
|
5626
5631
|
requestDelegate: {
|
|
5627
5632
|
onReject: response => {
|
|
5628
|
-
logger.error('sdk webrtc registering, rejected', { response });
|
|
5633
|
+
logger$3.error('sdk webrtc registering, rejected', { response });
|
|
5629
5634
|
|
|
5630
5635
|
onRegisterFailed();
|
|
5631
5636
|
},
|
|
@@ -5633,13 +5638,13 @@ class WebRTCClient extends Emitter {
|
|
|
5633
5638
|
};
|
|
5634
5639
|
|
|
5635
5640
|
return this.registerer.register(options).catch((e) => {
|
|
5636
|
-
logger.error('sdk webrtc registering, error', e);
|
|
5641
|
+
logger$3.error('sdk webrtc registering, error', e);
|
|
5637
5642
|
|
|
5638
5643
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
5639
5644
|
return e;
|
|
5640
5645
|
});
|
|
5641
5646
|
}).catch(error => {
|
|
5642
|
-
logger.error('sdk webrtc registering, transport error', error);
|
|
5647
|
+
logger$3.error('sdk webrtc registering, transport error', error);
|
|
5643
5648
|
onRegisterFailed();
|
|
5644
5649
|
});
|
|
5645
5650
|
}
|
|
@@ -5668,21 +5673,21 @@ class WebRTCClient extends Emitter {
|
|
|
5668
5673
|
}
|
|
5669
5674
|
|
|
5670
5675
|
unregister() {
|
|
5671
|
-
logger.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5676
|
+
logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5672
5677
|
if (!this.registerer) {
|
|
5673
5678
|
return Promise.resolve();
|
|
5674
5679
|
}
|
|
5675
5680
|
|
|
5676
5681
|
try {
|
|
5677
5682
|
return this.registerer.unregister().then(() => {
|
|
5678
|
-
logger.info('sdk webrtc unregistered');
|
|
5683
|
+
logger$3.info('sdk webrtc unregistered');
|
|
5679
5684
|
this._cleanupRegister();
|
|
5680
5685
|
}).catch(e => {
|
|
5681
|
-
logger.error('sdk webrtc unregistering, promise error', e);
|
|
5686
|
+
logger$3.error('sdk webrtc unregistering, promise error', e);
|
|
5682
5687
|
this._cleanupRegister();
|
|
5683
5688
|
});
|
|
5684
5689
|
} catch (e) {
|
|
5685
|
-
logger.error('sdk webrtc unregistering, error', e);
|
|
5690
|
+
logger$3.error('sdk webrtc unregistering, error', e);
|
|
5686
5691
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
5687
5692
|
// error when the registerer is in a bad state
|
|
5688
5693
|
this._cleanupRegister();
|
|
@@ -5690,7 +5695,7 @@ class WebRTCClient extends Emitter {
|
|
|
5690
5695
|
}
|
|
5691
5696
|
|
|
5692
5697
|
stop() {
|
|
5693
|
-
logger.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5698
|
+
logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5694
5699
|
if (!this.userAgent) {
|
|
5695
5700
|
return Promise.resolve();
|
|
5696
5701
|
}
|
|
@@ -5698,12 +5703,12 @@ class WebRTCClient extends Emitter {
|
|
|
5698
5703
|
return this.userAgent.stop().then(() => {
|
|
5699
5704
|
return this._cleanupRegister();
|
|
5700
5705
|
}).catch(e => {
|
|
5701
|
-
logger.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5706
|
+
logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5702
5707
|
});
|
|
5703
5708
|
}
|
|
5704
5709
|
|
|
5705
5710
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
5706
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5711
|
+
logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5707
5712
|
const inviterOptions = {
|
|
5708
5713
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
5709
5714
|
conference,
|
|
@@ -5734,7 +5739,7 @@ class WebRTCClient extends Emitter {
|
|
|
5734
5739
|
this._onAccepted(session, response.session, true);
|
|
5735
5740
|
},
|
|
5736
5741
|
onReject: (response ) => {
|
|
5737
|
-
logger.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5742
|
+
logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5738
5743
|
this._stopSendingStats(session);
|
|
5739
5744
|
this.stopNetworkMonitoring(session);
|
|
5740
5745
|
|
|
@@ -5757,11 +5762,11 @@ class WebRTCClient extends Emitter {
|
|
|
5757
5762
|
}
|
|
5758
5763
|
|
|
5759
5764
|
answer(session , enableVideo ) {
|
|
5760
|
-
logger.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5765
|
+
logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5761
5766
|
|
|
5762
5767
|
if (!session || !session.accept) {
|
|
5763
5768
|
const error = 'No session to answer, or not an invitation';
|
|
5764
|
-
logger.warn(error);
|
|
5769
|
+
logger$3.warn(error);
|
|
5765
5770
|
return Promise.reject(new Error(error));
|
|
5766
5771
|
}
|
|
5767
5772
|
const options = {
|
|
@@ -5771,15 +5776,15 @@ class WebRTCClient extends Emitter {
|
|
|
5771
5776
|
return session.accept(options).then(() => {
|
|
5772
5777
|
if (session.isCanceled) {
|
|
5773
5778
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
5774
|
-
logger.error(message, { id: session.id });
|
|
5779
|
+
logger$3.error(message, { id: session.id });
|
|
5775
5780
|
this.onCallEnded(session);
|
|
5776
5781
|
|
|
5777
5782
|
throw new CanceledCallError(message);
|
|
5778
5783
|
}
|
|
5779
|
-
logger.info('sdk webrtc answer, accepted.');
|
|
5784
|
+
logger$3.info('sdk webrtc answer, accepted.');
|
|
5780
5785
|
this._onAccepted(session);
|
|
5781
5786
|
}).catch(e => {
|
|
5782
|
-
logger.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5787
|
+
logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5783
5788
|
|
|
5784
5789
|
throw e;
|
|
5785
5790
|
});
|
|
@@ -5787,7 +5792,7 @@ class WebRTCClient extends Emitter {
|
|
|
5787
5792
|
|
|
5788
5793
|
hangup(session ) {
|
|
5789
5794
|
const { state, id } = session;
|
|
5790
|
-
logger.info('sdk webrtc hangup call', { id, state });
|
|
5795
|
+
logger$3.info('sdk webrtc hangup call', { id, state });
|
|
5791
5796
|
|
|
5792
5797
|
try {
|
|
5793
5798
|
this._stopSendingStats(session);
|
|
@@ -5816,7 +5821,7 @@ class WebRTCClient extends Emitter {
|
|
|
5816
5821
|
|
|
5817
5822
|
return bye();
|
|
5818
5823
|
} catch (error) {
|
|
5819
|
-
logger.warn('sdk webrtc hangup, error', error);
|
|
5824
|
+
logger$3.warn('sdk webrtc hangup, error', error);
|
|
5820
5825
|
}
|
|
5821
5826
|
|
|
5822
5827
|
return null;
|
|
@@ -5834,7 +5839,7 @@ class WebRTCClient extends Emitter {
|
|
|
5834
5839
|
// Fetch and emit an event at `interval` with session network stats
|
|
5835
5840
|
startNetworkMonitoring(session , interval = 1000) {
|
|
5836
5841
|
const sessionId = this.getSipSessionId(session);
|
|
5837
|
-
logger.info('starting network inspection', { id: sessionId });
|
|
5842
|
+
logger$3.info('starting network inspection', { id: sessionId });
|
|
5838
5843
|
|
|
5839
5844
|
this.sessionNetworkStats[sessionId] = [];
|
|
5840
5845
|
|
|
@@ -5844,7 +5849,7 @@ class WebRTCClient extends Emitter {
|
|
|
5844
5849
|
stopNetworkMonitoring(session ) {
|
|
5845
5850
|
const sessionId = this.getSipSessionId(session);
|
|
5846
5851
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
5847
|
-
logger.info('stopping network inspection', { id: sessionId, exists });
|
|
5852
|
+
logger$3.info('stopping network inspection', { id: sessionId, exists });
|
|
5848
5853
|
|
|
5849
5854
|
if (exists) {
|
|
5850
5855
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -5854,17 +5859,17 @@ class WebRTCClient extends Emitter {
|
|
|
5854
5859
|
}
|
|
5855
5860
|
|
|
5856
5861
|
reject(session ) {
|
|
5857
|
-
logger.info('sdk webrtc reject call', { id: session.id });
|
|
5862
|
+
logger$3.info('sdk webrtc reject call', { id: session.id });
|
|
5858
5863
|
|
|
5859
5864
|
try {
|
|
5860
5865
|
return session.reject ? session.reject() : session.cancel();
|
|
5861
5866
|
} catch (e) {
|
|
5862
|
-
logger.warn('Error when rejecting call', e.message, e.stack);
|
|
5867
|
+
logger$3.warn('Error when rejecting call', e.message, e.stack);
|
|
5863
5868
|
}
|
|
5864
5869
|
}
|
|
5865
5870
|
|
|
5866
5871
|
async close() {
|
|
5867
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5872
|
+
logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5868
5873
|
this._cleanupMedia();
|
|
5869
5874
|
this.connectionPromise = null;
|
|
5870
5875
|
|
|
@@ -5895,7 +5900,7 @@ class WebRTCClient extends Emitter {
|
|
|
5895
5900
|
// eg: "INVITE not rejectable in state Completed"
|
|
5896
5901
|
}
|
|
5897
5902
|
this.userAgent = null;
|
|
5898
|
-
logger.info('sdk webrtc client closed');
|
|
5903
|
+
logger$3.info('sdk webrtc client closed');
|
|
5899
5904
|
}
|
|
5900
5905
|
|
|
5901
5906
|
getNumber(session ) {
|
|
@@ -5908,13 +5913,13 @@ class WebRTCClient extends Emitter {
|
|
|
5908
5913
|
}
|
|
5909
5914
|
|
|
5910
5915
|
mute(session ) {
|
|
5911
|
-
logger.info('sdk webrtc mute', { id: session.id });
|
|
5916
|
+
logger$3.info('sdk webrtc mute', { id: session.id });
|
|
5912
5917
|
|
|
5913
5918
|
this._toggleAudio(session, true);
|
|
5914
5919
|
}
|
|
5915
5920
|
|
|
5916
5921
|
unmute(session ) {
|
|
5917
|
-
logger.info('sdk webrtc unmute', { id: session.id });
|
|
5922
|
+
logger$3.info('sdk webrtc unmute', { id: session.id });
|
|
5918
5923
|
|
|
5919
5924
|
this._toggleAudio(session, false);
|
|
5920
5925
|
}
|
|
@@ -5954,13 +5959,13 @@ class WebRTCClient extends Emitter {
|
|
|
5954
5959
|
}
|
|
5955
5960
|
|
|
5956
5961
|
toggleCameraOn(session ) {
|
|
5957
|
-
logger.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5962
|
+
logger$3.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5958
5963
|
|
|
5959
5964
|
this._toggleVideo(session, false);
|
|
5960
5965
|
}
|
|
5961
5966
|
|
|
5962
5967
|
toggleCameraOff(session ) {
|
|
5963
|
-
logger.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5968
|
+
logger$3.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5964
5969
|
|
|
5965
5970
|
this._toggleVideo(session, true);
|
|
5966
5971
|
}
|
|
@@ -5969,7 +5974,7 @@ class WebRTCClient extends Emitter {
|
|
|
5969
5974
|
const sessionId = this.getSipSessionId(session);
|
|
5970
5975
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
5971
5976
|
|
|
5972
|
-
logger.info('sdk webrtc hold', {
|
|
5977
|
+
logger$3.info('sdk webrtc hold', {
|
|
5973
5978
|
sessionId,
|
|
5974
5979
|
keys: Object.keys(this.heldSessions),
|
|
5975
5980
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6018,7 +6023,7 @@ class WebRTCClient extends Emitter {
|
|
|
6018
6023
|
const sessionId = this.getSipSessionId(session);
|
|
6019
6024
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
6020
6025
|
|
|
6021
|
-
logger.info('sdk webrtc unhold', {
|
|
6026
|
+
logger$3.info('sdk webrtc unhold', {
|
|
6022
6027
|
sessionId,
|
|
6023
6028
|
keys: Object.keys(this.heldSessions),
|
|
6024
6029
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6166,7 +6171,7 @@ class WebRTCClient extends Emitter {
|
|
|
6166
6171
|
if (!session.sessionDescriptionHandler) {
|
|
6167
6172
|
return;
|
|
6168
6173
|
}
|
|
6169
|
-
logger.info('Sending DTMF', {
|
|
6174
|
+
logger$3.info('Sending DTMF', {
|
|
6170
6175
|
id: this.getSipSessionId(session),
|
|
6171
6176
|
tone,
|
|
6172
6177
|
});
|
|
@@ -6182,7 +6187,7 @@ class WebRTCClient extends Emitter {
|
|
|
6182
6187
|
transfer(session , target ) {
|
|
6183
6188
|
this.hold(session);
|
|
6184
6189
|
|
|
6185
|
-
logger.info('Transfering a session', {
|
|
6190
|
+
logger$3.info('Transfering a session', {
|
|
6186
6191
|
id: this.getSipSessionId(session),
|
|
6187
6192
|
target,
|
|
6188
6193
|
});
|
|
@@ -6204,17 +6209,17 @@ class WebRTCClient extends Emitter {
|
|
|
6204
6209
|
atxfer(session ) {
|
|
6205
6210
|
this.hold(session);
|
|
6206
6211
|
|
|
6207
|
-
logger.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6212
|
+
logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6208
6213
|
|
|
6209
6214
|
const result = {
|
|
6210
6215
|
newSession: null,
|
|
6211
6216
|
init: async (target ) => {
|
|
6212
|
-
logger.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6217
|
+
logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6213
6218
|
|
|
6214
6219
|
result.newSession = await this.call(target);
|
|
6215
6220
|
},
|
|
6216
6221
|
complete: () => {
|
|
6217
|
-
logger.info('webrtc transfer completed', {
|
|
6222
|
+
logger$3.info('webrtc transfer completed', {
|
|
6218
6223
|
id: this.getSipSessionId(session),
|
|
6219
6224
|
referId: this.getSipSessionId(result.newSession),
|
|
6220
6225
|
});
|
|
@@ -6235,7 +6240,7 @@ class WebRTCClient extends Emitter {
|
|
|
6235
6240
|
return;
|
|
6236
6241
|
}
|
|
6237
6242
|
|
|
6238
|
-
logger.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6243
|
+
logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6239
6244
|
|
|
6240
6245
|
try {
|
|
6241
6246
|
sipSession.message({
|
|
@@ -6277,7 +6282,7 @@ class WebRTCClient extends Emitter {
|
|
|
6277
6282
|
}
|
|
6278
6283
|
|
|
6279
6284
|
changeAudioOutputVolume(volume ) {
|
|
6280
|
-
logger.info('Changing audio output volume', { volume });
|
|
6285
|
+
logger$3.info('Changing audio output volume', { volume });
|
|
6281
6286
|
|
|
6282
6287
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6283
6288
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -6289,7 +6294,7 @@ class WebRTCClient extends Emitter {
|
|
|
6289
6294
|
}
|
|
6290
6295
|
|
|
6291
6296
|
changeAudioOutputDevice(id ) {
|
|
6292
|
-
logger.info('Changing audio output device', { id });
|
|
6297
|
+
logger$3.info('Changing audio output device', { id });
|
|
6293
6298
|
|
|
6294
6299
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6295
6300
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -6306,7 +6311,7 @@ class WebRTCClient extends Emitter {
|
|
|
6306
6311
|
|
|
6307
6312
|
changeAudioInputDevice(id , session ) {
|
|
6308
6313
|
const currentId = this.getAudioDeviceId();
|
|
6309
|
-
logger.info('setting audio input device', { id, currentId, session: !!session });
|
|
6314
|
+
logger$3.info('setting audio input device', { id, currentId, session: !!session });
|
|
6310
6315
|
|
|
6311
6316
|
if (id === currentId) {
|
|
6312
6317
|
return null;
|
|
@@ -6352,7 +6357,7 @@ class WebRTCClient extends Emitter {
|
|
|
6352
6357
|
|
|
6353
6358
|
setVideoInputDevice(id ) {
|
|
6354
6359
|
const currentId = this.getVideoDeviceId();
|
|
6355
|
-
logger.info('setting video input device', { id, currentId });
|
|
6360
|
+
logger$3.info('setting video input device', { id, currentId });
|
|
6356
6361
|
|
|
6357
6362
|
if (id === currentId) {
|
|
6358
6363
|
return null;
|
|
@@ -6377,7 +6382,7 @@ class WebRTCClient extends Emitter {
|
|
|
6377
6382
|
const sessionId = this.getSipSessionId(session);
|
|
6378
6383
|
const localStream = this.getLocalStream(sessionId);
|
|
6379
6384
|
|
|
6380
|
-
logger.info('changing video input device', { id, sessionId });
|
|
6385
|
+
logger$3.info('changing video input device', { id, sessionId });
|
|
6381
6386
|
|
|
6382
6387
|
// Release old video stream
|
|
6383
6388
|
if (localStream) {
|
|
@@ -6445,7 +6450,7 @@ class WebRTCClient extends Emitter {
|
|
|
6445
6450
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
6446
6451
|
const desktop = newConstraints && newConstraints.desktop;
|
|
6447
6452
|
|
|
6448
|
-
logger.info('Sending reinvite', {
|
|
6453
|
+
logger$3.info('Sending reinvite', {
|
|
6449
6454
|
id: this.getSipSessionId(sipSession),
|
|
6450
6455
|
newConstraints,
|
|
6451
6456
|
conference,
|
|
@@ -6483,7 +6488,7 @@ class WebRTCClient extends Emitter {
|
|
|
6483
6488
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
6484
6489
|
}
|
|
6485
6490
|
|
|
6486
|
-
logger.info('on re-INVITE accepted', {
|
|
6491
|
+
logger$3.info('on re-INVITE accepted', {
|
|
6487
6492
|
id: this.getSipSessionId(sipSession),
|
|
6488
6493
|
wasMuted,
|
|
6489
6494
|
shouldDoScreenSharing,
|
|
@@ -6658,7 +6663,7 @@ class WebRTCClient extends Emitter {
|
|
|
6658
6663
|
}
|
|
6659
6664
|
|
|
6660
6665
|
startHeartbeat() {
|
|
6661
|
-
logger.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6666
|
+
logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6662
6667
|
if (!this.userAgent) {
|
|
6663
6668
|
this.heartbeat.stop();
|
|
6664
6669
|
return;
|
|
@@ -6671,7 +6676,7 @@ class WebRTCClient extends Emitter {
|
|
|
6671
6676
|
}
|
|
6672
6677
|
|
|
6673
6678
|
stopHeartbeat() {
|
|
6674
|
-
logger.info('sdk webrtc stop heartbeat');
|
|
6679
|
+
logger$3.info('sdk webrtc stop heartbeat');
|
|
6675
6680
|
this.heartbeat.stop();
|
|
6676
6681
|
}
|
|
6677
6682
|
|
|
@@ -6692,7 +6697,7 @@ class WebRTCClient extends Emitter {
|
|
|
6692
6697
|
}
|
|
6693
6698
|
|
|
6694
6699
|
attemptReconnection() {
|
|
6695
|
-
logger.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6700
|
+
logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6696
6701
|
if (!this.userAgent) {
|
|
6697
6702
|
return;
|
|
6698
6703
|
}
|
|
@@ -6717,7 +6722,7 @@ class WebRTCClient extends Emitter {
|
|
|
6717
6722
|
return;
|
|
6718
6723
|
}
|
|
6719
6724
|
|
|
6720
|
-
logger.info('setting local media stream', {
|
|
6725
|
+
logger$3.info('setting local media stream', {
|
|
6721
6726
|
sipSessionId,
|
|
6722
6727
|
tracks: newStream ? newStream.getTracks() : null,
|
|
6723
6728
|
});
|
|
@@ -6734,7 +6739,7 @@ class WebRTCClient extends Emitter {
|
|
|
6734
6739
|
|
|
6735
6740
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
6736
6741
|
|
|
6737
|
-
logger.info('updating local stream', {
|
|
6742
|
+
logger$3.info('updating local stream', {
|
|
6738
6743
|
sipSessionId,
|
|
6739
6744
|
oldStream: !!oldStream,
|
|
6740
6745
|
tracks: newStream.getTracks(),
|
|
@@ -6754,7 +6759,7 @@ class WebRTCClient extends Emitter {
|
|
|
6754
6759
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
6755
6760
|
const pc = this.getPeerConnection(sessionId);
|
|
6756
6761
|
|
|
6757
|
-
logger.info('Updating remote stream', {
|
|
6762
|
+
logger$3.info('Updating remote stream', {
|
|
6758
6763
|
sessionId,
|
|
6759
6764
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
6760
6765
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -6780,7 +6785,7 @@ class WebRTCClient extends Emitter {
|
|
|
6780
6785
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
6781
6786
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
6782
6787
|
|
|
6783
|
-
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6788
|
+
logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6784
6789
|
|
|
6785
6790
|
return {
|
|
6786
6791
|
constraints: {
|
|
@@ -6829,7 +6834,7 @@ class WebRTCClient extends Emitter {
|
|
|
6829
6834
|
}
|
|
6830
6835
|
|
|
6831
6836
|
_onTransportError() {
|
|
6832
|
-
logger.error('on transport error');
|
|
6837
|
+
logger$3.error('on transport error');
|
|
6833
6838
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
6834
6839
|
this.attemptReconnection();
|
|
6835
6840
|
}
|
|
@@ -6838,7 +6843,7 @@ class WebRTCClient extends Emitter {
|
|
|
6838
6843
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
6839
6844
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
6840
6845
|
if (this.hasHeartbeat()) {
|
|
6841
|
-
logger.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6846
|
+
logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6842
6847
|
|
|
6843
6848
|
this.heartbeat.onHeartbeat();
|
|
6844
6849
|
if (this.heartbeatCb) {
|
|
@@ -6849,7 +6854,7 @@ class WebRTCClient extends Emitter {
|
|
|
6849
6854
|
}
|
|
6850
6855
|
|
|
6851
6856
|
async _onHeartbeatTimeout() {
|
|
6852
|
-
logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6857
|
+
logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6853
6858
|
|
|
6854
6859
|
if (this.heartbeatTimeoutCb) {
|
|
6855
6860
|
this.heartbeatTimeoutCb();
|
|
@@ -6861,7 +6866,7 @@ class WebRTCClient extends Emitter {
|
|
|
6861
6866
|
try {
|
|
6862
6867
|
await this.userAgent.transport.disconnect();
|
|
6863
6868
|
} catch (e) {
|
|
6864
|
-
logger.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6869
|
+
logger$3.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6865
6870
|
}
|
|
6866
6871
|
}
|
|
6867
6872
|
|
|
@@ -6894,31 +6899,31 @@ class WebRTCClient extends Emitter {
|
|
|
6894
6899
|
}
|
|
6895
6900
|
|
|
6896
6901
|
_connectIfNeeded() {
|
|
6897
|
-
logger.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6902
|
+
logger$3.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6898
6903
|
if (!this.userAgent) {
|
|
6899
|
-
logger.info('need to recreate User Agent');
|
|
6904
|
+
logger$3.info('need to recreate User Agent');
|
|
6900
6905
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6901
6906
|
}
|
|
6902
6907
|
|
|
6903
6908
|
if (this.isConnected()) {
|
|
6904
|
-
logger.info('webrtc sdk, already connected');
|
|
6909
|
+
logger$3.info('webrtc sdk, already connected');
|
|
6905
6910
|
return Promise.resolve();
|
|
6906
6911
|
}
|
|
6907
6912
|
|
|
6908
6913
|
if (this.isConnecting()) {
|
|
6909
|
-
logger.info('webrtc sdk, already connecting...');
|
|
6914
|
+
logger$3.info('webrtc sdk, already connecting...');
|
|
6910
6915
|
|
|
6911
6916
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
6912
6917
|
return this.connectionPromise;
|
|
6913
6918
|
}
|
|
6914
6919
|
|
|
6915
6920
|
if (this.connectionPromise) {
|
|
6916
|
-
logger.info('webrtc sdk, connection promise connecting...');
|
|
6921
|
+
logger$3.info('webrtc sdk, connection promise connecting...');
|
|
6917
6922
|
// $FlowFixMe
|
|
6918
6923
|
return this.connectionPromise;
|
|
6919
6924
|
}
|
|
6920
6925
|
|
|
6921
|
-
logger.info('WebRTC UA needs to connect');
|
|
6926
|
+
logger$3.info('WebRTC UA needs to connect');
|
|
6922
6927
|
|
|
6923
6928
|
// Force UA to reconnect
|
|
6924
6929
|
if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
|
|
@@ -7043,7 +7048,7 @@ class WebRTCClient extends Emitter {
|
|
|
7043
7048
|
|
|
7044
7049
|
sdh.peerConnectionDelegate = {
|
|
7045
7050
|
onicecandidateerror: (error ) => {
|
|
7046
|
-
logger.error('on icecandidate error', {
|
|
7051
|
+
logger$3.error('on icecandidate error', {
|
|
7047
7052
|
address: error.address,
|
|
7048
7053
|
port: error.port,
|
|
7049
7054
|
errorCode: error.errorCode,
|
|
@@ -7072,7 +7077,7 @@ class WebRTCClient extends Emitter {
|
|
|
7072
7077
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
7073
7078
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
7074
7079
|
}
|
|
7075
|
-
logger.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7080
|
+
logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7076
7081
|
|
|
7077
7082
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
7078
7083
|
|
|
@@ -7093,7 +7098,7 @@ class WebRTCClient extends Emitter {
|
|
|
7093
7098
|
}
|
|
7094
7099
|
|
|
7095
7100
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
7096
|
-
logger.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7101
|
+
logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7097
7102
|
|
|
7098
7103
|
this.storeSipSession(session);
|
|
7099
7104
|
|
|
@@ -7105,7 +7110,7 @@ class WebRTCClient extends Emitter {
|
|
|
7105
7110
|
const onTrack = (event ) => {
|
|
7106
7111
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7107
7112
|
const { kind, label, readyState, id, muted } = event.track;
|
|
7108
|
-
logger.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7113
|
+
logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7109
7114
|
|
|
7110
7115
|
// Stop video track in audio only mode
|
|
7111
7116
|
if (isAudioOnly && kind === 'video') {
|
|
@@ -7122,7 +7127,7 @@ class WebRTCClient extends Emitter {
|
|
|
7122
7127
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7123
7128
|
|
|
7124
7129
|
pc.oniceconnectionstatechange = () => {
|
|
7125
|
-
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7130
|
+
logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7126
7131
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7127
7132
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7128
7133
|
}
|
|
@@ -7295,10 +7300,10 @@ class WebRTCClient extends Emitter {
|
|
|
7295
7300
|
|
|
7296
7301
|
_stopSendingStats(session ) {
|
|
7297
7302
|
const sessionId = this.getSipSessionId(session);
|
|
7298
|
-
logger.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7303
|
+
logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7299
7304
|
|
|
7300
7305
|
if (sessionId in this.statsIntervals) {
|
|
7301
|
-
logger.trace('Stop sending stats for call', { sessionId });
|
|
7306
|
+
logger$3.trace('Stop sending stats for call', { sessionId });
|
|
7302
7307
|
this.statsIntervals[sessionId]();
|
|
7303
7308
|
delete this.statsIntervals[sessionId];
|
|
7304
7309
|
}
|
|
@@ -7314,7 +7319,7 @@ class WebRTCClient extends Emitter {
|
|
|
7314
7319
|
try {
|
|
7315
7320
|
await this.userAgent.transport.disconnect();
|
|
7316
7321
|
} catch (e) {
|
|
7317
|
-
logger.error('WebRTC transport disconnect, error', e);
|
|
7322
|
+
logger$3.error('WebRTC transport disconnect, error', e);
|
|
7318
7323
|
}
|
|
7319
7324
|
}
|
|
7320
7325
|
}
|