@wazo/sdk 0.37.24 → 0.37.25
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 +12 -12
- package/esm/__tests__/web-rtc-client.test.js +120 -103
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- 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 +12 -12
- package/esm/checker/Checker.js +145 -128
- package/esm/checker/checks/aor.js +12 -12
- package/esm/checker/checks/api.js +12 -12
- package/esm/checker/checks/index.js +135 -118
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +120 -103
- package/esm/checker/checks/webrtc.js +120 -103
- package/esm/domain/AdHocAPIConference.js +12 -12
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +12 -12
- package/esm/domain/Phone/CTIPhone.js +26 -26
- package/esm/domain/Phone/WebRTCPhone.js +87 -86
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/index.js +356 -338
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +12 -12
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +12 -12
- package/esm/simple/Auth.js +346 -328
- package/esm/simple/Configuration.js +346 -328
- package/esm/simple/Directory.js +12 -12
- package/esm/simple/Phone.js +346 -328
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +350 -332
- package/esm/simple/room/LocalParticipant.js +350 -332
- package/esm/simple/room/Participant.js +350 -332
- package/esm/simple/room/RemoteParticipant.js +350 -332
- package/esm/simple/room/Room.js +351 -333
- package/esm/simple/room/SipRoom.js +350 -332
- package/esm/simple/room/Stream.js +350 -332
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +350 -332
- package/esm/simple/utils.js +350 -332
- package/esm/web-rtc-client.js +120 -103
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +12 -12
- package/lib/__tests__/web-rtc-client.test.js +120 -103
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- 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 +12 -12
- package/lib/checker/Checker.js +145 -128
- package/lib/checker/checks/aor.js +12 -12
- package/lib/checker/checks/api.js +12 -12
- package/lib/checker/checks/index.js +135 -118
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +120 -103
- package/lib/checker/checks/webrtc.js +120 -103
- package/lib/domain/AdHocAPIConference.js +12 -12
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +12 -12
- package/lib/domain/Phone/CTIPhone.js +26 -26
- package/lib/domain/Phone/WebRTCPhone.js +87 -86
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/index.js +356 -338
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +12 -12
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +12 -12
- package/lib/simple/Auth.js +346 -328
- package/lib/simple/Configuration.js +346 -328
- package/lib/simple/Directory.js +12 -12
- package/lib/simple/Phone.js +346 -328
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +350 -332
- package/lib/simple/room/LocalParticipant.js +350 -332
- package/lib/simple/room/Participant.js +350 -332
- package/lib/simple/room/RemoteParticipant.js +350 -332
- package/lib/simple/room/Room.js +351 -333
- package/lib/simple/room/SipRoom.js +350 -332
- package/lib/simple/room/Stream.js +350 -332
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +350 -332
- package/lib/simple/utils.js +350 -332
- package/lib/web-rtc-client.js +120 -103
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Phone/WebRTCPhone.js +3 -2
- package/src/web-rtc-client.js +27 -10
package/esm/simple/Auth.js
CHANGED
|
@@ -1947,7 +1947,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1947
1947
|
|
|
1948
1948
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1949
1949
|
|
|
1950
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1950
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1951
1951
|
|
|
1952
1952
|
// Use a function here to be able to mock it in tests
|
|
1953
1953
|
const realFetch = () => {
|
|
@@ -2086,7 +2086,7 @@ class ApiRequester {
|
|
|
2086
2086
|
};
|
|
2087
2087
|
|
|
2088
2088
|
if (this.refreshTokenPromise) {
|
|
2089
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2089
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
2090
2090
|
await this.refreshTokenPromise;
|
|
2091
2091
|
}
|
|
2092
2092
|
|
|
@@ -2106,7 +2106,7 @@ class ApiRequester {
|
|
|
2106
2106
|
return promise.then(async (err ) => {
|
|
2107
2107
|
// Check if the token is still valid
|
|
2108
2108
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2109
|
-
logger.warn('token expired', { error: err.reason });
|
|
2109
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
2110
2110
|
// Replay the call after refreshing the token
|
|
2111
2111
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2112
2112
|
}
|
|
@@ -2116,7 +2116,7 @@ class ApiRequester {
|
|
|
2116
2116
|
: exceptionClass.fromResponse(err, response.status);
|
|
2117
2117
|
|
|
2118
2118
|
if (this.shouldLogErrors) {
|
|
2119
|
-
logger.error('API error', error);
|
|
2119
|
+
logger$c.error('API error', error);
|
|
2120
2120
|
}
|
|
2121
2121
|
|
|
2122
2122
|
throw error;
|
|
@@ -2126,7 +2126,7 @@ class ApiRequester {
|
|
|
2126
2126
|
return newParse(response, isJson);
|
|
2127
2127
|
}).catch(error => {
|
|
2128
2128
|
if (this.shouldLogErrors) {
|
|
2129
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2129
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
throw error;
|
|
@@ -2154,13 +2154,13 @@ class ApiRequester {
|
|
|
2154
2154
|
) {
|
|
2155
2155
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2156
2156
|
let newPath = path;
|
|
2157
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2157
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2158
2158
|
|
|
2159
2159
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2160
2160
|
|
|
2161
2161
|
return this.refreshTokenPromise.then(() => {
|
|
2162
2162
|
this.refreshTokenPromise = null;
|
|
2163
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
2163
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
2164
2164
|
if (isTokenNotFound) {
|
|
2165
2165
|
const pathParts = path.split('/');
|
|
2166
2166
|
pathParts.pop();
|
|
@@ -4053,7 +4053,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4053
4053
|
|
|
4054
4054
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4055
4055
|
|
|
4056
|
-
const logger$
|
|
4056
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4057
4057
|
|
|
4058
4058
|
class CTIPhone extends Emitter {
|
|
4059
4059
|
|
|
@@ -4066,7 +4066,7 @@ class CTIPhone extends Emitter {
|
|
|
4066
4066
|
|
|
4067
4067
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4068
4068
|
super();
|
|
4069
|
-
logger$
|
|
4069
|
+
logger$b.info('CTI Phone created');
|
|
4070
4070
|
this.session = session;
|
|
4071
4071
|
this.isMobile = isMobile;
|
|
4072
4072
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4127,7 +4127,7 @@ class CTIPhone extends Emitter {
|
|
|
4127
4127
|
}
|
|
4128
4128
|
|
|
4129
4129
|
async makeCall(number , line ) {
|
|
4130
|
-
logger$
|
|
4130
|
+
logger$b.info('make CTI call', { number });
|
|
4131
4131
|
|
|
4132
4132
|
if (!number) {
|
|
4133
4133
|
return null;
|
|
@@ -4150,7 +4150,7 @@ class CTIPhone extends Emitter {
|
|
|
4150
4150
|
if (!callSession) {
|
|
4151
4151
|
return Promise.resolve(null);
|
|
4152
4152
|
}
|
|
4153
|
-
logger$
|
|
4153
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4154
4154
|
|
|
4155
4155
|
if (!this.currentCall) {
|
|
4156
4156
|
this.currentCall = callSession.call;
|
|
@@ -4163,7 +4163,7 @@ class CTIPhone extends Emitter {
|
|
|
4163
4163
|
if (!callSession) {
|
|
4164
4164
|
return;
|
|
4165
4165
|
}
|
|
4166
|
-
logger$
|
|
4166
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4167
4167
|
|
|
4168
4168
|
this.currentCall = undefined;
|
|
4169
4169
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
|
|
|
4173
4173
|
if (!callSession) {
|
|
4174
4174
|
return Promise.resolve(false);
|
|
4175
4175
|
}
|
|
4176
|
-
logger$
|
|
4176
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4177
4177
|
|
|
4178
4178
|
try {
|
|
4179
4179
|
await CallApi.cancelCall(callSession);
|
|
@@ -4184,7 +4184,7 @@ class CTIPhone extends Emitter {
|
|
|
4184
4184
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4185
4185
|
return true;
|
|
4186
4186
|
} catch (e) {
|
|
4187
|
-
logger$
|
|
4187
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4188
4188
|
|
|
4189
4189
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4190
4190
|
return false;
|
|
@@ -4197,7 +4197,7 @@ class CTIPhone extends Emitter {
|
|
|
4197
4197
|
if (!callSession) {
|
|
4198
4198
|
return;
|
|
4199
4199
|
}
|
|
4200
|
-
logger$
|
|
4200
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4201
4201
|
|
|
4202
4202
|
await CallApi.cancelCall(callSession);
|
|
4203
4203
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
|
|
|
4207
4207
|
if (!callSession) {
|
|
4208
4208
|
return;
|
|
4209
4209
|
}
|
|
4210
|
-
logger$
|
|
4210
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4211
4211
|
|
|
4212
4212
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4213
4213
|
}
|
|
@@ -4220,19 +4220,19 @@ class CTIPhone extends Emitter {
|
|
|
4220
4220
|
if (!callSession) {
|
|
4221
4221
|
return;
|
|
4222
4222
|
}
|
|
4223
|
-
logger$
|
|
4223
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4224
4224
|
|
|
4225
4225
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4226
4226
|
}
|
|
4227
4227
|
|
|
4228
4228
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4229
|
-
logger$
|
|
4229
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4230
4230
|
|
|
4231
4231
|
return CallApi.cancelCallTransfer(transferId);
|
|
4232
4232
|
}
|
|
4233
4233
|
|
|
4234
4234
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4235
|
-
logger$
|
|
4235
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4236
4236
|
|
|
4237
4237
|
return CallApi.confirmCallTransfer(transferId);
|
|
4238
4238
|
}
|
|
@@ -4241,19 +4241,19 @@ class CTIPhone extends Emitter {
|
|
|
4241
4241
|
if (!callSession) {
|
|
4242
4242
|
return;
|
|
4243
4243
|
}
|
|
4244
|
-
logger$
|
|
4244
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4245
4245
|
|
|
4246
4246
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4247
4247
|
}
|
|
4248
4248
|
|
|
4249
4249
|
onConnectionMade() {
|
|
4250
|
-
logger$
|
|
4250
|
+
logger$b.info('on CTI connection made');
|
|
4251
4251
|
|
|
4252
4252
|
this.eventEmitter.emit('onCallAccepted');
|
|
4253
4253
|
}
|
|
4254
4254
|
|
|
4255
4255
|
async close() {
|
|
4256
|
-
logger$
|
|
4256
|
+
logger$b.info('CTI close');
|
|
4257
4257
|
|
|
4258
4258
|
return Promise.resolve();
|
|
4259
4259
|
}
|
|
@@ -4262,7 +4262,7 @@ class CTIPhone extends Emitter {
|
|
|
4262
4262
|
if (!callSession) {
|
|
4263
4263
|
return;
|
|
4264
4264
|
}
|
|
4265
|
-
logger$
|
|
4265
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4266
4266
|
|
|
4267
4267
|
return CallApi.hold(callSession.callId);
|
|
4268
4268
|
}
|
|
@@ -4271,7 +4271,7 @@ class CTIPhone extends Emitter {
|
|
|
4271
4271
|
if (!callSession) {
|
|
4272
4272
|
return;
|
|
4273
4273
|
}
|
|
4274
|
-
logger$
|
|
4274
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4275
4275
|
|
|
4276
4276
|
return CallApi.resume(callSession.callId);
|
|
4277
4277
|
}
|
|
@@ -4280,7 +4280,7 @@ class CTIPhone extends Emitter {
|
|
|
4280
4280
|
if (!callSession) {
|
|
4281
4281
|
return;
|
|
4282
4282
|
}
|
|
4283
|
-
logger$
|
|
4283
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4284
4284
|
|
|
4285
4285
|
return CallApi.mute(callSession.callId);
|
|
4286
4286
|
}
|
|
@@ -4289,7 +4289,7 @@ class CTIPhone extends Emitter {
|
|
|
4289
4289
|
if (!callSession) {
|
|
4290
4290
|
return;
|
|
4291
4291
|
}
|
|
4292
|
-
logger$
|
|
4292
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4293
4293
|
|
|
4294
4294
|
return CallApi.unmute(callSession.callId);
|
|
4295
4295
|
}
|
|
@@ -5298,7 +5298,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5298
5298
|
const WEBHOOKD_VERSION = '1.0';
|
|
5299
5299
|
const AMID_VERSION = '1.0';
|
|
5300
5300
|
|
|
5301
|
-
const logger$
|
|
5301
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5302
5302
|
|
|
5303
5303
|
class ApiClient {
|
|
5304
5304
|
|
|
@@ -5350,12 +5350,12 @@ class ApiClient {
|
|
|
5350
5350
|
}
|
|
5351
5351
|
|
|
5352
5352
|
async forceRefreshToken() {
|
|
5353
|
-
logger$
|
|
5353
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5354
5354
|
return this.refreshTokenCallback();
|
|
5355
5355
|
}
|
|
5356
5356
|
|
|
5357
5357
|
async refreshTokenCallback() {
|
|
5358
|
-
logger$
|
|
5358
|
+
logger$a.info('refresh token callback called', {
|
|
5359
5359
|
refreshToken: this.refreshToken,
|
|
5360
5360
|
refreshBackend: this.refreshBackend,
|
|
5361
5361
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5373,7 +5373,7 @@ class ApiClient {
|
|
|
5373
5373
|
this.isMobile,
|
|
5374
5374
|
);
|
|
5375
5375
|
|
|
5376
|
-
logger$
|
|
5376
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5377
5377
|
|
|
5378
5378
|
if (this.onRefreshToken) {
|
|
5379
5379
|
this.onRefreshToken(session.token, session);
|
|
@@ -5686,7 +5686,7 @@ class AdHocAPIConference {
|
|
|
5686
5686
|
|
|
5687
5687
|
/* */
|
|
5688
5688
|
|
|
5689
|
-
const parseCandidate = (candidate ) => {
|
|
5689
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5690
5690
|
if (!candidate) {
|
|
5691
5691
|
return null;
|
|
5692
5692
|
}
|
|
@@ -5840,7 +5840,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5840
5840
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5841
5841
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5842
5842
|
if (event.candidate) {
|
|
5843
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5843
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5844
5844
|
}
|
|
5845
5845
|
};
|
|
5846
5846
|
|
|
@@ -6304,7 +6304,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6304
6304
|
const SEND_STATS_DELAY = 5000;
|
|
6305
6305
|
|
|
6306
6306
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6307
|
-
const logger$
|
|
6307
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6308
6308
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6309
6309
|
|
|
6310
6310
|
// events
|
|
@@ -6318,14 +6318,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6318
6318
|
const MESSAGE = 'message';
|
|
6319
6319
|
const ACCEPTED = 'accepted';
|
|
6320
6320
|
const REJECTED = 'rejected';
|
|
6321
|
-
const ON_TRACK = 'onTrack';
|
|
6322
|
-
const ON_REINVITE = 'reinvite';
|
|
6321
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6322
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6323
6323
|
const ON_ERROR = 'onError';
|
|
6324
6324
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6325
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6326
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6325
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6326
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6327
6327
|
|
|
6328
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6328
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6329
6329
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6330
6330
|
class CanceledCallError extends Error {}
|
|
6331
6331
|
|
|
@@ -6461,12 +6461,12 @@ class WebRTCClient extends Emitter {
|
|
|
6461
6461
|
this.MESSAGE = MESSAGE;
|
|
6462
6462
|
this.ACCEPTED = ACCEPTED;
|
|
6463
6463
|
this.REJECTED = REJECTED;
|
|
6464
|
-
this.ON_TRACK = ON_TRACK;
|
|
6465
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6464
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6465
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6466
6466
|
this.ON_ERROR = ON_ERROR;
|
|
6467
6467
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6468
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6469
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6468
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6469
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6470
6470
|
}
|
|
6471
6471
|
|
|
6472
6472
|
configureMedia(media ) {
|
|
@@ -6483,13 +6483,13 @@ class WebRTCClient extends Emitter {
|
|
|
6483
6483
|
|
|
6484
6484
|
createUserAgent(configOverrides ) {
|
|
6485
6485
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6486
|
-
logger$
|
|
6486
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6487
6487
|
|
|
6488
6488
|
webRTCConfiguration.delegate = {
|
|
6489
6489
|
onConnect: this.onConnect.bind(this),
|
|
6490
6490
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6491
6491
|
onInvite: (invitation ) => {
|
|
6492
|
-
logger$
|
|
6492
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6493
6493
|
method: 'delegate.onInvite',
|
|
6494
6494
|
id: invitation.id,
|
|
6495
6495
|
remoteURI: invitation.remoteURI,
|
|
@@ -6532,7 +6532,7 @@ class WebRTCClient extends Emitter {
|
|
|
6532
6532
|
}
|
|
6533
6533
|
|
|
6534
6534
|
onConnect() {
|
|
6535
|
-
logger$
|
|
6535
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6536
6536
|
this.eventEmitter.emit(CONNECTED);
|
|
6537
6537
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6538
6538
|
this.registerer.waitingToggle(false);
|
|
@@ -6541,7 +6541,7 @@ class WebRTCClient extends Emitter {
|
|
|
6541
6541
|
}
|
|
6542
6542
|
|
|
6543
6543
|
async onDisconnect(error ) {
|
|
6544
|
-
logger$
|
|
6544
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6545
6545
|
this.connectionPromise = null;
|
|
6546
6546
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6547
6547
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6566,37 +6566,37 @@ class WebRTCClient extends Emitter {
|
|
|
6566
6566
|
};
|
|
6567
6567
|
|
|
6568
6568
|
if (this.skipRegister) {
|
|
6569
|
-
logger$
|
|
6569
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6570
6570
|
return Promise.resolve();
|
|
6571
6571
|
}
|
|
6572
6572
|
|
|
6573
|
-
logger$
|
|
6573
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6574
6574
|
|
|
6575
6575
|
if (!this.userAgent) {
|
|
6576
|
-
logger$
|
|
6576
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6577
6577
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6578
6578
|
}
|
|
6579
6579
|
if (!this.userAgent || this.isRegistered()) {
|
|
6580
|
-
logger$
|
|
6580
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6581
6581
|
return Promise.resolve();
|
|
6582
6582
|
}
|
|
6583
6583
|
|
|
6584
6584
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6585
|
-
logger$
|
|
6585
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6586
6586
|
return Promise.resolve();
|
|
6587
6587
|
}
|
|
6588
6588
|
|
|
6589
6589
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6590
6590
|
|
|
6591
6591
|
const onRegisterFailed = () => {
|
|
6592
|
-
logger$
|
|
6592
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6593
6593
|
this.connectionPromise = null;
|
|
6594
6594
|
if (this.registerer && this.registerer.waiting) {
|
|
6595
6595
|
this.registerer.waitingToggle(false);
|
|
6596
6596
|
}
|
|
6597
6597
|
|
|
6598
6598
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6599
|
-
logger$
|
|
6599
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6600
6600
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6601
6601
|
}
|
|
6602
6602
|
};
|
|
@@ -6605,18 +6605,18 @@ class WebRTCClient extends Emitter {
|
|
|
6605
6605
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6606
6606
|
// during the resolution of the primise.
|
|
6607
6607
|
if (!this.userAgent) {
|
|
6608
|
-
logger$
|
|
6608
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6609
6609
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6610
6610
|
}
|
|
6611
6611
|
|
|
6612
|
-
logger$
|
|
6612
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6613
6613
|
this.registerer = new Registerer(this.userAgent, registerOptions);
|
|
6614
6614
|
this.connectionPromise = null;
|
|
6615
6615
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6616
6616
|
|
|
6617
6617
|
// Bind registerer events
|
|
6618
6618
|
this.registerer.stateChange.addListener(newState => {
|
|
6619
|
-
logger$
|
|
6619
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6620
6620
|
|
|
6621
6621
|
if (newState === RegistererState.Registered && this.registerer
|
|
6622
6622
|
&& this.registerer.state === RegistererState.Registered) {
|
|
@@ -6629,7 +6629,7 @@ class WebRTCClient extends Emitter {
|
|
|
6629
6629
|
const options = {
|
|
6630
6630
|
requestDelegate: {
|
|
6631
6631
|
onReject: response => {
|
|
6632
|
-
logger$
|
|
6632
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6633
6633
|
|
|
6634
6634
|
onRegisterFailed();
|
|
6635
6635
|
},
|
|
@@ -6637,13 +6637,13 @@ class WebRTCClient extends Emitter {
|
|
|
6637
6637
|
};
|
|
6638
6638
|
|
|
6639
6639
|
return this.registerer.register(options).catch((e) => {
|
|
6640
|
-
logger$
|
|
6640
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6641
6641
|
|
|
6642
6642
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6643
6643
|
return e;
|
|
6644
6644
|
});
|
|
6645
6645
|
}).catch(error => {
|
|
6646
|
-
logger$
|
|
6646
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6647
6647
|
onRegisterFailed();
|
|
6648
6648
|
});
|
|
6649
6649
|
}
|
|
@@ -6672,21 +6672,21 @@ class WebRTCClient extends Emitter {
|
|
|
6672
6672
|
}
|
|
6673
6673
|
|
|
6674
6674
|
unregister() {
|
|
6675
|
-
logger$
|
|
6675
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6676
6676
|
if (!this.registerer) {
|
|
6677
6677
|
return Promise.resolve();
|
|
6678
6678
|
}
|
|
6679
6679
|
|
|
6680
6680
|
try {
|
|
6681
6681
|
return this.registerer.unregister().then(() => {
|
|
6682
|
-
logger$
|
|
6682
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6683
6683
|
this._cleanupRegister();
|
|
6684
6684
|
}).catch(e => {
|
|
6685
|
-
logger$
|
|
6685
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6686
6686
|
this._cleanupRegister();
|
|
6687
6687
|
});
|
|
6688
6688
|
} catch (e) {
|
|
6689
|
-
logger$
|
|
6689
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6690
6690
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6691
6691
|
// error when the registerer is in a bad state
|
|
6692
6692
|
this._cleanupRegister();
|
|
@@ -6694,7 +6694,7 @@ class WebRTCClient extends Emitter {
|
|
|
6694
6694
|
}
|
|
6695
6695
|
|
|
6696
6696
|
stop() {
|
|
6697
|
-
logger$
|
|
6697
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6698
6698
|
if (!this.userAgent) {
|
|
6699
6699
|
return Promise.resolve();
|
|
6700
6700
|
}
|
|
@@ -6702,12 +6702,12 @@ class WebRTCClient extends Emitter {
|
|
|
6702
6702
|
return this.userAgent.stop().then(() => {
|
|
6703
6703
|
return this._cleanupRegister();
|
|
6704
6704
|
}).catch(e => {
|
|
6705
|
-
logger$
|
|
6705
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6706
6706
|
});
|
|
6707
6707
|
}
|
|
6708
6708
|
|
|
6709
6709
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6710
|
-
logger$
|
|
6710
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6711
6711
|
const inviterOptions = {
|
|
6712
6712
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6713
6713
|
conference,
|
|
@@ -6738,7 +6738,7 @@ class WebRTCClient extends Emitter {
|
|
|
6738
6738
|
this._onAccepted(session, response.session, true);
|
|
6739
6739
|
},
|
|
6740
6740
|
onReject: (response ) => {
|
|
6741
|
-
logger$
|
|
6741
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6742
6742
|
this._stopSendingStats(session);
|
|
6743
6743
|
this.stopNetworkMonitoring(session);
|
|
6744
6744
|
|
|
@@ -6761,11 +6761,11 @@ class WebRTCClient extends Emitter {
|
|
|
6761
6761
|
}
|
|
6762
6762
|
|
|
6763
6763
|
answer(session , enableVideo ) {
|
|
6764
|
-
logger$
|
|
6764
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6765
6765
|
|
|
6766
6766
|
if (!session || !session.accept) {
|
|
6767
6767
|
const error = 'No session to answer, or not an invitation';
|
|
6768
|
-
logger$
|
|
6768
|
+
logger$9.warn(error);
|
|
6769
6769
|
return Promise.reject(new Error(error));
|
|
6770
6770
|
}
|
|
6771
6771
|
const options = {
|
|
@@ -6775,15 +6775,15 @@ class WebRTCClient extends Emitter {
|
|
|
6775
6775
|
return session.accept(options).then(() => {
|
|
6776
6776
|
if (session.isCanceled) {
|
|
6777
6777
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6778
|
-
logger$
|
|
6778
|
+
logger$9.error(message, { id: session.id });
|
|
6779
6779
|
this.onCallEnded(session);
|
|
6780
6780
|
|
|
6781
6781
|
throw new CanceledCallError(message);
|
|
6782
6782
|
}
|
|
6783
|
-
logger$
|
|
6783
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6784
6784
|
this._onAccepted(session);
|
|
6785
6785
|
}).catch(e => {
|
|
6786
|
-
logger$
|
|
6786
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6787
6787
|
|
|
6788
6788
|
throw e;
|
|
6789
6789
|
});
|
|
@@ -6791,7 +6791,7 @@ class WebRTCClient extends Emitter {
|
|
|
6791
6791
|
|
|
6792
6792
|
hangup(session ) {
|
|
6793
6793
|
const { state, id } = session;
|
|
6794
|
-
logger$
|
|
6794
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6795
6795
|
|
|
6796
6796
|
try {
|
|
6797
6797
|
this._stopSendingStats(session);
|
|
@@ -6820,7 +6820,7 @@ class WebRTCClient extends Emitter {
|
|
|
6820
6820
|
|
|
6821
6821
|
return bye();
|
|
6822
6822
|
} catch (error) {
|
|
6823
|
-
logger$
|
|
6823
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6824
6824
|
}
|
|
6825
6825
|
|
|
6826
6826
|
return null;
|
|
@@ -6838,7 +6838,7 @@ class WebRTCClient extends Emitter {
|
|
|
6838
6838
|
// Fetch and emit an event at `interval` with session network stats
|
|
6839
6839
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6840
6840
|
const sessionId = this.getSipSessionId(session);
|
|
6841
|
-
logger$
|
|
6841
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6842
6842
|
|
|
6843
6843
|
this.sessionNetworkStats[sessionId] = [];
|
|
6844
6844
|
|
|
@@ -6848,7 +6848,7 @@ class WebRTCClient extends Emitter {
|
|
|
6848
6848
|
stopNetworkMonitoring(session ) {
|
|
6849
6849
|
const sessionId = this.getSipSessionId(session);
|
|
6850
6850
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6851
|
-
logger$
|
|
6851
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6852
6852
|
|
|
6853
6853
|
if (exists) {
|
|
6854
6854
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6858,17 +6858,17 @@ class WebRTCClient extends Emitter {
|
|
|
6858
6858
|
}
|
|
6859
6859
|
|
|
6860
6860
|
reject(session ) {
|
|
6861
|
-
logger$
|
|
6861
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6862
6862
|
|
|
6863
6863
|
try {
|
|
6864
6864
|
return session.reject ? session.reject() : session.cancel();
|
|
6865
6865
|
} catch (e) {
|
|
6866
|
-
logger$
|
|
6866
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6867
6867
|
}
|
|
6868
6868
|
}
|
|
6869
6869
|
|
|
6870
6870
|
async close() {
|
|
6871
|
-
logger$
|
|
6871
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6872
6872
|
this._cleanupMedia();
|
|
6873
6873
|
this.connectionPromise = null;
|
|
6874
6874
|
|
|
@@ -6899,7 +6899,7 @@ class WebRTCClient extends Emitter {
|
|
|
6899
6899
|
// eg: "INVITE not rejectable in state Completed"
|
|
6900
6900
|
}
|
|
6901
6901
|
this.userAgent = null;
|
|
6902
|
-
logger$
|
|
6902
|
+
logger$9.info('sdk webrtc client closed');
|
|
6903
6903
|
}
|
|
6904
6904
|
|
|
6905
6905
|
getNumber(session ) {
|
|
@@ -6912,13 +6912,13 @@ class WebRTCClient extends Emitter {
|
|
|
6912
6912
|
}
|
|
6913
6913
|
|
|
6914
6914
|
mute(session ) {
|
|
6915
|
-
logger$
|
|
6915
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6916
6916
|
|
|
6917
6917
|
this._toggleAudio(session, true);
|
|
6918
6918
|
}
|
|
6919
6919
|
|
|
6920
6920
|
unmute(session ) {
|
|
6921
|
-
logger$
|
|
6921
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6922
6922
|
|
|
6923
6923
|
this._toggleAudio(session, false);
|
|
6924
6924
|
}
|
|
@@ -6958,13 +6958,13 @@ class WebRTCClient extends Emitter {
|
|
|
6958
6958
|
}
|
|
6959
6959
|
|
|
6960
6960
|
toggleCameraOn(session ) {
|
|
6961
|
-
logger$
|
|
6961
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6962
6962
|
|
|
6963
6963
|
this._toggleVideo(session, false);
|
|
6964
6964
|
}
|
|
6965
6965
|
|
|
6966
6966
|
toggleCameraOff(session ) {
|
|
6967
|
-
logger$
|
|
6967
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6968
6968
|
|
|
6969
6969
|
this._toggleVideo(session, true);
|
|
6970
6970
|
}
|
|
@@ -6973,7 +6973,7 @@ class WebRTCClient extends Emitter {
|
|
|
6973
6973
|
const sessionId = this.getSipSessionId(session);
|
|
6974
6974
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6975
6975
|
|
|
6976
|
-
logger$
|
|
6976
|
+
logger$9.info('sdk webrtc hold', {
|
|
6977
6977
|
sessionId,
|
|
6978
6978
|
keys: Object.keys(this.heldSessions),
|
|
6979
6979
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7022,7 +7022,7 @@ class WebRTCClient extends Emitter {
|
|
|
7022
7022
|
const sessionId = this.getSipSessionId(session);
|
|
7023
7023
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7024
7024
|
|
|
7025
|
-
logger$
|
|
7025
|
+
logger$9.info('sdk webrtc unhold', {
|
|
7026
7026
|
sessionId,
|
|
7027
7027
|
keys: Object.keys(this.heldSessions),
|
|
7028
7028
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7170,7 +7170,7 @@ class WebRTCClient extends Emitter {
|
|
|
7170
7170
|
if (!session.sessionDescriptionHandler) {
|
|
7171
7171
|
return;
|
|
7172
7172
|
}
|
|
7173
|
-
logger$
|
|
7173
|
+
logger$9.info('Sending DTMF', {
|
|
7174
7174
|
id: this.getSipSessionId(session),
|
|
7175
7175
|
tone,
|
|
7176
7176
|
});
|
|
@@ -7186,7 +7186,7 @@ class WebRTCClient extends Emitter {
|
|
|
7186
7186
|
transfer(session , target ) {
|
|
7187
7187
|
this.hold(session);
|
|
7188
7188
|
|
|
7189
|
-
logger$
|
|
7189
|
+
logger$9.info('Transfering a session', {
|
|
7190
7190
|
id: this.getSipSessionId(session),
|
|
7191
7191
|
target,
|
|
7192
7192
|
});
|
|
@@ -7208,17 +7208,17 @@ class WebRTCClient extends Emitter {
|
|
|
7208
7208
|
atxfer(session ) {
|
|
7209
7209
|
this.hold(session);
|
|
7210
7210
|
|
|
7211
|
-
logger$
|
|
7211
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7212
7212
|
|
|
7213
7213
|
const result = {
|
|
7214
7214
|
newSession: null,
|
|
7215
7215
|
init: async (target ) => {
|
|
7216
|
-
logger$
|
|
7216
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7217
7217
|
|
|
7218
7218
|
result.newSession = await this.call(target);
|
|
7219
7219
|
},
|
|
7220
7220
|
complete: () => {
|
|
7221
|
-
logger$
|
|
7221
|
+
logger$9.info('webrtc transfer completed', {
|
|
7222
7222
|
id: this.getSipSessionId(session),
|
|
7223
7223
|
referId: this.getSipSessionId(result.newSession),
|
|
7224
7224
|
});
|
|
@@ -7239,7 +7239,7 @@ class WebRTCClient extends Emitter {
|
|
|
7239
7239
|
return;
|
|
7240
7240
|
}
|
|
7241
7241
|
|
|
7242
|
-
logger$
|
|
7242
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7243
7243
|
|
|
7244
7244
|
try {
|
|
7245
7245
|
sipSession.message({
|
|
@@ -7281,7 +7281,7 @@ class WebRTCClient extends Emitter {
|
|
|
7281
7281
|
}
|
|
7282
7282
|
|
|
7283
7283
|
changeAudioOutputVolume(volume ) {
|
|
7284
|
-
logger$
|
|
7284
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7285
7285
|
|
|
7286
7286
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7287
7287
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7293,7 +7293,7 @@ class WebRTCClient extends Emitter {
|
|
|
7293
7293
|
}
|
|
7294
7294
|
|
|
7295
7295
|
changeAudioOutputDevice(id ) {
|
|
7296
|
-
logger$
|
|
7296
|
+
logger$9.info('Changing audio output device', { id });
|
|
7297
7297
|
|
|
7298
7298
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7299
7299
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7310,7 +7310,7 @@ class WebRTCClient extends Emitter {
|
|
|
7310
7310
|
|
|
7311
7311
|
changeAudioInputDevice(id , session ) {
|
|
7312
7312
|
const currentId = this.getAudioDeviceId();
|
|
7313
|
-
logger$
|
|
7313
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7314
7314
|
|
|
7315
7315
|
if (id === currentId) {
|
|
7316
7316
|
return null;
|
|
@@ -7356,7 +7356,7 @@ class WebRTCClient extends Emitter {
|
|
|
7356
7356
|
|
|
7357
7357
|
setVideoInputDevice(id ) {
|
|
7358
7358
|
const currentId = this.getVideoDeviceId();
|
|
7359
|
-
logger$
|
|
7359
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7360
7360
|
|
|
7361
7361
|
if (id === currentId) {
|
|
7362
7362
|
return null;
|
|
@@ -7381,7 +7381,7 @@ class WebRTCClient extends Emitter {
|
|
|
7381
7381
|
const sessionId = this.getSipSessionId(session);
|
|
7382
7382
|
const localStream = this.getLocalStream(sessionId);
|
|
7383
7383
|
|
|
7384
|
-
logger$
|
|
7384
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7385
7385
|
|
|
7386
7386
|
// Release old video stream
|
|
7387
7387
|
if (localStream) {
|
|
@@ -7449,7 +7449,7 @@ class WebRTCClient extends Emitter {
|
|
|
7449
7449
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7450
7450
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7451
7451
|
|
|
7452
|
-
logger$
|
|
7452
|
+
logger$9.info('Sending reinvite', {
|
|
7453
7453
|
id: this.getSipSessionId(sipSession),
|
|
7454
7454
|
newConstraints,
|
|
7455
7455
|
conference,
|
|
@@ -7487,7 +7487,7 @@ class WebRTCClient extends Emitter {
|
|
|
7487
7487
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7488
7488
|
}
|
|
7489
7489
|
|
|
7490
|
-
logger$
|
|
7490
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7491
7491
|
id: this.getSipSessionId(sipSession),
|
|
7492
7492
|
wasMuted,
|
|
7493
7493
|
shouldDoScreenSharing,
|
|
@@ -7505,7 +7505,7 @@ class WebRTCClient extends Emitter {
|
|
|
7505
7505
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7506
7506
|
}
|
|
7507
7507
|
|
|
7508
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7508
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7509
7509
|
},
|
|
7510
7510
|
},
|
|
7511
7511
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7662,7 +7662,7 @@ class WebRTCClient extends Emitter {
|
|
|
7662
7662
|
}
|
|
7663
7663
|
|
|
7664
7664
|
startHeartbeat() {
|
|
7665
|
-
logger$
|
|
7665
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7666
7666
|
if (!this.userAgent) {
|
|
7667
7667
|
this.heartbeat.stop();
|
|
7668
7668
|
return;
|
|
@@ -7675,7 +7675,7 @@ class WebRTCClient extends Emitter {
|
|
|
7675
7675
|
}
|
|
7676
7676
|
|
|
7677
7677
|
stopHeartbeat() {
|
|
7678
|
-
logger$
|
|
7678
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7679
7679
|
this.heartbeat.stop();
|
|
7680
7680
|
}
|
|
7681
7681
|
|
|
@@ -7696,7 +7696,7 @@ class WebRTCClient extends Emitter {
|
|
|
7696
7696
|
}
|
|
7697
7697
|
|
|
7698
7698
|
attemptReconnection() {
|
|
7699
|
-
logger$
|
|
7699
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7700
7700
|
if (!this.userAgent) {
|
|
7701
7701
|
return;
|
|
7702
7702
|
}
|
|
@@ -7721,7 +7721,7 @@ class WebRTCClient extends Emitter {
|
|
|
7721
7721
|
return;
|
|
7722
7722
|
}
|
|
7723
7723
|
|
|
7724
|
-
logger$
|
|
7724
|
+
logger$9.info('setting local media stream', {
|
|
7725
7725
|
sipSessionId,
|
|
7726
7726
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7727
7727
|
});
|
|
@@ -7738,7 +7738,7 @@ class WebRTCClient extends Emitter {
|
|
|
7738
7738
|
|
|
7739
7739
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7740
7740
|
|
|
7741
|
-
logger$
|
|
7741
|
+
logger$9.info('updating local stream', {
|
|
7742
7742
|
sipSessionId,
|
|
7743
7743
|
oldStream: !!oldStream,
|
|
7744
7744
|
tracks: newStream.getTracks(),
|
|
@@ -7758,7 +7758,7 @@ class WebRTCClient extends Emitter {
|
|
|
7758
7758
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7759
7759
|
const pc = this.getPeerConnection(sessionId);
|
|
7760
7760
|
|
|
7761
|
-
logger$
|
|
7761
|
+
logger$9.info('Updating remote stream', {
|
|
7762
7762
|
sessionId,
|
|
7763
7763
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7764
7764
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7783,14 +7783,16 @@ class WebRTCClient extends Emitter {
|
|
|
7783
7783
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7784
7784
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7785
7785
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7786
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7786
7787
|
|
|
7787
|
-
logger$
|
|
7788
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7788
7789
|
|
|
7789
7790
|
return {
|
|
7790
7791
|
constraints: {
|
|
7791
7792
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7792
7793
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7793
|
-
video: screenSharing ? (isDesktop
|
|
7794
|
+
video: screenSharing ? (isDesktop
|
|
7795
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7794
7796
|
: this._getVideoConstraints(enableVideo),
|
|
7795
7797
|
screen: screenSharing,
|
|
7796
7798
|
desktop: isDesktop,
|
|
@@ -7833,7 +7835,7 @@ class WebRTCClient extends Emitter {
|
|
|
7833
7835
|
}
|
|
7834
7836
|
|
|
7835
7837
|
_onTransportError() {
|
|
7836
|
-
logger$
|
|
7838
|
+
logger$9.error('on transport error');
|
|
7837
7839
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7838
7840
|
this.attemptReconnection();
|
|
7839
7841
|
}
|
|
@@ -7842,7 +7844,7 @@ class WebRTCClient extends Emitter {
|
|
|
7842
7844
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7843
7845
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7844
7846
|
if (this.hasHeartbeat()) {
|
|
7845
|
-
logger$
|
|
7847
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7846
7848
|
|
|
7847
7849
|
this.heartbeat.onHeartbeat();
|
|
7848
7850
|
if (this.heartbeatCb) {
|
|
@@ -7853,7 +7855,7 @@ class WebRTCClient extends Emitter {
|
|
|
7853
7855
|
}
|
|
7854
7856
|
|
|
7855
7857
|
async _onHeartbeatTimeout() {
|
|
7856
|
-
logger$
|
|
7858
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7857
7859
|
|
|
7858
7860
|
if (this.heartbeatTimeoutCb) {
|
|
7859
7861
|
this.heartbeatTimeoutCb();
|
|
@@ -7865,7 +7867,7 @@ class WebRTCClient extends Emitter {
|
|
|
7865
7867
|
try {
|
|
7866
7868
|
await this.userAgent.transport.disconnect();
|
|
7867
7869
|
} catch (e) {
|
|
7868
|
-
logger$
|
|
7870
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7869
7871
|
}
|
|
7870
7872
|
}
|
|
7871
7873
|
|
|
@@ -7898,31 +7900,31 @@ class WebRTCClient extends Emitter {
|
|
|
7898
7900
|
}
|
|
7899
7901
|
|
|
7900
7902
|
_connectIfNeeded() {
|
|
7901
|
-
logger$
|
|
7903
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7902
7904
|
if (!this.userAgent) {
|
|
7903
|
-
logger$
|
|
7905
|
+
logger$9.info('need to recreate User Agent');
|
|
7904
7906
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7905
7907
|
}
|
|
7906
7908
|
|
|
7907
7909
|
if (this.isConnected()) {
|
|
7908
|
-
logger$
|
|
7910
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7909
7911
|
return Promise.resolve();
|
|
7910
7912
|
}
|
|
7911
7913
|
|
|
7912
7914
|
if (this.isConnecting()) {
|
|
7913
|
-
logger$
|
|
7915
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7914
7916
|
|
|
7915
7917
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7916
7918
|
return this.connectionPromise;
|
|
7917
7919
|
}
|
|
7918
7920
|
|
|
7919
7921
|
if (this.connectionPromise) {
|
|
7920
|
-
logger$
|
|
7922
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7921
7923
|
// $FlowFixMe
|
|
7922
7924
|
return this.connectionPromise;
|
|
7923
7925
|
}
|
|
7924
7926
|
|
|
7925
|
-
logger$
|
|
7927
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7926
7928
|
|
|
7927
7929
|
// Force UA to reconnect
|
|
7928
7930
|
if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
|
|
@@ -8047,7 +8049,7 @@ class WebRTCClient extends Emitter {
|
|
|
8047
8049
|
|
|
8048
8050
|
sdh.peerConnectionDelegate = {
|
|
8049
8051
|
onicecandidateerror: (error ) => {
|
|
8050
|
-
logger$
|
|
8052
|
+
logger$9.error('on icecandidate error', {
|
|
8051
8053
|
address: error.address,
|
|
8052
8054
|
port: error.port,
|
|
8053
8055
|
errorCode: error.errorCode,
|
|
@@ -8076,7 +8078,7 @@ class WebRTCClient extends Emitter {
|
|
|
8076
8078
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8077
8079
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8078
8080
|
}
|
|
8079
|
-
logger$
|
|
8081
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8080
8082
|
|
|
8081
8083
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8082
8084
|
|
|
@@ -8092,12 +8094,12 @@ class WebRTCClient extends Emitter {
|
|
|
8092
8094
|
|
|
8093
8095
|
this._setupMedias(session);
|
|
8094
8096
|
|
|
8095
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8097
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8096
8098
|
};
|
|
8097
8099
|
}
|
|
8098
8100
|
|
|
8099
8101
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8100
|
-
logger$
|
|
8102
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8101
8103
|
|
|
8102
8104
|
this.storeSipSession(session);
|
|
8103
8105
|
|
|
@@ -8109,14 +8111,14 @@ class WebRTCClient extends Emitter {
|
|
|
8109
8111
|
const onTrack = (event ) => {
|
|
8110
8112
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8111
8113
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8112
|
-
logger$
|
|
8114
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8113
8115
|
|
|
8114
8116
|
// Stop video track in audio only mode
|
|
8115
8117
|
if (isAudioOnly && kind === 'video') {
|
|
8116
8118
|
event.track.stop();
|
|
8117
8119
|
}
|
|
8118
8120
|
|
|
8119
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8121
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8120
8122
|
};
|
|
8121
8123
|
|
|
8122
8124
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8125,12 +8127,14 @@ class WebRTCClient extends Emitter {
|
|
|
8125
8127
|
|
|
8126
8128
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8127
8129
|
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8130
|
+
if (pc) {
|
|
8131
|
+
pc.oniceconnectionstatechange = () => {
|
|
8132
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8133
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8134
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8135
|
+
}
|
|
8136
|
+
};
|
|
8137
|
+
}
|
|
8134
8138
|
|
|
8135
8139
|
if (withEvent) {
|
|
8136
8140
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8299,10 +8303,10 @@ class WebRTCClient extends Emitter {
|
|
|
8299
8303
|
|
|
8300
8304
|
_stopSendingStats(session ) {
|
|
8301
8305
|
const sessionId = this.getSipSessionId(session);
|
|
8302
|
-
logger$
|
|
8306
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8303
8307
|
|
|
8304
8308
|
if (sessionId in this.statsIntervals) {
|
|
8305
|
-
logger$
|
|
8309
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8306
8310
|
this.statsIntervals[sessionId]();
|
|
8307
8311
|
delete this.statsIntervals[sessionId];
|
|
8308
8312
|
}
|
|
@@ -8318,7 +8322,7 @@ class WebRTCClient extends Emitter {
|
|
|
8318
8322
|
try {
|
|
8319
8323
|
await this.userAgent.transport.disconnect();
|
|
8320
8324
|
} catch (e) {
|
|
8321
|
-
logger$
|
|
8325
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8322
8326
|
}
|
|
8323
8327
|
}
|
|
8324
8328
|
}
|
|
@@ -8340,13 +8344,17 @@ class WebRTCClient extends Emitter {
|
|
|
8340
8344
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8341
8345
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8342
8346
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8347
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8343
8348
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8344
8349
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8350
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8345
8351
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8346
8352
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8347
8353
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8348
|
-
let audioBytesSent = 0;
|
|
8349
|
-
let audioBytesReceived = 0;
|
|
8354
|
+
let audioBytesSent = 0; // content + header
|
|
8355
|
+
let audioBytesReceived = 0; // content + header
|
|
8356
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8357
|
+
let audioContentReceived = 0;
|
|
8350
8358
|
let videoBytesSent = 0;
|
|
8351
8359
|
let videoBytesReceived = 0;
|
|
8352
8360
|
let transportSent = 0;
|
|
@@ -8356,6 +8364,7 @@ class WebRTCClient extends Emitter {
|
|
|
8356
8364
|
stats.forEach(report => {
|
|
8357
8365
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8358
8366
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8367
|
+
audioContentSent += Number(report.bytesSent);
|
|
8359
8368
|
}
|
|
8360
8369
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8361
8370
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8367,6 +8376,7 @@ class WebRTCClient extends Emitter {
|
|
|
8367
8376
|
packetsLost += Number(report.packetsLost);
|
|
8368
8377
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8369
8378
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8379
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8370
8380
|
}
|
|
8371
8381
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8372
8382
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8395,10 +8405,17 @@ class WebRTCClient extends Emitter {
|
|
|
8395
8405
|
});
|
|
8396
8406
|
|
|
8397
8407
|
networkStats.packetsLost = packetsLost;
|
|
8408
|
+
|
|
8398
8409
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8399
8410
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8400
8411
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8401
8412
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8413
|
+
|
|
8414
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8415
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8416
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8417
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8418
|
+
|
|
8402
8419
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8403
8420
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8404
8421
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8412,7 +8429,7 @@ class WebRTCClient extends Emitter {
|
|
|
8412
8429
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8413
8430
|
+ networkStats.transportSent;
|
|
8414
8431
|
|
|
8415
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8432
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8416
8433
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8417
8434
|
}
|
|
8418
8435
|
|
|
@@ -8440,8 +8457,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8440
8457
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8441
8458
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8442
8459
|
const ON_MESSAGE = 'onMessage';
|
|
8443
|
-
const ON_REINVITE
|
|
8444
|
-
const ON_TRACK
|
|
8460
|
+
const ON_REINVITE = 'reinvite';
|
|
8461
|
+
const ON_TRACK = 'onTrack';
|
|
8445
8462
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8446
8463
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8447
8464
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8456,15 +8473,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8456
8473
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8457
8474
|
const ON_CALL_ERROR = 'onCallError';
|
|
8458
8475
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8459
|
-
const ON_NETWORK_STATS
|
|
8476
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8460
8477
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8461
8478
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8462
|
-
const ON_DISCONNECTED
|
|
8479
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8463
8480
|
|
|
8464
8481
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8465
8482
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8466
8483
|
|
|
8467
|
-
const events
|
|
8484
|
+
const events = [
|
|
8468
8485
|
ON_USER_AGENT,
|
|
8469
8486
|
ON_REGISTERED,
|
|
8470
8487
|
ON_UNREGISTERED,
|
|
@@ -8482,8 +8499,8 @@ const events$1 = [
|
|
|
8482
8499
|
ON_CALL_FAILED,
|
|
8483
8500
|
ON_CALL_ENDED,
|
|
8484
8501
|
ON_MESSAGE,
|
|
8485
|
-
ON_REINVITE
|
|
8486
|
-
ON_TRACK
|
|
8502
|
+
ON_REINVITE,
|
|
8503
|
+
ON_TRACK,
|
|
8487
8504
|
ON_AUDIO_STREAM,
|
|
8488
8505
|
ON_VIDEO_STREAM,
|
|
8489
8506
|
ON_REMOVE_STREAM,
|
|
@@ -8498,11 +8515,11 @@ const events$1 = [
|
|
|
8498
8515
|
ON_CALL_ERROR,
|
|
8499
8516
|
ON_CHAT,
|
|
8500
8517
|
ON_SIGNAL,
|
|
8501
|
-
ON_NETWORK_STATS
|
|
8502
|
-
ON_DISCONNECTED
|
|
8518
|
+
ON_NETWORK_STATS,
|
|
8519
|
+
ON_DISCONNECTED,
|
|
8503
8520
|
];
|
|
8504
8521
|
|
|
8505
|
-
const logger$
|
|
8522
|
+
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8506
8523
|
|
|
8507
8524
|
class WebRTCPhone extends Emitter {
|
|
8508
8525
|
|
|
@@ -8575,7 +8592,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8575
8592
|
}).catch(error => {
|
|
8576
8593
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8577
8594
|
console.error('register error', error, error.message, error.stack);
|
|
8578
|
-
logger$
|
|
8595
|
+
logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8579
8596
|
});
|
|
8580
8597
|
}
|
|
8581
8598
|
|
|
@@ -8590,7 +8607,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8590
8607
|
if (!this.client) {
|
|
8591
8608
|
return;
|
|
8592
8609
|
}
|
|
8593
|
-
logger$
|
|
8610
|
+
logger$8.info('WebRTC phone stop');
|
|
8594
8611
|
this.client.stop();
|
|
8595
8612
|
}
|
|
8596
8613
|
|
|
@@ -8605,11 +8622,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8605
8622
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8606
8623
|
audioOnly = false, iceRestart = false) {
|
|
8607
8624
|
const sipSession = this.findSipSession(callSession);
|
|
8608
|
-
logger$
|
|
8625
|
+
logger$8.info('WebRTC phone - send reinvite', {
|
|
8609
8626
|
sessionId: sipSession ? sipSession.id : null,
|
|
8610
8627
|
constraints,
|
|
8611
8628
|
audioOnly,
|
|
8612
8629
|
conference,
|
|
8630
|
+
iceRestart,
|
|
8613
8631
|
});
|
|
8614
8632
|
|
|
8615
8633
|
if (!sipSession) {
|
|
@@ -8642,7 +8660,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8642
8660
|
}
|
|
8643
8661
|
|
|
8644
8662
|
startHeartbeat() {
|
|
8645
|
-
logger$
|
|
8663
|
+
logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8646
8664
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8647
8665
|
return;
|
|
8648
8666
|
}
|
|
@@ -8651,7 +8669,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8651
8669
|
}
|
|
8652
8670
|
|
|
8653
8671
|
stopHeartbeat() {
|
|
8654
|
-
logger$
|
|
8672
|
+
logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8655
8673
|
if (!this.client) {
|
|
8656
8674
|
return;
|
|
8657
8675
|
}
|
|
@@ -8668,7 +8686,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8668
8686
|
}
|
|
8669
8687
|
|
|
8670
8688
|
reconnect() {
|
|
8671
|
-
logger$
|
|
8689
|
+
logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8672
8690
|
if (!this.client) {
|
|
8673
8691
|
return;
|
|
8674
8692
|
}
|
|
@@ -8709,7 +8727,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8709
8727
|
return false;
|
|
8710
8728
|
}
|
|
8711
8729
|
|
|
8712
|
-
logger$
|
|
8730
|
+
logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8713
8731
|
|
|
8714
8732
|
this.client.downgradeToAudio(sipSession);
|
|
8715
8733
|
|
|
@@ -8732,7 +8750,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8732
8750
|
return Promise.resolve(false);
|
|
8733
8751
|
}
|
|
8734
8752
|
|
|
8735
|
-
logger$
|
|
8753
|
+
logger$8.info('Upgrade to video', {
|
|
8736
8754
|
id: callSession ? callSession.getId() : null,
|
|
8737
8755
|
constraints,
|
|
8738
8756
|
isConference,
|
|
@@ -8772,7 +8790,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8772
8790
|
|
|
8773
8791
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
8774
8792
|
const sipSession = this.findSipSession(callSession);
|
|
8775
|
-
logger$
|
|
8793
|
+
logger$8.info('Sending reinvite message', {
|
|
8776
8794
|
id: callSession ? callSession.getId() : null,
|
|
8777
8795
|
isUpgrade,
|
|
8778
8796
|
});
|
|
@@ -8798,7 +8816,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8798
8816
|
// Monkey patch to know when canceled with the CANCEL message
|
|
8799
8817
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
8800
8818
|
sipSession._onCancel = (message ) => {
|
|
8801
|
-
logger$
|
|
8819
|
+
logger$8.trace('on sip session canceled', { callId: message.callId });
|
|
8802
8820
|
|
|
8803
8821
|
onCancel(message);
|
|
8804
8822
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -8826,13 +8844,13 @@ class WebRTCPhone extends Emitter {
|
|
|
8826
8844
|
this.audioOutputVolume,
|
|
8827
8845
|
);
|
|
8828
8846
|
case SessionState.Terminating:
|
|
8829
|
-
logger$
|
|
8847
|
+
logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
8830
8848
|
|
|
8831
8849
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
8832
8850
|
|
|
8833
8851
|
break;
|
|
8834
8852
|
case SessionState.Terminated: {
|
|
8835
|
-
logger$
|
|
8853
|
+
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8836
8854
|
|
|
8837
8855
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8838
8856
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -8854,7 +8872,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8854
8872
|
const [stream] = event.streams;
|
|
8855
8873
|
const kind = event && event.track && event.track.kind;
|
|
8856
8874
|
|
|
8857
|
-
logger$
|
|
8875
|
+
logger$8.info('on track stream called on the peer connection', {
|
|
8858
8876
|
callId: this.getSipSessionId(sipSession),
|
|
8859
8877
|
streamId: stream ? stream.id : null,
|
|
8860
8878
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -8874,7 +8892,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8874
8892
|
};
|
|
8875
8893
|
|
|
8876
8894
|
peerConnection.onremovestream = event => {
|
|
8877
|
-
logger$
|
|
8895
|
+
logger$8.info('on remove stream called on the peer connection', {
|
|
8878
8896
|
id: event.stream.id,
|
|
8879
8897
|
tracks: event.stream.getTracks(),
|
|
8880
8898
|
});
|
|
@@ -8884,7 +8902,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8884
8902
|
}
|
|
8885
8903
|
|
|
8886
8904
|
async startScreenSharing(constraints , callSession ) {
|
|
8887
|
-
logger$
|
|
8905
|
+
logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
8888
8906
|
|
|
8889
8907
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
8890
8908
|
if (!screenShareStream) {
|
|
@@ -8924,7 +8942,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8924
8942
|
return;
|
|
8925
8943
|
}
|
|
8926
8944
|
|
|
8927
|
-
logger$
|
|
8945
|
+
logger$8.info('WebRTC phone - stop screen sharing', {
|
|
8928
8946
|
restoreLocalStream,
|
|
8929
8947
|
});
|
|
8930
8948
|
|
|
@@ -8980,7 +8998,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8980
8998
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
8981
8999
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
8982
9000
|
|
|
8983
|
-
logger$
|
|
9001
|
+
logger$8.info('WebRTC phone - on screensharing', {
|
|
8984
9002
|
hadVideo,
|
|
8985
9003
|
id: this.getSipSessionId(sipSession),
|
|
8986
9004
|
screenTrack,
|
|
@@ -8988,7 +9006,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8988
9006
|
|
|
8989
9007
|
if (screenTrack) {
|
|
8990
9008
|
screenTrack.onended = () => {
|
|
8991
|
-
logger$
|
|
9009
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
8992
9010
|
hadVideo,
|
|
8993
9011
|
id: this.getSipSessionId(sipSession),
|
|
8994
9012
|
screenTrack,
|
|
@@ -9019,7 +9037,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9019
9037
|
}
|
|
9020
9038
|
|
|
9021
9039
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9022
|
-
logger$
|
|
9040
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9023
9041
|
|
|
9024
9042
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9025
9043
|
this.currentSipSession = sipSession;
|
|
@@ -9037,7 +9055,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9037
9055
|
}
|
|
9038
9056
|
|
|
9039
9057
|
changeAudioDevice(id ) {
|
|
9040
|
-
logger$
|
|
9058
|
+
logger$8.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9041
9059
|
this.audioOutputDeviceId = id;
|
|
9042
9060
|
this.client.changeAudioOutputDevice(id);
|
|
9043
9061
|
}
|
|
@@ -9047,14 +9065,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9047
9065
|
}
|
|
9048
9066
|
|
|
9049
9067
|
changeRingDevice(id ) {
|
|
9050
|
-
logger$
|
|
9068
|
+
logger$8.info('WebRTC phone - changing ring device', { id });
|
|
9051
9069
|
|
|
9052
9070
|
this.audioRingDeviceId = id;
|
|
9053
9071
|
}
|
|
9054
9072
|
|
|
9055
9073
|
// volume is a value between 0 and 1
|
|
9056
9074
|
changeAudioVolume(volume ) {
|
|
9057
|
-
logger$
|
|
9075
|
+
logger$8.info('WebRTC phone - changing audio volume', { volume });
|
|
9058
9076
|
|
|
9059
9077
|
this.audioOutputVolume = volume;
|
|
9060
9078
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9062,31 +9080,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9062
9080
|
|
|
9063
9081
|
// volume is a value between 0 and 1
|
|
9064
9082
|
changeRingVolume(volume ) {
|
|
9065
|
-
logger$
|
|
9083
|
+
logger$8.info('WebRTC phone - changing ring volume', { volume });
|
|
9066
9084
|
|
|
9067
9085
|
this.audioRingVolume = volume;
|
|
9068
9086
|
}
|
|
9069
9087
|
|
|
9070
9088
|
changeAudioInputDevice(id ) {
|
|
9071
|
-
logger$
|
|
9089
|
+
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9072
9090
|
|
|
9073
9091
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9074
9092
|
}
|
|
9075
9093
|
|
|
9076
9094
|
changeVideoInputDevice(id ) {
|
|
9077
|
-
logger$
|
|
9095
|
+
logger$8.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9078
9096
|
|
|
9079
9097
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9080
9098
|
}
|
|
9081
9099
|
|
|
9082
9100
|
changeSessionVideoInputDevice(id ) {
|
|
9083
|
-
logger$
|
|
9101
|
+
logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9084
9102
|
|
|
9085
9103
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9086
9104
|
}
|
|
9087
9105
|
|
|
9088
9106
|
_onCallTerminated(sipSession ) {
|
|
9089
|
-
logger$
|
|
9107
|
+
logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9090
9108
|
|
|
9091
9109
|
const callSession = this._createCallSession(sipSession);
|
|
9092
9110
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9120,7 +9138,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9120
9138
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9121
9139
|
|
|
9122
9140
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9123
|
-
logger$
|
|
9141
|
+
logger$8.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9124
9142
|
sipId: sipSession.id,
|
|
9125
9143
|
shouldRetrigger,
|
|
9126
9144
|
hasIncomingCallSession,
|
|
@@ -9211,37 +9229,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9211
9229
|
|
|
9212
9230
|
// Deprecated
|
|
9213
9231
|
getLocalStreamForCall(callSession ) {
|
|
9214
|
-
logger$
|
|
9232
|
+
logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9215
9233
|
|
|
9216
9234
|
return this.getLocalStream(callSession);
|
|
9217
9235
|
}
|
|
9218
9236
|
|
|
9219
9237
|
// Deprecated
|
|
9220
9238
|
getRemoteStreamForCall(callSession ) {
|
|
9221
|
-
logger$
|
|
9239
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9222
9240
|
|
|
9223
9241
|
return this.getRemoteVideoStream(callSession);
|
|
9224
9242
|
}
|
|
9225
9243
|
|
|
9226
9244
|
getRemoteStreamsForCall(callSession ) {
|
|
9227
|
-
logger$
|
|
9245
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9228
9246
|
|
|
9229
9247
|
return this.getRemoteStream(callSession);
|
|
9230
9248
|
}
|
|
9231
9249
|
|
|
9232
9250
|
accept(callSession , cameraEnabled ) {
|
|
9233
|
-
logger$
|
|
9251
|
+
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9234
9252
|
if (this.currentSipSession) {
|
|
9235
9253
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9236
9254
|
}
|
|
9237
9255
|
|
|
9238
9256
|
if (!callSession) {
|
|
9239
|
-
logger$
|
|
9257
|
+
logger$8.warn('no CallSession to accept.');
|
|
9240
9258
|
return Promise.resolve(null);
|
|
9241
9259
|
}
|
|
9242
9260
|
|
|
9243
9261
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9244
|
-
logger$
|
|
9262
|
+
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9245
9263
|
return Promise.resolve(callSession.sipCallId);
|
|
9246
9264
|
}
|
|
9247
9265
|
|
|
@@ -9253,24 +9271,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9253
9271
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9254
9272
|
if (sipSession) {
|
|
9255
9273
|
if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
|
|
9256
|
-
logger$
|
|
9274
|
+
logger$8.warn('Trying to answer a terminated sipSession.');
|
|
9257
9275
|
|
|
9258
9276
|
return Promise.resolve(null);
|
|
9259
9277
|
}
|
|
9260
9278
|
|
|
9261
|
-
logger$
|
|
9279
|
+
logger$8.info('accept call, session found', { sipId: sipSession.id });
|
|
9262
9280
|
|
|
9263
9281
|
// $FlowFixMe
|
|
9264
9282
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9265
9283
|
return callSession.sipCallId;
|
|
9266
9284
|
}).catch(e => {
|
|
9267
|
-
logger$
|
|
9285
|
+
logger$8.error(e);
|
|
9268
9286
|
this.endCurrentCall(callSession);
|
|
9269
9287
|
throw e;
|
|
9270
9288
|
});
|
|
9271
9289
|
}
|
|
9272
9290
|
|
|
9273
|
-
logger$
|
|
9291
|
+
logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9274
9292
|
|
|
9275
9293
|
return Promise.resolve(null);
|
|
9276
9294
|
}
|
|
@@ -9280,7 +9298,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9280
9298
|
}
|
|
9281
9299
|
|
|
9282
9300
|
async reject(callSession ) {
|
|
9283
|
-
logger$
|
|
9301
|
+
logger$8.info('reject WebRTC called', { id: callSession.getId() });
|
|
9284
9302
|
|
|
9285
9303
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9286
9304
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9292,14 +9310,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9292
9310
|
|
|
9293
9311
|
const sipSession = this.findSipSession(callSession);
|
|
9294
9312
|
if (sipSession) {
|
|
9295
|
-
logger$
|
|
9313
|
+
logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9296
9314
|
|
|
9297
9315
|
this.client.hangup(sipSession);
|
|
9298
9316
|
}
|
|
9299
9317
|
}
|
|
9300
9318
|
|
|
9301
9319
|
async ignore(callSession ) {
|
|
9302
|
-
logger$
|
|
9320
|
+
logger$8.info('WebRTC ignore', { id: callSession.getId() });
|
|
9303
9321
|
|
|
9304
9322
|
// kill the ring
|
|
9305
9323
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9311,14 +9329,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9311
9329
|
const sipSession = this.findSipSession(callSession);
|
|
9312
9330
|
|
|
9313
9331
|
if (sipSession) {
|
|
9314
|
-
logger$
|
|
9332
|
+
logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9315
9333
|
|
|
9316
9334
|
return this.client.atxfer(sipSession);
|
|
9317
9335
|
}
|
|
9318
9336
|
}
|
|
9319
9337
|
|
|
9320
9338
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9321
|
-
logger$
|
|
9339
|
+
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9322
9340
|
|
|
9323
9341
|
const sipSession = this.findSipSession(callSession);
|
|
9324
9342
|
|
|
@@ -9333,18 +9351,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9333
9351
|
}
|
|
9334
9352
|
|
|
9335
9353
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9336
|
-
logger$
|
|
9354
|
+
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9337
9355
|
|
|
9338
9356
|
const sipSession = this.findSipSession(callSession);
|
|
9339
9357
|
if (!sipSession) {
|
|
9340
9358
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9341
9359
|
}
|
|
9342
9360
|
|
|
9343
|
-
logger$
|
|
9361
|
+
logger$8.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9344
9362
|
|
|
9345
9363
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9346
9364
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9347
|
-
logger$
|
|
9365
|
+
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9348
9366
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9349
9367
|
}
|
|
9350
9368
|
|
|
@@ -9369,7 +9387,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9369
9387
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9370
9388
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9371
9389
|
|
|
9372
|
-
logger$
|
|
9390
|
+
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9373
9391
|
|
|
9374
9392
|
// Stop screenshre if needed
|
|
9375
9393
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9400,7 +9418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9400
9418
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9401
9419
|
}
|
|
9402
9420
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9403
|
-
logger$
|
|
9421
|
+
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9404
9422
|
|
|
9405
9423
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9406
9424
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9444,14 +9462,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9444
9462
|
}
|
|
9445
9463
|
|
|
9446
9464
|
mute(callSession , withEvent = true) {
|
|
9447
|
-
logger$
|
|
9465
|
+
logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9448
9466
|
|
|
9449
9467
|
const sipSession = this.findSipSession(callSession);
|
|
9450
9468
|
if (!sipSession) {
|
|
9451
9469
|
return;
|
|
9452
9470
|
}
|
|
9453
9471
|
|
|
9454
|
-
logger$
|
|
9472
|
+
logger$8.info('WebRTC muting', { sipId: sipSession.id });
|
|
9455
9473
|
this.client.mute(sipSession);
|
|
9456
9474
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9457
9475
|
|
|
@@ -9465,14 +9483,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9465
9483
|
}
|
|
9466
9484
|
|
|
9467
9485
|
unmute(callSession , withEvent = true) {
|
|
9468
|
-
logger$
|
|
9486
|
+
logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9469
9487
|
|
|
9470
9488
|
const sipSession = this.findSipSession(callSession);
|
|
9471
9489
|
if (!sipSession) {
|
|
9472
9490
|
return;
|
|
9473
9491
|
}
|
|
9474
9492
|
|
|
9475
|
-
logger$
|
|
9493
|
+
logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9476
9494
|
this.client.unmute(sipSession);
|
|
9477
9495
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9478
9496
|
|
|
@@ -9499,7 +9517,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9499
9517
|
if (!sipSession) {
|
|
9500
9518
|
return;
|
|
9501
9519
|
}
|
|
9502
|
-
logger$
|
|
9520
|
+
logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9503
9521
|
|
|
9504
9522
|
this.client.toggleCameraOn(sipSession);
|
|
9505
9523
|
|
|
@@ -9511,7 +9529,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9511
9529
|
if (!sipSession) {
|
|
9512
9530
|
return;
|
|
9513
9531
|
}
|
|
9514
|
-
logger$
|
|
9532
|
+
logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9515
9533
|
|
|
9516
9534
|
this.client.toggleCameraOff(sipSession);
|
|
9517
9535
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9523,7 +9541,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9523
9541
|
return;
|
|
9524
9542
|
}
|
|
9525
9543
|
|
|
9526
|
-
logger$
|
|
9544
|
+
logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9527
9545
|
this.client.sendDTMF(sipSession, tone);
|
|
9528
9546
|
}
|
|
9529
9547
|
|
|
@@ -9531,7 +9549,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9531
9549
|
// @TODO: line is not used here
|
|
9532
9550
|
async makeCall(number , line , cameraEnabled ,
|
|
9533
9551
|
audioOnly = false, conference = false) {
|
|
9534
|
-
logger$
|
|
9552
|
+
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9535
9553
|
if (!number) {
|
|
9536
9554
|
return Promise.resolve(null);
|
|
9537
9555
|
}
|
|
@@ -9541,7 +9559,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9541
9559
|
}
|
|
9542
9560
|
if (this.currentSipSession) {
|
|
9543
9561
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9544
|
-
logger$
|
|
9562
|
+
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9545
9563
|
});
|
|
9546
9564
|
}
|
|
9547
9565
|
|
|
@@ -9551,7 +9569,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9551
9569
|
this._bindEvents(sipSession);
|
|
9552
9570
|
} catch (error) {
|
|
9553
9571
|
console.warn(error);
|
|
9554
|
-
logger$
|
|
9572
|
+
logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9555
9573
|
return Promise.resolve(null);
|
|
9556
9574
|
}
|
|
9557
9575
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9579,7 +9597,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9579
9597
|
return;
|
|
9580
9598
|
}
|
|
9581
9599
|
|
|
9582
|
-
logger$
|
|
9600
|
+
logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9583
9601
|
|
|
9584
9602
|
this.client.transfer(sipSession, target);
|
|
9585
9603
|
}
|
|
@@ -9588,7 +9606,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9588
9606
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9589
9607
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9590
9608
|
|
|
9591
|
-
logger$
|
|
9609
|
+
logger$8.info('WebRTC indirect transfer', {
|
|
9592
9610
|
sipId: sipSession ? sipSession.id : null,
|
|
9593
9611
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9594
9612
|
});
|
|
@@ -9627,7 +9645,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9627
9645
|
return false;
|
|
9628
9646
|
}
|
|
9629
9647
|
|
|
9630
|
-
logger$
|
|
9648
|
+
logger$8.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9631
9649
|
|
|
9632
9650
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9633
9651
|
|
|
@@ -9673,7 +9691,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9673
9691
|
endCurrentCall(callSession ) {
|
|
9674
9692
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9675
9693
|
|
|
9676
|
-
logger$
|
|
9694
|
+
logger$8.info('Ending current call', {
|
|
9677
9695
|
id: callSession ? callSession.getId() : null,
|
|
9678
9696
|
isCurrent,
|
|
9679
9697
|
});
|
|
@@ -9697,7 +9715,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9697
9715
|
}
|
|
9698
9716
|
|
|
9699
9717
|
async close() {
|
|
9700
|
-
logger$
|
|
9718
|
+
logger$8.info('WebRTC close');
|
|
9701
9719
|
|
|
9702
9720
|
try {
|
|
9703
9721
|
await Promise.race([
|
|
@@ -9705,7 +9723,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9705
9723
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9706
9724
|
]);
|
|
9707
9725
|
} catch (e) {
|
|
9708
|
-
logger$
|
|
9726
|
+
logger$8.error('WebRTC close, unregister error', e);
|
|
9709
9727
|
}
|
|
9710
9728
|
|
|
9711
9729
|
this.client.close();
|
|
@@ -9723,12 +9741,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9723
9741
|
}
|
|
9724
9742
|
|
|
9725
9743
|
enableRinging() {
|
|
9726
|
-
logger$
|
|
9744
|
+
logger$8.info('WebRTC enable ringing');
|
|
9727
9745
|
this.ringingEnabled = true;
|
|
9728
9746
|
}
|
|
9729
9747
|
|
|
9730
9748
|
disableRinging() {
|
|
9731
|
-
logger$
|
|
9749
|
+
logger$8.info('WebRTC disable ringing');
|
|
9732
9750
|
this.ringingEnabled = false;
|
|
9733
9751
|
}
|
|
9734
9752
|
|
|
@@ -9768,7 +9786,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9768
9786
|
|
|
9769
9787
|
// Deprecated
|
|
9770
9788
|
getLocalMediaStream(callSession ) {
|
|
9771
|
-
logger$
|
|
9789
|
+
logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9772
9790
|
return this.getLocalStream(callSession);
|
|
9773
9791
|
}
|
|
9774
9792
|
|
|
@@ -9810,7 +9828,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9810
9828
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
9811
9829
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
9812
9830
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
9813
|
-
logger$
|
|
9831
|
+
logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
9814
9832
|
|
|
9815
9833
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
9816
9834
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -9833,7 +9851,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9833
9851
|
});
|
|
9834
9852
|
|
|
9835
9853
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
9836
|
-
logger$
|
|
9854
|
+
logger$8.info('WebRTC on reinvite', {
|
|
9837
9855
|
sessionId: args[0].id,
|
|
9838
9856
|
inviteId: args[1].id,
|
|
9839
9857
|
updatedCalleeName: args[2],
|
|
@@ -9853,7 +9871,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9853
9871
|
});
|
|
9854
9872
|
|
|
9855
9873
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9856
|
-
logger$
|
|
9874
|
+
logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
9857
9875
|
|
|
9858
9876
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
9859
9877
|
|
|
@@ -9864,22 +9882,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9864
9882
|
this.client.on('ended', () => {});
|
|
9865
9883
|
|
|
9866
9884
|
this.client.on(this.client.ON_ERROR, e => {
|
|
9867
|
-
logger$
|
|
9885
|
+
logger$8.error('WebRTC error', e);
|
|
9868
9886
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9869
9887
|
});
|
|
9870
9888
|
|
|
9871
9889
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9872
|
-
logger$
|
|
9890
|
+
logger$8.info('WebRTC unregistered');
|
|
9873
9891
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9874
9892
|
});
|
|
9875
9893
|
|
|
9876
9894
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9877
|
-
logger$
|
|
9878
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
9895
|
+
logger$8.info('WebRTC disconnected');
|
|
9896
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9879
9897
|
});
|
|
9880
9898
|
|
|
9881
9899
|
this.client.on(this.client.REGISTERED, () => {
|
|
9882
|
-
logger$
|
|
9900
|
+
logger$8.info('WebRTC registered', {
|
|
9883
9901
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
9884
9902
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
9885
9903
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -9900,19 +9918,19 @@ class WebRTCPhone extends Emitter {
|
|
|
9900
9918
|
// Send reinvite with iceRestart
|
|
9901
9919
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9902
9920
|
} catch (e) {
|
|
9903
|
-
logger$
|
|
9921
|
+
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9904
9922
|
}
|
|
9905
9923
|
}
|
|
9906
9924
|
});
|
|
9907
9925
|
|
|
9908
9926
|
this.client.on(this.client.CONNECTED, () => {
|
|
9909
|
-
logger$
|
|
9927
|
+
logger$8.info('WebRTC client connected');
|
|
9910
9928
|
|
|
9911
9929
|
this.stopHeartbeat();
|
|
9912
9930
|
});
|
|
9913
9931
|
|
|
9914
9932
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
9915
|
-
logger$
|
|
9933
|
+
logger$8.info('WebRTC client disconnected');
|
|
9916
9934
|
|
|
9917
9935
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9918
9936
|
|
|
@@ -9926,7 +9944,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9926
9944
|
});
|
|
9927
9945
|
|
|
9928
9946
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
9929
|
-
this.eventEmitter.emit(ON_TRACK
|
|
9947
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
9930
9948
|
});
|
|
9931
9949
|
|
|
9932
9950
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -9941,7 +9959,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9941
9959
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
9942
9960
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
9943
9961
|
|
|
9944
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
9962
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
9945
9963
|
});
|
|
9946
9964
|
|
|
9947
9965
|
// Used when upgrading directly in screenshare mode
|
|
@@ -9950,7 +9968,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9950
9968
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
9951
9969
|
const callSession = this.callSessions[sipSessionId];
|
|
9952
9970
|
|
|
9953
|
-
logger$
|
|
9971
|
+
logger$8.info('Updrading directly in screensharing mode', {
|
|
9954
9972
|
sipSessionId,
|
|
9955
9973
|
tracks: localStream ? localStream.getTracks() : null,
|
|
9956
9974
|
});
|
|
@@ -10128,8 +10146,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10128
10146
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10129
10147
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10130
10148
|
ON_MESSAGE: ON_MESSAGE,
|
|
10131
|
-
ON_REINVITE: ON_REINVITE
|
|
10132
|
-
ON_TRACK: ON_TRACK
|
|
10149
|
+
ON_REINVITE: ON_REINVITE,
|
|
10150
|
+
ON_TRACK: ON_TRACK,
|
|
10133
10151
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10134
10152
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10135
10153
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10144,19 +10162,19 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10144
10162
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10145
10163
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10146
10164
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10147
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10165
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10148
10166
|
ON_CHAT: ON_CHAT,
|
|
10149
10167
|
ON_SIGNAL: ON_SIGNAL,
|
|
10150
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10168
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10151
10169
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10152
10170
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10153
|
-
events: events
|
|
10171
|
+
events: events,
|
|
10154
10172
|
'default': WebRTCPhone
|
|
10155
10173
|
});
|
|
10156
10174
|
|
|
10157
10175
|
//
|
|
10158
10176
|
|
|
10159
|
-
const logger$
|
|
10177
|
+
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
10160
10178
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
10161
10179
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
10162
10180
|
|
|
@@ -10263,7 +10281,7 @@ class Phone extends Emitter {
|
|
|
10263
10281
|
async disconnect() {
|
|
10264
10282
|
if (this.phone) {
|
|
10265
10283
|
if (this.phone.hasAnActiveCall()) {
|
|
10266
|
-
logger$
|
|
10284
|
+
logger$7.info('hangup call on disconnect');
|
|
10267
10285
|
// $FlowFixMe
|
|
10268
10286
|
await this.phone.hangup();
|
|
10269
10287
|
}
|
|
@@ -10286,13 +10304,13 @@ class Phone extends Emitter {
|
|
|
10286
10304
|
}
|
|
10287
10305
|
|
|
10288
10306
|
async hangup(callSession ) {
|
|
10289
|
-
logger$
|
|
10307
|
+
logger$7.info('hangup via simple phone', { callId: callSession.getId() });
|
|
10290
10308
|
|
|
10291
10309
|
return this.phone && this.phone.hangup(callSession);
|
|
10292
10310
|
}
|
|
10293
10311
|
|
|
10294
10312
|
async accept(callSession , cameraEnabled ) {
|
|
10295
|
-
logger$
|
|
10313
|
+
logger$7.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
10296
10314
|
|
|
10297
10315
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
10298
10316
|
}
|
|
@@ -10331,7 +10349,7 @@ class Phone extends Emitter {
|
|
|
10331
10349
|
muteViaAPI(callSession ) {
|
|
10332
10350
|
if (callSession && callSession.callId) {
|
|
10333
10351
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
10334
|
-
logger$
|
|
10352
|
+
logger$7.error('Mute via API, error', e);
|
|
10335
10353
|
});
|
|
10336
10354
|
}
|
|
10337
10355
|
}
|
|
@@ -10339,7 +10357,7 @@ class Phone extends Emitter {
|
|
|
10339
10357
|
unmuteViaAPI(callSession ) {
|
|
10340
10358
|
if (callSession && callSession.callId) {
|
|
10341
10359
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
10342
|
-
logger$
|
|
10360
|
+
logger$7.error('Unmute via API, error', e);
|
|
10343
10361
|
});
|
|
10344
10362
|
}
|
|
10345
10363
|
}
|
|
@@ -10447,7 +10465,7 @@ class Phone extends Emitter {
|
|
|
10447
10465
|
|
|
10448
10466
|
// @Deprecated
|
|
10449
10467
|
getLocalMediaStream(callSession ) {
|
|
10450
|
-
logger$
|
|
10468
|
+
logger$7.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
10451
10469
|
|
|
10452
10470
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
10453
10471
|
}
|
|
@@ -10470,20 +10488,20 @@ class Phone extends Emitter {
|
|
|
10470
10488
|
|
|
10471
10489
|
// @Deprecated
|
|
10472
10490
|
getRemoteStreamForCall(callSession ) {
|
|
10473
|
-
logger$
|
|
10491
|
+
logger$7.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
10474
10492
|
return this.getRemoteStream(callSession);
|
|
10475
10493
|
}
|
|
10476
10494
|
|
|
10477
10495
|
// Returns remote streams directly from the peerConnection
|
|
10478
10496
|
// @Deprecated
|
|
10479
10497
|
getRemoteStreamsForCall(callSession ) {
|
|
10480
|
-
logger$
|
|
10498
|
+
logger$7.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
10481
10499
|
return this.getLocalStream(callSession);
|
|
10482
10500
|
}
|
|
10483
10501
|
|
|
10484
10502
|
// @Deprecated
|
|
10485
10503
|
getRemoteVideoStreamForCall(callSession ) {
|
|
10486
|
-
logger$
|
|
10504
|
+
logger$7.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
10487
10505
|
|
|
10488
10506
|
return this.getRemoteVideoStream(callSession);
|
|
10489
10507
|
}
|
|
@@ -10544,7 +10562,7 @@ class Phone extends Emitter {
|
|
|
10544
10562
|
|
|
10545
10563
|
_transferEvents() {
|
|
10546
10564
|
this.unbind();
|
|
10547
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10565
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10548
10566
|
this.client.on(event, (...args) =>
|
|
10549
10567
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10550
10568
|
});
|
|
@@ -10566,7 +10584,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10566
10584
|
|
|
10567
10585
|
//
|
|
10568
10586
|
|
|
10569
|
-
const SOCKET_EVENTS = {
|
|
10587
|
+
const SOCKET_EVENTS$1 = {
|
|
10570
10588
|
ON_OPEN: 'onopen',
|
|
10571
10589
|
ON_MESSAGE: 'onmessage',
|
|
10572
10590
|
ON_ERROR: 'onerror',
|
|
@@ -10719,16 +10737,16 @@ class WebSocketClient extends Emitter {
|
|
|
10719
10737
|
|
|
10720
10738
|
this.socket.onopen = () => {
|
|
10721
10739
|
logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10722
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10740
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10723
10741
|
};
|
|
10724
10742
|
|
|
10725
10743
|
this.socket.onerror = event => {
|
|
10726
10744
|
logger$6.error('on Wazo WS error', event.target);
|
|
10727
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10745
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
10728
10746
|
};
|
|
10729
10747
|
|
|
10730
10748
|
this.socket.onmessage = (event ) => {
|
|
10731
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10749
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
10732
10750
|
|
|
10733
10751
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10734
10752
|
let { name } = message;
|
|
@@ -10761,11 +10779,11 @@ class WebSocketClient extends Emitter {
|
|
|
10761
10779
|
token: this.token,
|
|
10762
10780
|
});
|
|
10763
10781
|
this.initialized = false;
|
|
10764
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
10782
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
10765
10783
|
|
|
10766
10784
|
switch (event.code) {
|
|
10767
10785
|
case 4002:
|
|
10768
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
10786
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
10769
10787
|
break;
|
|
10770
10788
|
}
|
|
10771
10789
|
};
|
|
@@ -10881,7 +10899,7 @@ class WebSocketClient extends Emitter {
|
|
|
10881
10899
|
break;
|
|
10882
10900
|
case 'start':
|
|
10883
10901
|
this.initialized = true;
|
|
10884
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
10902
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
10885
10903
|
break;
|
|
10886
10904
|
default:
|
|
10887
10905
|
this.eventEmitter.emit('message', message);
|
|
@@ -10928,7 +10946,7 @@ class WebSocketClient extends Emitter {
|
|
|
10928
10946
|
logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
10929
10947
|
|
|
10930
10948
|
this.close();
|
|
10931
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10949
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10932
10950
|
|
|
10933
10951
|
if (this.onHeartBeatTimeout) {
|
|
10934
10952
|
this.onHeartBeatTimeout();
|
|
@@ -11008,7 +11026,7 @@ WebSocketClient.eventLists = [
|
|
|
11008
11026
|
|
|
11009
11027
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11010
11028
|
__proto__: null,
|
|
11011
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11029
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11012
11030
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11013
11031
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11014
11032
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11081,10 +11099,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11081
11099
|
|
|
11082
11100
|
//
|
|
11083
11101
|
|
|
11084
|
-
const { SOCKET_EVENTS
|
|
11085
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11102
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11103
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11086
11104
|
|
|
11087
|
-
const logger$
|
|
11105
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11088
11106
|
|
|
11089
11107
|
class Websocket extends Emitter {
|
|
11090
11108
|
|
|
@@ -11098,9 +11116,9 @@ class Websocket extends Emitter {
|
|
|
11098
11116
|
// $FlowFixMe
|
|
11099
11117
|
this[key] = OTHER_EVENTS[key];
|
|
11100
11118
|
});
|
|
11101
|
-
Object.keys(SOCKET_EVENTS
|
|
11119
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11102
11120
|
// $FlowFixMe
|
|
11103
|
-
this[key] = SOCKET_EVENTS
|
|
11121
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11104
11122
|
});
|
|
11105
11123
|
this.eventLists = WebSocketClient.eventLists;
|
|
11106
11124
|
|
|
@@ -11108,7 +11126,7 @@ class Websocket extends Emitter {
|
|
|
11108
11126
|
}
|
|
11109
11127
|
|
|
11110
11128
|
open(host , session ) {
|
|
11111
|
-
logger$
|
|
11129
|
+
logger$5.info('open simple WebSocket', { host, token: session.token });
|
|
11112
11130
|
this.ws = new WebSocketClient(
|
|
11113
11131
|
{
|
|
11114
11132
|
host,
|
|
@@ -11136,7 +11154,7 @@ class Websocket extends Emitter {
|
|
|
11136
11154
|
}
|
|
11137
11155
|
|
|
11138
11156
|
updateToken(token ) {
|
|
11139
|
-
logger$
|
|
11157
|
+
logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11140
11158
|
|
|
11141
11159
|
if (!this.ws) {
|
|
11142
11160
|
return;
|
|
@@ -11164,7 +11182,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11164
11182
|
|
|
11165
11183
|
//
|
|
11166
11184
|
|
|
11167
|
-
const logger$
|
|
11185
|
+
const logger$4 = IssueReporter$1.loggerFor('room');
|
|
11168
11186
|
|
|
11169
11187
|
class Participant extends Emitter {
|
|
11170
11188
|
|
|
@@ -11286,7 +11304,7 @@ class Participant extends Emitter {
|
|
|
11286
11304
|
}
|
|
11287
11305
|
|
|
11288
11306
|
onTalking(isTalking ) {
|
|
11289
|
-
logger$
|
|
11307
|
+
logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11290
11308
|
this.isTalking = isTalking;
|
|
11291
11309
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11292
11310
|
// directly from asterisk, there's no need to do so
|
|
@@ -11389,7 +11407,7 @@ class Participant extends Emitter {
|
|
|
11389
11407
|
}
|
|
11390
11408
|
|
|
11391
11409
|
updateStatus(status , broadcast = true) {
|
|
11392
|
-
logger$
|
|
11410
|
+
logger$4.info('updating participant status', { name: this.name, status });
|
|
11393
11411
|
|
|
11394
11412
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11395
11413
|
if (status.audioMuted) {
|
|
@@ -11437,7 +11455,7 @@ class Participant extends Emitter {
|
|
|
11437
11455
|
|
|
11438
11456
|
broadcastStatus(inboundStatus = null) {
|
|
11439
11457
|
const status = inboundStatus || this.getStatus();
|
|
11440
|
-
logger$
|
|
11458
|
+
logger$4.info('broadcasting participant status', { callId: this.callId, status });
|
|
11441
11459
|
|
|
11442
11460
|
this.room.sendSignal({
|
|
11443
11461
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11473,9 +11491,9 @@ class LocalParticipant extends Participant {
|
|
|
11473
11491
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11474
11492
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11475
11493
|
|
|
11476
|
-
const logger$
|
|
11494
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-room');
|
|
11477
11495
|
|
|
11478
|
-
class Room extends Emitter {
|
|
11496
|
+
class Room$1 extends Emitter {
|
|
11479
11497
|
|
|
11480
11498
|
|
|
11481
11499
|
|
|
@@ -11533,7 +11551,7 @@ class Room extends Emitter {
|
|
|
11533
11551
|
extra = {},
|
|
11534
11552
|
) {
|
|
11535
11553
|
super();
|
|
11536
|
-
logger$
|
|
11554
|
+
logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11537
11555
|
|
|
11538
11556
|
// Represents the room callSession
|
|
11539
11557
|
this.callSession = callSession;
|
|
@@ -11599,7 +11617,7 @@ class Room extends Emitter {
|
|
|
11599
11617
|
* @returns {Promise<Room>}
|
|
11600
11618
|
*/
|
|
11601
11619
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11602
|
-
logger$
|
|
11620
|
+
logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11603
11621
|
|
|
11604
11622
|
if (!room) {
|
|
11605
11623
|
await Wazo.Phone.connect();
|
|
@@ -11612,7 +11630,7 @@ class Room extends Emitter {
|
|
|
11612
11630
|
|
|
11613
11631
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11614
11632
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11615
|
-
logger$
|
|
11633
|
+
logger$3.info('room call received via WS', { callId: data.call_id });
|
|
11616
11634
|
if (room) {
|
|
11617
11635
|
room.setCallId(data.call_id);
|
|
11618
11636
|
}
|
|
@@ -11620,7 +11638,7 @@ class Room extends Emitter {
|
|
|
11620
11638
|
|
|
11621
11639
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11622
11640
|
// eslint-disable-next-line no-param-reassign
|
|
11623
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11641
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11624
11642
|
|
|
11625
11643
|
// Wait for the call to be accepted
|
|
11626
11644
|
await new Promise((resolve, reject) => {
|
|
@@ -11641,7 +11659,7 @@ class Room extends Emitter {
|
|
|
11641
11659
|
// Retrieve conference
|
|
11642
11660
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11643
11661
|
|
|
11644
|
-
logger$
|
|
11662
|
+
logger$3.info('connected to room', {
|
|
11645
11663
|
sourceId: conference ? conference.sourceId : null,
|
|
11646
11664
|
name: conference ? conference.name : null,
|
|
11647
11665
|
});
|
|
@@ -11651,7 +11669,7 @@ class Room extends Emitter {
|
|
|
11651
11669
|
room.setName(conference.name);
|
|
11652
11670
|
}
|
|
11653
11671
|
} else if (meeting) {
|
|
11654
|
-
logger$
|
|
11672
|
+
logger$3.info('Already connected to meeting', {
|
|
11655
11673
|
uuid: meeting.uuid,
|
|
11656
11674
|
name: meeting.name,
|
|
11657
11675
|
});
|
|
@@ -11664,13 +11682,13 @@ class Room extends Emitter {
|
|
|
11664
11682
|
}
|
|
11665
11683
|
|
|
11666
11684
|
static disconnect() {
|
|
11667
|
-
logger$
|
|
11685
|
+
logger$3.info('static disconnection to room');
|
|
11668
11686
|
|
|
11669
11687
|
Wazo.Phone.disconnect();
|
|
11670
11688
|
}
|
|
11671
11689
|
|
|
11672
11690
|
async disconnect() {
|
|
11673
|
-
logger$
|
|
11691
|
+
logger$3.info('disconnection to room called');
|
|
11674
11692
|
|
|
11675
11693
|
await Wazo.Phone.hangup(this.callSession);
|
|
11676
11694
|
this.callSession = null;
|
|
@@ -11690,19 +11708,19 @@ class Room extends Emitter {
|
|
|
11690
11708
|
}
|
|
11691
11709
|
|
|
11692
11710
|
setSourceId(sourceId ) {
|
|
11693
|
-
logger$
|
|
11711
|
+
logger$3.info('set room source id', { sourceId });
|
|
11694
11712
|
|
|
11695
11713
|
this.sourceId = sourceId;
|
|
11696
11714
|
}
|
|
11697
11715
|
|
|
11698
11716
|
setMeetingUuid(meetingUuid ) {
|
|
11699
|
-
logger$
|
|
11717
|
+
logger$3.info('set meeting uuid', { meetingUuid });
|
|
11700
11718
|
|
|
11701
11719
|
this.meetingUuid = meetingUuid;
|
|
11702
11720
|
}
|
|
11703
11721
|
|
|
11704
11722
|
setCallId(callId ) {
|
|
11705
|
-
logger$
|
|
11723
|
+
logger$3.info('set room call id', { callId });
|
|
11706
11724
|
|
|
11707
11725
|
if (callId) {
|
|
11708
11726
|
this.callId = callId;
|
|
@@ -11710,7 +11728,7 @@ class Room extends Emitter {
|
|
|
11710
11728
|
}
|
|
11711
11729
|
|
|
11712
11730
|
setName(name ) {
|
|
11713
|
-
logger$
|
|
11731
|
+
logger$3.info('set room name', { name });
|
|
11714
11732
|
|
|
11715
11733
|
this.name = name;
|
|
11716
11734
|
}
|
|
@@ -11729,7 +11747,7 @@ class Room extends Emitter {
|
|
|
11729
11747
|
}
|
|
11730
11748
|
|
|
11731
11749
|
async startScreenSharing(constraints ) {
|
|
11732
|
-
logger$
|
|
11750
|
+
logger$3.info('start room screen sharing', { constraints });
|
|
11733
11751
|
|
|
11734
11752
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11735
11753
|
if (!screensharingStream) {
|
|
@@ -11743,7 +11761,7 @@ class Room extends Emitter {
|
|
|
11743
11761
|
}
|
|
11744
11762
|
|
|
11745
11763
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11746
|
-
logger$
|
|
11764
|
+
logger$3.info('stop room screen sharing');
|
|
11747
11765
|
|
|
11748
11766
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11749
11767
|
|
|
@@ -11755,7 +11773,7 @@ class Room extends Emitter {
|
|
|
11755
11773
|
}
|
|
11756
11774
|
|
|
11757
11775
|
turnCameraOff() {
|
|
11758
|
-
logger$
|
|
11776
|
+
logger$3.info('turn room camera off');
|
|
11759
11777
|
|
|
11760
11778
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
11761
11779
|
|
|
@@ -11765,7 +11783,7 @@ class Room extends Emitter {
|
|
|
11765
11783
|
}
|
|
11766
11784
|
|
|
11767
11785
|
turnCameraOn() {
|
|
11768
|
-
logger$
|
|
11786
|
+
logger$3.info('turn room camera on');
|
|
11769
11787
|
|
|
11770
11788
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
11771
11789
|
|
|
@@ -11775,7 +11793,7 @@ class Room extends Emitter {
|
|
|
11775
11793
|
}
|
|
11776
11794
|
|
|
11777
11795
|
mute() {
|
|
11778
|
-
logger$
|
|
11796
|
+
logger$3.info('mute room');
|
|
11779
11797
|
|
|
11780
11798
|
Wazo.Phone.mute(this.callSession);
|
|
11781
11799
|
|
|
@@ -11783,7 +11801,7 @@ class Room extends Emitter {
|
|
|
11783
11801
|
}
|
|
11784
11802
|
|
|
11785
11803
|
unmute() {
|
|
11786
|
-
logger$
|
|
11804
|
+
logger$3.info('unmute room');
|
|
11787
11805
|
|
|
11788
11806
|
Wazo.Phone.unmute(this.callSession);
|
|
11789
11807
|
|
|
@@ -11803,7 +11821,7 @@ class Room extends Emitter {
|
|
|
11803
11821
|
}
|
|
11804
11822
|
|
|
11805
11823
|
hold() {
|
|
11806
|
-
logger$
|
|
11824
|
+
logger$3.info('hold room');
|
|
11807
11825
|
|
|
11808
11826
|
Wazo.Phone.hold(this.callSession, true);
|
|
11809
11827
|
|
|
@@ -11813,7 +11831,7 @@ class Room extends Emitter {
|
|
|
11813
11831
|
}
|
|
11814
11832
|
|
|
11815
11833
|
async resume() {
|
|
11816
|
-
logger$
|
|
11834
|
+
logger$3.info('resume room');
|
|
11817
11835
|
|
|
11818
11836
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
11819
11837
|
|
|
@@ -11841,13 +11859,13 @@ class Room extends Emitter {
|
|
|
11841
11859
|
}
|
|
11842
11860
|
|
|
11843
11861
|
sendDTMF(tone ) {
|
|
11844
|
-
logger$
|
|
11862
|
+
logger$3.info('send room DTMF', { tone });
|
|
11845
11863
|
|
|
11846
11864
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
11847
11865
|
}
|
|
11848
11866
|
|
|
11849
11867
|
async sendReinvite(newConstraints = null) {
|
|
11850
|
-
logger$
|
|
11868
|
+
logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
11851
11869
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
11852
11870
|
|
|
11853
11871
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -11906,7 +11924,7 @@ class Room extends Emitter {
|
|
|
11906
11924
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
11907
11925
|
|
|
11908
11926
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
11909
|
-
logger$
|
|
11927
|
+
logger$3.info('on room audio stream');
|
|
11910
11928
|
|
|
11911
11929
|
this.audioStream = stream;
|
|
11912
11930
|
if (!this.roomAudioElement) {
|
|
@@ -11919,7 +11937,7 @@ class Room extends Emitter {
|
|
|
11919
11937
|
});
|
|
11920
11938
|
|
|
11921
11939
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
11922
|
-
logger$
|
|
11940
|
+
logger$3.info('on room video stream', { streamId });
|
|
11923
11941
|
|
|
11924
11942
|
this._mapMsid(sipSession.body.body);
|
|
11925
11943
|
|
|
@@ -11934,7 +11952,7 @@ class Room extends Emitter {
|
|
|
11934
11952
|
});
|
|
11935
11953
|
|
|
11936
11954
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
11937
|
-
logger$
|
|
11955
|
+
logger$3.info('on room remove stream');
|
|
11938
11956
|
|
|
11939
11957
|
const participant = this.participants.find(someParticipant =>
|
|
11940
11958
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12066,7 +12084,7 @@ class Room extends Emitter {
|
|
|
12066
12084
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12067
12085
|
if (requester) {
|
|
12068
12086
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12069
|
-
logger$
|
|
12087
|
+
logger$3.info('trigger room requester status', { origin });
|
|
12070
12088
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12071
12089
|
}
|
|
12072
12090
|
break;
|
|
@@ -12097,24 +12115,24 @@ class Room extends Emitter {
|
|
|
12097
12115
|
|
|
12098
12116
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12099
12117
|
if (participant.user_uuid === session.uuid) {
|
|
12100
|
-
logger$
|
|
12118
|
+
logger$3.info('room current user joined');
|
|
12101
12119
|
|
|
12102
12120
|
// Retrieve participants via an API calls
|
|
12103
12121
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12104
12122
|
let response;
|
|
12105
12123
|
try {
|
|
12106
12124
|
if (this.meetingUuid) {
|
|
12107
|
-
logger$
|
|
12125
|
+
logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12108
12126
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12109
12127
|
} else {
|
|
12110
|
-
logger$
|
|
12128
|
+
logger$3.info('fetching conference participants', { conferenceId });
|
|
12111
12129
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12112
12130
|
}
|
|
12113
12131
|
} catch (e) {
|
|
12114
|
-
logger$
|
|
12132
|
+
logger$3.error('room participants fetching, error', e);
|
|
12115
12133
|
}
|
|
12116
12134
|
if (response) {
|
|
12117
|
-
logger$
|
|
12135
|
+
logger$3.info('conference participants fetched', { nb: response.items.length });
|
|
12118
12136
|
participants = response.items.map(item => {
|
|
12119
12137
|
const isMe = item.call_id === this.callId;
|
|
12120
12138
|
|
|
@@ -12141,7 +12159,7 @@ class Room extends Emitter {
|
|
|
12141
12159
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12142
12160
|
: null;
|
|
12143
12161
|
|
|
12144
|
-
logger$
|
|
12162
|
+
logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12145
12163
|
|
|
12146
12164
|
if (remoteParticipant) {
|
|
12147
12165
|
this.participants.push(remoteParticipant);
|
|
@@ -12306,12 +12324,12 @@ class Room extends Emitter {
|
|
|
12306
12324
|
|
|
12307
12325
|
//
|
|
12308
12326
|
|
|
12309
|
-
const logger$
|
|
12327
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12310
12328
|
|
|
12311
|
-
class SipRoom extends Room {
|
|
12329
|
+
class SipRoom extends Room$1 {
|
|
12312
12330
|
|
|
12313
12331
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12314
|
-
logger$
|
|
12332
|
+
logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12315
12333
|
|
|
12316
12334
|
if (!room) {
|
|
12317
12335
|
await Wazo.Phone.connect();
|
|
@@ -12327,7 +12345,7 @@ class SipRoom extends Room {
|
|
|
12327
12345
|
room.setCallId(room.callSession.call.id);
|
|
12328
12346
|
}
|
|
12329
12347
|
|
|
12330
|
-
logger$
|
|
12348
|
+
logger$2.info('connected to room', {
|
|
12331
12349
|
extension: room.extension,
|
|
12332
12350
|
});
|
|
12333
12351
|
|
|
@@ -12335,7 +12353,7 @@ class SipRoom extends Room {
|
|
|
12335
12353
|
}
|
|
12336
12354
|
|
|
12337
12355
|
mute() {
|
|
12338
|
-
logger$
|
|
12356
|
+
logger$2.info('mute sip room');
|
|
12339
12357
|
|
|
12340
12358
|
Wazo.Phone.mute(this.callSession, false);
|
|
12341
12359
|
|
|
@@ -12343,7 +12361,7 @@ class SipRoom extends Room {
|
|
|
12343
12361
|
}
|
|
12344
12362
|
|
|
12345
12363
|
unmute() {
|
|
12346
|
-
logger$
|
|
12364
|
+
logger$2.info('unmute sip room');
|
|
12347
12365
|
|
|
12348
12366
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12349
12367
|
|
|
@@ -12627,7 +12645,7 @@ class NotificationOptions {
|
|
|
12627
12645
|
|
|
12628
12646
|
|
|
12629
12647
|
// Represents a conference room, like `9000`.
|
|
12630
|
-
class Room
|
|
12648
|
+
class Room {
|
|
12631
12649
|
|
|
12632
12650
|
|
|
12633
12651
|
|
|
@@ -12648,7 +12666,7 @@ class Room$1 {
|
|
|
12648
12666
|
}
|
|
12649
12667
|
|
|
12650
12668
|
connect(callSession ) {
|
|
12651
|
-
return new Room
|
|
12669
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12652
12670
|
}
|
|
12653
12671
|
|
|
12654
12672
|
has(callSession ) {
|
|
@@ -12657,7 +12675,7 @@ class Room$1 {
|
|
|
12657
12675
|
|
|
12658
12676
|
addParticipant(uuid , extension , talking = null) {
|
|
12659
12677
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12660
|
-
return new Room
|
|
12678
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12661
12679
|
}
|
|
12662
12680
|
|
|
12663
12681
|
return this;
|
|
@@ -12676,7 +12694,7 @@ class Room$1 {
|
|
|
12676
12694
|
updatedParticipants.push(participant);
|
|
12677
12695
|
}
|
|
12678
12696
|
|
|
12679
|
-
return new Room
|
|
12697
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12680
12698
|
}
|
|
12681
12699
|
|
|
12682
12700
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12692,7 +12710,7 @@ class Room$1 {
|
|
|
12692
12710
|
updatedParticipants.push(participant);
|
|
12693
12711
|
}
|
|
12694
12712
|
|
|
12695
|
-
return new Room
|
|
12713
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12696
12714
|
}
|
|
12697
12715
|
|
|
12698
12716
|
hasCallWithId(id ) {
|
|
@@ -12700,18 +12718,18 @@ class Room$1 {
|
|
|
12700
12718
|
}
|
|
12701
12719
|
|
|
12702
12720
|
disconnect() {
|
|
12703
|
-
return new Room
|
|
12721
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12704
12722
|
}
|
|
12705
12723
|
|
|
12706
12724
|
removeParticipantWithUUID(uuid ) {
|
|
12707
|
-
return new Room
|
|
12725
|
+
return new Room({
|
|
12708
12726
|
...this,
|
|
12709
12727
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12710
12728
|
});
|
|
12711
12729
|
}
|
|
12712
12730
|
|
|
12713
12731
|
removeParticipantWithExtension(extension ) {
|
|
12714
|
-
return new Room
|
|
12732
|
+
return new Room({
|
|
12715
12733
|
...this,
|
|
12716
12734
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12717
12735
|
});
|
|
@@ -12722,7 +12740,7 @@ class Room$1 {
|
|
|
12722
12740
|
}
|
|
12723
12741
|
|
|
12724
12742
|
static newFrom(room ) {
|
|
12725
|
-
return newFrom(room, Room
|
|
12743
|
+
return newFrom(room, Room);
|
|
12726
12744
|
}
|
|
12727
12745
|
}
|
|
12728
12746
|
|
|
@@ -13029,11 +13047,11 @@ var wazoWebsocket = {
|
|
|
13029
13047
|
resolve();
|
|
13030
13048
|
};
|
|
13031
13049
|
|
|
13032
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13050
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
13033
13051
|
handleError(`Connection error : ${error}`);
|
|
13034
13052
|
});
|
|
13035
13053
|
|
|
13036
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13054
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
13037
13055
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13038
13056
|
client.setOnHeartbeatTimeout(() => {
|
|
13039
13057
|
handleError('No response to heartbeat');
|
|
@@ -13134,7 +13152,7 @@ var webrtc = {
|
|
|
13134
13152
|
}),
|
|
13135
13153
|
};
|
|
13136
13154
|
|
|
13137
|
-
const parseCandidate
|
|
13155
|
+
const parseCandidate = line => {
|
|
13138
13156
|
let parts;
|
|
13139
13157
|
// Parse both variants.
|
|
13140
13158
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13225,7 +13243,7 @@ var SymmetricNat = {
|
|
|
13225
13243
|
}
|
|
13226
13244
|
|
|
13227
13245
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13228
|
-
const cand = parseCandidate
|
|
13246
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13229
13247
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13230
13248
|
candidates[cand.relatedPort].push(cand.port);
|
|
13231
13249
|
} else if (!e.candidate) {
|
|
@@ -13293,7 +13311,7 @@ var iceIpv4 = {
|
|
|
13293
13311
|
const rawCandidate = e.candidate.candidate;
|
|
13294
13312
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13295
13313
|
hasSrflxOrRelay = true;
|
|
13296
|
-
const candidate = parseCandidate
|
|
13314
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13297
13315
|
ips.push(candidate.ip);
|
|
13298
13316
|
}
|
|
13299
13317
|
} else if (!e.candidate) {
|
|
@@ -13330,7 +13348,7 @@ var checks = [
|
|
|
13330
13348
|
|
|
13331
13349
|
//
|
|
13332
13350
|
|
|
13333
|
-
const logger$
|
|
13351
|
+
const logger$1 = IssueReporter$1.loggerFor('engine-check');
|
|
13334
13352
|
|
|
13335
13353
|
class Checker {
|
|
13336
13354
|
|
|
@@ -13348,28 +13366,28 @@ class Checker {
|
|
|
13348
13366
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13349
13367
|
await this._addEngineVersion();
|
|
13350
13368
|
|
|
13351
|
-
logger$
|
|
13369
|
+
logger$1.info('Engine check starting');
|
|
13352
13370
|
|
|
13353
13371
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13354
13372
|
const { name, check } = this.checks[i];
|
|
13355
13373
|
|
|
13356
|
-
logger$
|
|
13374
|
+
logger$1.info(`Checking ${name} ...`);
|
|
13357
13375
|
|
|
13358
13376
|
onCheckBegin(name);
|
|
13359
13377
|
try {
|
|
13360
13378
|
// eslint-disable-next-line no-await-in-loop
|
|
13361
13379
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13362
|
-
logger$
|
|
13380
|
+
logger$1.info(`Checking ${name} success.`, { result });
|
|
13363
13381
|
|
|
13364
13382
|
onCheckResult(name, result);
|
|
13365
13383
|
} catch (e) {
|
|
13366
|
-
logger$
|
|
13384
|
+
logger$1.info(`Checking ${name} failure`, { message: e.message });
|
|
13367
13385
|
|
|
13368
13386
|
onCheckResult(name, e);
|
|
13369
13387
|
}
|
|
13370
13388
|
}
|
|
13371
13389
|
|
|
13372
|
-
logger$
|
|
13390
|
+
logger$1.info('Engine check done.');
|
|
13373
13391
|
}
|
|
13374
13392
|
|
|
13375
13393
|
addCheck(check ) {
|
|
@@ -13393,7 +13411,7 @@ const Wazo = {
|
|
|
13393
13411
|
Auth: Auth$1,
|
|
13394
13412
|
Phone: Phone$1,
|
|
13395
13413
|
Websocket: Websocket$1,
|
|
13396
|
-
Room,
|
|
13414
|
+
Room: Room$1,
|
|
13397
13415
|
SipRoom,
|
|
13398
13416
|
RemoteParticipant,
|
|
13399
13417
|
LocalParticipant,
|
|
@@ -13426,7 +13444,7 @@ const Wazo = {
|
|
|
13426
13444
|
Session,
|
|
13427
13445
|
Voicemail,
|
|
13428
13446
|
Relocation,
|
|
13429
|
-
ConferenceRoom: Room
|
|
13447
|
+
ConferenceRoom: Room,
|
|
13430
13448
|
CallSession,
|
|
13431
13449
|
IndirectTransfer,
|
|
13432
13450
|
SwitchboardCall,
|
|
@@ -13465,7 +13483,7 @@ if (global) {
|
|
|
13465
13483
|
class InvalidSubscription extends Error {}
|
|
13466
13484
|
class InvalidAuthorization extends Error {}
|
|
13467
13485
|
|
|
13468
|
-
const logger
|
|
13486
|
+
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13469
13487
|
|
|
13470
13488
|
class Auth {
|
|
13471
13489
|
|
|
@@ -13500,7 +13518,7 @@ class Auth {
|
|
|
13500
13518
|
setApiClientId(this.clientId);
|
|
13501
13519
|
setRefreshExpiration(this.expiration);
|
|
13502
13520
|
setOnRefreshToken((token , session ) => {
|
|
13503
|
-
logger
|
|
13521
|
+
logger.info('on refresh token done', { token });
|
|
13504
13522
|
setApiToken(token);
|
|
13505
13523
|
Wazo.Websocket.updateToken(token);
|
|
13506
13524
|
|
|
@@ -13545,7 +13563,7 @@ class Auth {
|
|
|
13545
13563
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
13546
13564
|
return this._onAuthenticated(rawSession);
|
|
13547
13565
|
} catch (e) {
|
|
13548
|
-
logger
|
|
13566
|
+
logger.error('on validate token error', e);
|
|
13549
13567
|
console.warn(e);
|
|
13550
13568
|
return false;
|
|
13551
13569
|
}
|