@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
|
@@ -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
|
|
@@ -5476,13 +5481,13 @@ class WebRTCClient extends Emitter {
|
|
|
5476
5481
|
|
|
5477
5482
|
createUserAgent(configOverrides ) {
|
|
5478
5483
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
5479
|
-
logger.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5484
|
+
logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
5480
5485
|
|
|
5481
5486
|
webRTCConfiguration.delegate = {
|
|
5482
5487
|
onConnect: this.onConnect.bind(this),
|
|
5483
5488
|
onDisconnect: this.onDisconnect.bind(this),
|
|
5484
5489
|
onInvite: (invitation ) => {
|
|
5485
|
-
logger.info('sdk webrtc on invite', {
|
|
5490
|
+
logger$3.info('sdk webrtc on invite', {
|
|
5486
5491
|
method: 'delegate.onInvite',
|
|
5487
5492
|
id: invitation.id,
|
|
5488
5493
|
remoteURI: invitation.remoteURI,
|
|
@@ -5525,7 +5530,7 @@ class WebRTCClient extends Emitter {
|
|
|
5525
5530
|
}
|
|
5526
5531
|
|
|
5527
5532
|
onConnect() {
|
|
5528
|
-
logger.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5533
|
+
logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
5529
5534
|
this.eventEmitter.emit(CONNECTED);
|
|
5530
5535
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
5531
5536
|
this.registerer.waitingToggle(false);
|
|
@@ -5534,7 +5539,7 @@ class WebRTCClient extends Emitter {
|
|
|
5534
5539
|
}
|
|
5535
5540
|
|
|
5536
5541
|
async onDisconnect(error ) {
|
|
5537
|
-
logger.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5542
|
+
logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
5538
5543
|
this.connectionPromise = null;
|
|
5539
5544
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
5540
5545
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -5559,37 +5564,37 @@ class WebRTCClient extends Emitter {
|
|
|
5559
5564
|
};
|
|
5560
5565
|
|
|
5561
5566
|
if (this.skipRegister) {
|
|
5562
|
-
logger.info('sdk webrtc skip register...', logInfo);
|
|
5567
|
+
logger$3.info('sdk webrtc skip register...', logInfo);
|
|
5563
5568
|
return Promise.resolve();
|
|
5564
5569
|
}
|
|
5565
5570
|
|
|
5566
|
-
logger.info('sdk webrtc registering...', logInfo);
|
|
5571
|
+
logger$3.info('sdk webrtc registering...', logInfo);
|
|
5567
5572
|
|
|
5568
5573
|
if (!this.userAgent) {
|
|
5569
|
-
logger.info('sdk webrtc recreating User Agent');
|
|
5574
|
+
logger$3.info('sdk webrtc recreating User Agent');
|
|
5570
5575
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5571
5576
|
}
|
|
5572
5577
|
if (!this.userAgent || this.isRegistered()) {
|
|
5573
|
-
logger.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5578
|
+
logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
5574
5579
|
return Promise.resolve();
|
|
5575
5580
|
}
|
|
5576
5581
|
|
|
5577
5582
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
5578
|
-
logger.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5583
|
+
logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
5579
5584
|
return Promise.resolve();
|
|
5580
5585
|
}
|
|
5581
5586
|
|
|
5582
5587
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5583
5588
|
|
|
5584
5589
|
const onRegisterFailed = () => {
|
|
5585
|
-
logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5590
|
+
logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
5586
5591
|
this.connectionPromise = null;
|
|
5587
5592
|
if (this.registerer && this.registerer.waiting) {
|
|
5588
5593
|
this.registerer.waitingToggle(false);
|
|
5589
5594
|
}
|
|
5590
5595
|
|
|
5591
5596
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
5592
|
-
logger.info('sdk webrtc registering, retrying...', { tries });
|
|
5597
|
+
logger$3.info('sdk webrtc registering, retrying...', { tries });
|
|
5593
5598
|
setTimeout(() => this.register(tries + 1), 300);
|
|
5594
5599
|
}
|
|
5595
5600
|
};
|
|
@@ -5598,18 +5603,18 @@ class WebRTCClient extends Emitter {
|
|
|
5598
5603
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
5599
5604
|
// during the resolution of the primise.
|
|
5600
5605
|
if (!this.userAgent) {
|
|
5601
|
-
logger.info('sdk webrtc recreating User Agent after connection');
|
|
5606
|
+
logger$3.info('sdk webrtc recreating User Agent after connection');
|
|
5602
5607
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
5603
5608
|
}
|
|
5604
5609
|
|
|
5605
|
-
logger.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5610
|
+
logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
5606
5611
|
this.registerer = new Registerer(this.userAgent, registerOptions);
|
|
5607
5612
|
this.connectionPromise = null;
|
|
5608
5613
|
this._monkeyPatchRegisterer(this.registerer);
|
|
5609
5614
|
|
|
5610
5615
|
// Bind registerer events
|
|
5611
5616
|
this.registerer.stateChange.addListener(newState => {
|
|
5612
|
-
logger.info('sdk webrtc registering, state changed', { newState });
|
|
5617
|
+
logger$3.info('sdk webrtc registering, state changed', { newState });
|
|
5613
5618
|
|
|
5614
5619
|
if (newState === RegistererState.Registered && this.registerer
|
|
5615
5620
|
&& this.registerer.state === RegistererState.Registered) {
|
|
@@ -5622,7 +5627,7 @@ class WebRTCClient extends Emitter {
|
|
|
5622
5627
|
const options = {
|
|
5623
5628
|
requestDelegate: {
|
|
5624
5629
|
onReject: response => {
|
|
5625
|
-
logger.error('sdk webrtc registering, rejected', { response });
|
|
5630
|
+
logger$3.error('sdk webrtc registering, rejected', { response });
|
|
5626
5631
|
|
|
5627
5632
|
onRegisterFailed();
|
|
5628
5633
|
},
|
|
@@ -5630,13 +5635,13 @@ class WebRTCClient extends Emitter {
|
|
|
5630
5635
|
};
|
|
5631
5636
|
|
|
5632
5637
|
return this.registerer.register(options).catch((e) => {
|
|
5633
|
-
logger.error('sdk webrtc registering, error', e);
|
|
5638
|
+
logger$3.error('sdk webrtc registering, error', e);
|
|
5634
5639
|
|
|
5635
5640
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
5636
5641
|
return e;
|
|
5637
5642
|
});
|
|
5638
5643
|
}).catch(error => {
|
|
5639
|
-
logger.error('sdk webrtc registering, transport error', error);
|
|
5644
|
+
logger$3.error('sdk webrtc registering, transport error', error);
|
|
5640
5645
|
onRegisterFailed();
|
|
5641
5646
|
});
|
|
5642
5647
|
}
|
|
@@ -5665,21 +5670,21 @@ class WebRTCClient extends Emitter {
|
|
|
5665
5670
|
}
|
|
5666
5671
|
|
|
5667
5672
|
unregister() {
|
|
5668
|
-
logger.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5673
|
+
logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
5669
5674
|
if (!this.registerer) {
|
|
5670
5675
|
return Promise.resolve();
|
|
5671
5676
|
}
|
|
5672
5677
|
|
|
5673
5678
|
try {
|
|
5674
5679
|
return this.registerer.unregister().then(() => {
|
|
5675
|
-
logger.info('sdk webrtc unregistered');
|
|
5680
|
+
logger$3.info('sdk webrtc unregistered');
|
|
5676
5681
|
this._cleanupRegister();
|
|
5677
5682
|
}).catch(e => {
|
|
5678
|
-
logger.error('sdk webrtc unregistering, promise error', e);
|
|
5683
|
+
logger$3.error('sdk webrtc unregistering, promise error', e);
|
|
5679
5684
|
this._cleanupRegister();
|
|
5680
5685
|
});
|
|
5681
5686
|
} catch (e) {
|
|
5682
|
-
logger.error('sdk webrtc unregistering, error', e);
|
|
5687
|
+
logger$3.error('sdk webrtc unregistering, error', e);
|
|
5683
5688
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
5684
5689
|
// error when the registerer is in a bad state
|
|
5685
5690
|
this._cleanupRegister();
|
|
@@ -5687,7 +5692,7 @@ class WebRTCClient extends Emitter {
|
|
|
5687
5692
|
}
|
|
5688
5693
|
|
|
5689
5694
|
stop() {
|
|
5690
|
-
logger.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5695
|
+
logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
5691
5696
|
if (!this.userAgent) {
|
|
5692
5697
|
return Promise.resolve();
|
|
5693
5698
|
}
|
|
@@ -5695,12 +5700,12 @@ class WebRTCClient extends Emitter {
|
|
|
5695
5700
|
return this.userAgent.stop().then(() => {
|
|
5696
5701
|
return this._cleanupRegister();
|
|
5697
5702
|
}).catch(e => {
|
|
5698
|
-
logger.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5703
|
+
logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
5699
5704
|
});
|
|
5700
5705
|
}
|
|
5701
5706
|
|
|
5702
5707
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
5703
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5708
|
+
logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5704
5709
|
const inviterOptions = {
|
|
5705
5710
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
5706
5711
|
conference,
|
|
@@ -5731,7 +5736,7 @@ class WebRTCClient extends Emitter {
|
|
|
5731
5736
|
this._onAccepted(session, response.session, true);
|
|
5732
5737
|
},
|
|
5733
5738
|
onReject: (response ) => {
|
|
5734
|
-
logger.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5739
|
+
logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
5735
5740
|
this._stopSendingStats(session);
|
|
5736
5741
|
this.stopNetworkMonitoring(session);
|
|
5737
5742
|
|
|
@@ -5754,11 +5759,11 @@ class WebRTCClient extends Emitter {
|
|
|
5754
5759
|
}
|
|
5755
5760
|
|
|
5756
5761
|
answer(session , enableVideo ) {
|
|
5757
|
-
logger.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5762
|
+
logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
5758
5763
|
|
|
5759
5764
|
if (!session || !session.accept) {
|
|
5760
5765
|
const error = 'No session to answer, or not an invitation';
|
|
5761
|
-
logger.warn(error);
|
|
5766
|
+
logger$3.warn(error);
|
|
5762
5767
|
return Promise.reject(new Error(error));
|
|
5763
5768
|
}
|
|
5764
5769
|
const options = {
|
|
@@ -5768,15 +5773,15 @@ class WebRTCClient extends Emitter {
|
|
|
5768
5773
|
return session.accept(options).then(() => {
|
|
5769
5774
|
if (session.isCanceled) {
|
|
5770
5775
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
5771
|
-
logger.error(message, { id: session.id });
|
|
5776
|
+
logger$3.error(message, { id: session.id });
|
|
5772
5777
|
this.onCallEnded(session);
|
|
5773
5778
|
|
|
5774
5779
|
throw new CanceledCallError(message);
|
|
5775
5780
|
}
|
|
5776
|
-
logger.info('sdk webrtc answer, accepted.');
|
|
5781
|
+
logger$3.info('sdk webrtc answer, accepted.');
|
|
5777
5782
|
this._onAccepted(session);
|
|
5778
5783
|
}).catch(e => {
|
|
5779
|
-
logger.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5784
|
+
logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
5780
5785
|
|
|
5781
5786
|
throw e;
|
|
5782
5787
|
});
|
|
@@ -5784,7 +5789,7 @@ class WebRTCClient extends Emitter {
|
|
|
5784
5789
|
|
|
5785
5790
|
hangup(session ) {
|
|
5786
5791
|
const { state, id } = session;
|
|
5787
|
-
logger.info('sdk webrtc hangup call', { id, state });
|
|
5792
|
+
logger$3.info('sdk webrtc hangup call', { id, state });
|
|
5788
5793
|
|
|
5789
5794
|
try {
|
|
5790
5795
|
this._stopSendingStats(session);
|
|
@@ -5813,7 +5818,7 @@ class WebRTCClient extends Emitter {
|
|
|
5813
5818
|
|
|
5814
5819
|
return bye();
|
|
5815
5820
|
} catch (error) {
|
|
5816
|
-
logger.warn('sdk webrtc hangup, error', error);
|
|
5821
|
+
logger$3.warn('sdk webrtc hangup, error', error);
|
|
5817
5822
|
}
|
|
5818
5823
|
|
|
5819
5824
|
return null;
|
|
@@ -5831,7 +5836,7 @@ class WebRTCClient extends Emitter {
|
|
|
5831
5836
|
// Fetch and emit an event at `interval` with session network stats
|
|
5832
5837
|
startNetworkMonitoring(session , interval = 1000) {
|
|
5833
5838
|
const sessionId = this.getSipSessionId(session);
|
|
5834
|
-
logger.info('starting network inspection', { id: sessionId });
|
|
5839
|
+
logger$3.info('starting network inspection', { id: sessionId });
|
|
5835
5840
|
|
|
5836
5841
|
this.sessionNetworkStats[sessionId] = [];
|
|
5837
5842
|
|
|
@@ -5841,7 +5846,7 @@ class WebRTCClient extends Emitter {
|
|
|
5841
5846
|
stopNetworkMonitoring(session ) {
|
|
5842
5847
|
const sessionId = this.getSipSessionId(session);
|
|
5843
5848
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
5844
|
-
logger.info('stopping network inspection', { id: sessionId, exists });
|
|
5849
|
+
logger$3.info('stopping network inspection', { id: sessionId, exists });
|
|
5845
5850
|
|
|
5846
5851
|
if (exists) {
|
|
5847
5852
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -5851,17 +5856,17 @@ class WebRTCClient extends Emitter {
|
|
|
5851
5856
|
}
|
|
5852
5857
|
|
|
5853
5858
|
reject(session ) {
|
|
5854
|
-
logger.info('sdk webrtc reject call', { id: session.id });
|
|
5859
|
+
logger$3.info('sdk webrtc reject call', { id: session.id });
|
|
5855
5860
|
|
|
5856
5861
|
try {
|
|
5857
5862
|
return session.reject ? session.reject() : session.cancel();
|
|
5858
5863
|
} catch (e) {
|
|
5859
|
-
logger.warn('Error when rejecting call', e.message, e.stack);
|
|
5864
|
+
logger$3.warn('Error when rejecting call', e.message, e.stack);
|
|
5860
5865
|
}
|
|
5861
5866
|
}
|
|
5862
5867
|
|
|
5863
5868
|
async close() {
|
|
5864
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5869
|
+
logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5865
5870
|
this._cleanupMedia();
|
|
5866
5871
|
this.connectionPromise = null;
|
|
5867
5872
|
|
|
@@ -5892,7 +5897,7 @@ class WebRTCClient extends Emitter {
|
|
|
5892
5897
|
// eg: "INVITE not rejectable in state Completed"
|
|
5893
5898
|
}
|
|
5894
5899
|
this.userAgent = null;
|
|
5895
|
-
logger.info('sdk webrtc client closed');
|
|
5900
|
+
logger$3.info('sdk webrtc client closed');
|
|
5896
5901
|
}
|
|
5897
5902
|
|
|
5898
5903
|
getNumber(session ) {
|
|
@@ -5905,13 +5910,13 @@ class WebRTCClient extends Emitter {
|
|
|
5905
5910
|
}
|
|
5906
5911
|
|
|
5907
5912
|
mute(session ) {
|
|
5908
|
-
logger.info('sdk webrtc mute', { id: session.id });
|
|
5913
|
+
logger$3.info('sdk webrtc mute', { id: session.id });
|
|
5909
5914
|
|
|
5910
5915
|
this._toggleAudio(session, true);
|
|
5911
5916
|
}
|
|
5912
5917
|
|
|
5913
5918
|
unmute(session ) {
|
|
5914
|
-
logger.info('sdk webrtc unmute', { id: session.id });
|
|
5919
|
+
logger$3.info('sdk webrtc unmute', { id: session.id });
|
|
5915
5920
|
|
|
5916
5921
|
this._toggleAudio(session, false);
|
|
5917
5922
|
}
|
|
@@ -5951,13 +5956,13 @@ class WebRTCClient extends Emitter {
|
|
|
5951
5956
|
}
|
|
5952
5957
|
|
|
5953
5958
|
toggleCameraOn(session ) {
|
|
5954
|
-
logger.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5959
|
+
logger$3.info('sdk webrtc toggle camera on', { id: session.id });
|
|
5955
5960
|
|
|
5956
5961
|
this._toggleVideo(session, false);
|
|
5957
5962
|
}
|
|
5958
5963
|
|
|
5959
5964
|
toggleCameraOff(session ) {
|
|
5960
|
-
logger.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5965
|
+
logger$3.info('sdk webrtc toggle camera off', { id: session.id });
|
|
5961
5966
|
|
|
5962
5967
|
this._toggleVideo(session, true);
|
|
5963
5968
|
}
|
|
@@ -5966,7 +5971,7 @@ class WebRTCClient extends Emitter {
|
|
|
5966
5971
|
const sessionId = this.getSipSessionId(session);
|
|
5967
5972
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
5968
5973
|
|
|
5969
|
-
logger.info('sdk webrtc hold', {
|
|
5974
|
+
logger$3.info('sdk webrtc hold', {
|
|
5970
5975
|
sessionId,
|
|
5971
5976
|
keys: Object.keys(this.heldSessions),
|
|
5972
5977
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6015,7 +6020,7 @@ class WebRTCClient extends Emitter {
|
|
|
6015
6020
|
const sessionId = this.getSipSessionId(session);
|
|
6016
6021
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
6017
6022
|
|
|
6018
|
-
logger.info('sdk webrtc unhold', {
|
|
6023
|
+
logger$3.info('sdk webrtc unhold', {
|
|
6019
6024
|
sessionId,
|
|
6020
6025
|
keys: Object.keys(this.heldSessions),
|
|
6021
6026
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6163,7 +6168,7 @@ class WebRTCClient extends Emitter {
|
|
|
6163
6168
|
if (!session.sessionDescriptionHandler) {
|
|
6164
6169
|
return;
|
|
6165
6170
|
}
|
|
6166
|
-
logger.info('Sending DTMF', {
|
|
6171
|
+
logger$3.info('Sending DTMF', {
|
|
6167
6172
|
id: this.getSipSessionId(session),
|
|
6168
6173
|
tone,
|
|
6169
6174
|
});
|
|
@@ -6179,7 +6184,7 @@ class WebRTCClient extends Emitter {
|
|
|
6179
6184
|
transfer(session , target ) {
|
|
6180
6185
|
this.hold(session);
|
|
6181
6186
|
|
|
6182
|
-
logger.info('Transfering a session', {
|
|
6187
|
+
logger$3.info('Transfering a session', {
|
|
6183
6188
|
id: this.getSipSessionId(session),
|
|
6184
6189
|
target,
|
|
6185
6190
|
});
|
|
@@ -6201,17 +6206,17 @@ class WebRTCClient extends Emitter {
|
|
|
6201
6206
|
atxfer(session ) {
|
|
6202
6207
|
this.hold(session);
|
|
6203
6208
|
|
|
6204
|
-
logger.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6209
|
+
logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6205
6210
|
|
|
6206
6211
|
const result = {
|
|
6207
6212
|
newSession: null,
|
|
6208
6213
|
init: async (target ) => {
|
|
6209
|
-
logger.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6214
|
+
logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6210
6215
|
|
|
6211
6216
|
result.newSession = await this.call(target);
|
|
6212
6217
|
},
|
|
6213
6218
|
complete: () => {
|
|
6214
|
-
logger.info('webrtc transfer completed', {
|
|
6219
|
+
logger$3.info('webrtc transfer completed', {
|
|
6215
6220
|
id: this.getSipSessionId(session),
|
|
6216
6221
|
referId: this.getSipSessionId(result.newSession),
|
|
6217
6222
|
});
|
|
@@ -6232,7 +6237,7 @@ class WebRTCClient extends Emitter {
|
|
|
6232
6237
|
return;
|
|
6233
6238
|
}
|
|
6234
6239
|
|
|
6235
|
-
logger.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6240
|
+
logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6236
6241
|
|
|
6237
6242
|
try {
|
|
6238
6243
|
sipSession.message({
|
|
@@ -6274,7 +6279,7 @@ class WebRTCClient extends Emitter {
|
|
|
6274
6279
|
}
|
|
6275
6280
|
|
|
6276
6281
|
changeAudioOutputVolume(volume ) {
|
|
6277
|
-
logger.info('Changing audio output volume', { volume });
|
|
6282
|
+
logger$3.info('Changing audio output volume', { volume });
|
|
6278
6283
|
|
|
6279
6284
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6280
6285
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -6286,7 +6291,7 @@ class WebRTCClient extends Emitter {
|
|
|
6286
6291
|
}
|
|
6287
6292
|
|
|
6288
6293
|
changeAudioOutputDevice(id ) {
|
|
6289
|
-
logger.info('Changing audio output device', { id });
|
|
6294
|
+
logger$3.info('Changing audio output device', { id });
|
|
6290
6295
|
|
|
6291
6296
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6292
6297
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -6303,7 +6308,7 @@ class WebRTCClient extends Emitter {
|
|
|
6303
6308
|
|
|
6304
6309
|
changeAudioInputDevice(id , session ) {
|
|
6305
6310
|
const currentId = this.getAudioDeviceId();
|
|
6306
|
-
logger.info('setting audio input device', { id, currentId, session: !!session });
|
|
6311
|
+
logger$3.info('setting audio input device', { id, currentId, session: !!session });
|
|
6307
6312
|
|
|
6308
6313
|
if (id === currentId) {
|
|
6309
6314
|
return null;
|
|
@@ -6349,7 +6354,7 @@ class WebRTCClient extends Emitter {
|
|
|
6349
6354
|
|
|
6350
6355
|
setVideoInputDevice(id ) {
|
|
6351
6356
|
const currentId = this.getVideoDeviceId();
|
|
6352
|
-
logger.info('setting video input device', { id, currentId });
|
|
6357
|
+
logger$3.info('setting video input device', { id, currentId });
|
|
6353
6358
|
|
|
6354
6359
|
if (id === currentId) {
|
|
6355
6360
|
return null;
|
|
@@ -6374,7 +6379,7 @@ class WebRTCClient extends Emitter {
|
|
|
6374
6379
|
const sessionId = this.getSipSessionId(session);
|
|
6375
6380
|
const localStream = this.getLocalStream(sessionId);
|
|
6376
6381
|
|
|
6377
|
-
logger.info('changing video input device', { id, sessionId });
|
|
6382
|
+
logger$3.info('changing video input device', { id, sessionId });
|
|
6378
6383
|
|
|
6379
6384
|
// Release old video stream
|
|
6380
6385
|
if (localStream) {
|
|
@@ -6442,7 +6447,7 @@ class WebRTCClient extends Emitter {
|
|
|
6442
6447
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
6443
6448
|
const desktop = newConstraints && newConstraints.desktop;
|
|
6444
6449
|
|
|
6445
|
-
logger.info('Sending reinvite', {
|
|
6450
|
+
logger$3.info('Sending reinvite', {
|
|
6446
6451
|
id: this.getSipSessionId(sipSession),
|
|
6447
6452
|
newConstraints,
|
|
6448
6453
|
conference,
|
|
@@ -6480,7 +6485,7 @@ class WebRTCClient extends Emitter {
|
|
|
6480
6485
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
6481
6486
|
}
|
|
6482
6487
|
|
|
6483
|
-
logger.info('on re-INVITE accepted', {
|
|
6488
|
+
logger$3.info('on re-INVITE accepted', {
|
|
6484
6489
|
id: this.getSipSessionId(sipSession),
|
|
6485
6490
|
wasMuted,
|
|
6486
6491
|
shouldDoScreenSharing,
|
|
@@ -6655,7 +6660,7 @@ class WebRTCClient extends Emitter {
|
|
|
6655
6660
|
}
|
|
6656
6661
|
|
|
6657
6662
|
startHeartbeat() {
|
|
6658
|
-
logger.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6663
|
+
logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
6659
6664
|
if (!this.userAgent) {
|
|
6660
6665
|
this.heartbeat.stop();
|
|
6661
6666
|
return;
|
|
@@ -6668,7 +6673,7 @@ class WebRTCClient extends Emitter {
|
|
|
6668
6673
|
}
|
|
6669
6674
|
|
|
6670
6675
|
stopHeartbeat() {
|
|
6671
|
-
logger.info('sdk webrtc stop heartbeat');
|
|
6676
|
+
logger$3.info('sdk webrtc stop heartbeat');
|
|
6672
6677
|
this.heartbeat.stop();
|
|
6673
6678
|
}
|
|
6674
6679
|
|
|
@@ -6689,7 +6694,7 @@ class WebRTCClient extends Emitter {
|
|
|
6689
6694
|
}
|
|
6690
6695
|
|
|
6691
6696
|
attemptReconnection() {
|
|
6692
|
-
logger.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6697
|
+
logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
6693
6698
|
if (!this.userAgent) {
|
|
6694
6699
|
return;
|
|
6695
6700
|
}
|
|
@@ -6714,7 +6719,7 @@ class WebRTCClient extends Emitter {
|
|
|
6714
6719
|
return;
|
|
6715
6720
|
}
|
|
6716
6721
|
|
|
6717
|
-
logger.info('setting local media stream', {
|
|
6722
|
+
logger$3.info('setting local media stream', {
|
|
6718
6723
|
sipSessionId,
|
|
6719
6724
|
tracks: newStream ? newStream.getTracks() : null,
|
|
6720
6725
|
});
|
|
@@ -6731,7 +6736,7 @@ class WebRTCClient extends Emitter {
|
|
|
6731
6736
|
|
|
6732
6737
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
6733
6738
|
|
|
6734
|
-
logger.info('updating local stream', {
|
|
6739
|
+
logger$3.info('updating local stream', {
|
|
6735
6740
|
sipSessionId,
|
|
6736
6741
|
oldStream: !!oldStream,
|
|
6737
6742
|
tracks: newStream.getTracks(),
|
|
@@ -6751,7 +6756,7 @@ class WebRTCClient extends Emitter {
|
|
|
6751
6756
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
6752
6757
|
const pc = this.getPeerConnection(sessionId);
|
|
6753
6758
|
|
|
6754
|
-
logger.info('Updating remote stream', {
|
|
6759
|
+
logger$3.info('Updating remote stream', {
|
|
6755
6760
|
sessionId,
|
|
6756
6761
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
6757
6762
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -6777,7 +6782,7 @@ class WebRTCClient extends Emitter {
|
|
|
6777
6782
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
6778
6783
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
6779
6784
|
|
|
6780
|
-
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6785
|
+
logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6781
6786
|
|
|
6782
6787
|
return {
|
|
6783
6788
|
constraints: {
|
|
@@ -6826,7 +6831,7 @@ class WebRTCClient extends Emitter {
|
|
|
6826
6831
|
}
|
|
6827
6832
|
|
|
6828
6833
|
_onTransportError() {
|
|
6829
|
-
logger.error('on transport error');
|
|
6834
|
+
logger$3.error('on transport error');
|
|
6830
6835
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
6831
6836
|
this.attemptReconnection();
|
|
6832
6837
|
}
|
|
@@ -6835,7 +6840,7 @@ class WebRTCClient extends Emitter {
|
|
|
6835
6840
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
6836
6841
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
6837
6842
|
if (this.hasHeartbeat()) {
|
|
6838
|
-
logger.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6843
|
+
logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
6839
6844
|
|
|
6840
6845
|
this.heartbeat.onHeartbeat();
|
|
6841
6846
|
if (this.heartbeatCb) {
|
|
@@ -6846,7 +6851,7 @@ class WebRTCClient extends Emitter {
|
|
|
6846
6851
|
}
|
|
6847
6852
|
|
|
6848
6853
|
async _onHeartbeatTimeout() {
|
|
6849
|
-
logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6854
|
+
logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6850
6855
|
|
|
6851
6856
|
if (this.heartbeatTimeoutCb) {
|
|
6852
6857
|
this.heartbeatTimeoutCb();
|
|
@@ -6858,7 +6863,7 @@ class WebRTCClient extends Emitter {
|
|
|
6858
6863
|
try {
|
|
6859
6864
|
await this.userAgent.transport.disconnect();
|
|
6860
6865
|
} catch (e) {
|
|
6861
|
-
logger.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6866
|
+
logger$3.error('Transport disconnection after heartbeat timeout, error', e);
|
|
6862
6867
|
}
|
|
6863
6868
|
}
|
|
6864
6869
|
|
|
@@ -6891,31 +6896,31 @@ class WebRTCClient extends Emitter {
|
|
|
6891
6896
|
}
|
|
6892
6897
|
|
|
6893
6898
|
_connectIfNeeded() {
|
|
6894
|
-
logger.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6899
|
+
logger$3.info('connect if needed, checking', { connected: this.isConnected() });
|
|
6895
6900
|
if (!this.userAgent) {
|
|
6896
|
-
logger.info('need to recreate User Agent');
|
|
6901
|
+
logger$3.info('need to recreate User Agent');
|
|
6897
6902
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6898
6903
|
}
|
|
6899
6904
|
|
|
6900
6905
|
if (this.isConnected()) {
|
|
6901
|
-
logger.info('webrtc sdk, already connected');
|
|
6906
|
+
logger$3.info('webrtc sdk, already connected');
|
|
6902
6907
|
return Promise.resolve();
|
|
6903
6908
|
}
|
|
6904
6909
|
|
|
6905
6910
|
if (this.isConnecting()) {
|
|
6906
|
-
logger.info('webrtc sdk, already connecting...');
|
|
6911
|
+
logger$3.info('webrtc sdk, already connecting...');
|
|
6907
6912
|
|
|
6908
6913
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
6909
6914
|
return this.connectionPromise;
|
|
6910
6915
|
}
|
|
6911
6916
|
|
|
6912
6917
|
if (this.connectionPromise) {
|
|
6913
|
-
logger.info('webrtc sdk, connection promise connecting...');
|
|
6918
|
+
logger$3.info('webrtc sdk, connection promise connecting...');
|
|
6914
6919
|
// $FlowFixMe
|
|
6915
6920
|
return this.connectionPromise;
|
|
6916
6921
|
}
|
|
6917
6922
|
|
|
6918
|
-
logger.info('WebRTC UA needs to connect');
|
|
6923
|
+
logger$3.info('WebRTC UA needs to connect');
|
|
6919
6924
|
|
|
6920
6925
|
// Force UA to reconnect
|
|
6921
6926
|
if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
|
|
@@ -7040,7 +7045,7 @@ class WebRTCClient extends Emitter {
|
|
|
7040
7045
|
|
|
7041
7046
|
sdh.peerConnectionDelegate = {
|
|
7042
7047
|
onicecandidateerror: (error ) => {
|
|
7043
|
-
logger.error('on icecandidate error', {
|
|
7048
|
+
logger$3.error('on icecandidate error', {
|
|
7044
7049
|
address: error.address,
|
|
7045
7050
|
port: error.port,
|
|
7046
7051
|
errorCode: error.errorCode,
|
|
@@ -7069,7 +7074,7 @@ class WebRTCClient extends Emitter {
|
|
|
7069
7074
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
7070
7075
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
7071
7076
|
}
|
|
7072
|
-
logger.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7077
|
+
logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7073
7078
|
|
|
7074
7079
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
7075
7080
|
|
|
@@ -7090,7 +7095,7 @@ class WebRTCClient extends Emitter {
|
|
|
7090
7095
|
}
|
|
7091
7096
|
|
|
7092
7097
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
7093
|
-
logger.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7098
|
+
logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7094
7099
|
|
|
7095
7100
|
this.storeSipSession(session);
|
|
7096
7101
|
|
|
@@ -7102,7 +7107,7 @@ class WebRTCClient extends Emitter {
|
|
|
7102
7107
|
const onTrack = (event ) => {
|
|
7103
7108
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7104
7109
|
const { kind, label, readyState, id, muted } = event.track;
|
|
7105
|
-
logger.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7110
|
+
logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7106
7111
|
|
|
7107
7112
|
// Stop video track in audio only mode
|
|
7108
7113
|
if (isAudioOnly && kind === 'video') {
|
|
@@ -7119,7 +7124,7 @@ class WebRTCClient extends Emitter {
|
|
|
7119
7124
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7120
7125
|
|
|
7121
7126
|
pc.oniceconnectionstatechange = () => {
|
|
7122
|
-
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7127
|
+
logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7123
7128
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7124
7129
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7125
7130
|
}
|
|
@@ -7292,10 +7297,10 @@ class WebRTCClient extends Emitter {
|
|
|
7292
7297
|
|
|
7293
7298
|
_stopSendingStats(session ) {
|
|
7294
7299
|
const sessionId = this.getSipSessionId(session);
|
|
7295
|
-
logger.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7300
|
+
logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7296
7301
|
|
|
7297
7302
|
if (sessionId in this.statsIntervals) {
|
|
7298
|
-
logger.trace('Stop sending stats for call', { sessionId });
|
|
7303
|
+
logger$3.trace('Stop sending stats for call', { sessionId });
|
|
7299
7304
|
this.statsIntervals[sessionId]();
|
|
7300
7305
|
delete this.statsIntervals[sessionId];
|
|
7301
7306
|
}
|
|
@@ -7311,7 +7316,7 @@ class WebRTCClient extends Emitter {
|
|
|
7311
7316
|
try {
|
|
7312
7317
|
await this.userAgent.transport.disconnect();
|
|
7313
7318
|
} catch (e) {
|
|
7314
|
-
logger.error('WebRTC transport disconnect, error', e);
|
|
7319
|
+
logger$3.error('WebRTC transport disconnect, error', e);
|
|
7315
7320
|
}
|
|
7316
7321
|
}
|
|
7317
7322
|
}
|