@signalwire/js 1.3.0-dev.1 → 1.3.0
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/README.md +4 -2
- package/dist/esm/common/src/BaseSession.d.ts +8 -13
- package/dist/esm/common/src/BaseSession.js +33 -46
- package/dist/esm/common/src/BrowserSession.d.ts +20 -57
- package/dist/esm/common/src/BrowserSession.js +91 -359
- package/dist/esm/common/src/messages/Verto.d.ts +1 -10
- package/dist/esm/common/src/messages/Verto.js +1 -16
- package/dist/esm/common/src/messages/verto/Login.d.ts +1 -13
- package/dist/esm/common/src/messages/verto/Login.js +2 -5
- package/dist/esm/common/src/services/BroadcastHandler.js +3 -2
- package/dist/esm/common/src/services/Handler.d.ts +8 -9
- package/dist/esm/common/src/services/Handler.js +38 -41
- package/dist/esm/common/src/util/constants/index.d.ts +0 -1
- package/dist/esm/common/src/util/constants/index.js +0 -1
- package/dist/esm/common/src/util/helpers.d.ts +9 -2
- package/dist/esm/common/src/util/helpers.js +11 -6
- package/dist/esm/common/src/util/interfaces.d.ts +55 -20
- package/dist/esm/common/src/util/logger.js +1 -4
- package/dist/esm/common/src/util/webrtc/index.d.ts +1 -6
- package/dist/esm/common/src/util/webrtc/index.js +2 -63
- package/dist/esm/common/src/webrtc/BaseCall.d.ts +76 -0
- package/dist/esm/common/src/webrtc/BaseCall.js +701 -0
- package/dist/esm/common/src/webrtc/Call.d.ts +5 -5
- package/dist/esm/common/src/webrtc/Call.js +15 -34
- package/dist/esm/common/src/webrtc/CantinaAuth.d.ts +13 -8
- package/dist/esm/common/src/webrtc/CantinaAuth.js +18 -24
- package/dist/esm/common/src/webrtc/LayoutHandler.d.ts +3 -0
- package/dist/esm/common/src/webrtc/LayoutHandler.js +36 -0
- package/dist/esm/common/src/webrtc/Peer.d.ts +21 -0
- package/dist/esm/common/src/webrtc/Peer.js +145 -0
- package/dist/esm/common/src/webrtc/VertoHandler.d.ts +11 -2
- package/dist/esm/common/src/webrtc/VertoHandler.js +187 -147
- package/dist/esm/common/src/webrtc/constants.d.ts +12 -28
- package/dist/esm/common/src/webrtc/constants.js +11 -34
- package/dist/esm/common/src/webrtc/helpers.d.ts +20 -18
- package/dist/esm/common/src/webrtc/helpers.js +177 -162
- package/dist/esm/common/src/webrtc/interfaces.d.ts +51 -209
- package/dist/esm/js/index.d.ts +1 -3
- package/dist/esm/js/index.js +1 -2
- package/dist/esm/js/src/SignalWire.d.ts +2 -0
- package/dist/esm/js/src/SignalWire.js +13 -0
- package/dist/esm/js/src/Verto.d.ts +2 -8
- package/dist/esm/js/src/Verto.js +14 -50
- package/dist/index.min.js +2 -2
- package/package.json +13 -14
- package/dist/esm/common/src/webrtc/ChatChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/ChatChannelHandler.js +0 -22
- package/dist/esm/common/src/webrtc/Conference.d.ts +0 -15
- package/dist/esm/common/src/webrtc/Conference.js +0 -68
- package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.js +0 -77
- package/dist/esm/common/src/webrtc/InfoChannelHandler.d.ts +0 -7
- package/dist/esm/common/src/webrtc/InfoChannelHandler.js +0 -85
- package/dist/esm/common/src/webrtc/LaChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/LaChannelHandler.js +0 -58
- package/dist/esm/common/src/webrtc/ModChannelHandler.d.ts +0 -71
- package/dist/esm/common/src/webrtc/ModChannelHandler.js +0 -267
- package/dist/esm/common/src/webrtc/RTCPeer.d.ts +0 -51
- package/dist/esm/common/src/webrtc/RTCPeer.js +0 -556
- package/dist/esm/common/src/webrtc/WebRTCCall.d.ts +0 -182
- package/dist/esm/common/src/webrtc/WebRTCCall.js +0 -784
- package/dist/esm/common/src/webrtc/deviceHelpers.d.ts +0 -18
- package/dist/esm/common/src/webrtc/deviceHelpers.js +0 -113
- package/dist/esm/common/src/webrtc/sdpHelpers.d.ts +0 -3
- package/dist/esm/common/src/webrtc/sdpHelpers.js +0 -56
|
@@ -1,784 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
22
|
-
import logger from '../util/logger';
|
|
23
|
-
import RTCPeer from './RTCPeer';
|
|
24
|
-
import { Bye, Info, Modify } from '../messages/Verto';
|
|
25
|
-
import { SwEvent, VERTO_PROTOCOL } from '../util/constants';
|
|
26
|
-
import { State, DEFAULT_CALL_OPTIONS, PeerType, VertoMethod, Notification, Direction, ConferenceAction } from './constants';
|
|
27
|
-
import { trigger, register, deRegisterAll, deRegister } from '../services/Handler';
|
|
28
|
-
import { enableAudioTracks, disableAudioTracks, toggleAudioTracks, enableVideoTracks, disableVideoTracks, toggleVideoTracks, checkIsDirectCall, mutateCanvasInfoData, destructSubscribeResponse } from './helpers';
|
|
29
|
-
import { objEmpty, isFunction } from '../util/helpers';
|
|
30
|
-
import { stopStream, stopTrack, setMediaElementSinkId, getUserMedia, getHostname } from '../util/webrtc';
|
|
31
|
-
import laChannelHandler, { publicLiveArrayMethods } from './LaChannelHandler';
|
|
32
|
-
import chatChannelHandler, { publicChatMethods } from './ChatChannelHandler';
|
|
33
|
-
import modChannelHandler, { publicModMethods } from './ModChannelHandler';
|
|
34
|
-
import infoChannelHandler, { publicInfoMethods } from './InfoChannelHandler';
|
|
35
|
-
import { destructConferenceState } from './helpers';
|
|
36
|
-
export default class WebRTCCall {
|
|
37
|
-
constructor(session, opts) {
|
|
38
|
-
this.session = session;
|
|
39
|
-
this.id = '';
|
|
40
|
-
this.gotEarly = false;
|
|
41
|
-
this.doReinvite = false;
|
|
42
|
-
this.isDirect = false;
|
|
43
|
-
this.videoElements = [];
|
|
44
|
-
this.audioElements = [];
|
|
45
|
-
this.pvtData = null;
|
|
46
|
-
this.participantLayerIndex = -1;
|
|
47
|
-
this.participantLogo = '';
|
|
48
|
-
this._extension = null;
|
|
49
|
-
this._state = State.New;
|
|
50
|
-
this._prevState = State.New;
|
|
51
|
-
this._laChannelAudioMuted = null;
|
|
52
|
-
this._laChannelVideoMuted = null;
|
|
53
|
-
const { iceServers, speaker: speakerId, micId, micLabel, camId, camLabel, localElement, remoteElement, mediaConstraints: { audio, video } } = session;
|
|
54
|
-
this.options = Object.assign({}, DEFAULT_CALL_OPTIONS, { audio, video, iceServers, localElement, remoteElement, micId, micLabel, camId, camLabel, speakerId }, opts);
|
|
55
|
-
this._onMediaError = this._onMediaError.bind(this);
|
|
56
|
-
this._onVertoAnswer = this._onVertoAnswer.bind(this);
|
|
57
|
-
this._onVertoAttach = this._onVertoAttach.bind(this);
|
|
58
|
-
this._onVertoMedia = this._onVertoMedia.bind(this);
|
|
59
|
-
this._onVertoMediaParams = this._onVertoMediaParams.bind(this);
|
|
60
|
-
this._onVertoPrompt = this._onVertoPrompt.bind(this);
|
|
61
|
-
this._hangup = this._hangup.bind(this);
|
|
62
|
-
this._onParticipantData = this._onParticipantData.bind(this);
|
|
63
|
-
this._onGenericEvent = this._onGenericEvent.bind(this);
|
|
64
|
-
this._init();
|
|
65
|
-
}
|
|
66
|
-
get state() {
|
|
67
|
-
return State[this._state].toLowerCase();
|
|
68
|
-
}
|
|
69
|
-
get active() {
|
|
70
|
-
return this._state === State.Active;
|
|
71
|
-
}
|
|
72
|
-
get trying() {
|
|
73
|
-
return this._state === State.Trying;
|
|
74
|
-
}
|
|
75
|
-
get extension() {
|
|
76
|
-
return this._extension || this.options.destinationNumber;
|
|
77
|
-
}
|
|
78
|
-
set extension(extension) {
|
|
79
|
-
this._extension = extension;
|
|
80
|
-
}
|
|
81
|
-
get prevState() {
|
|
82
|
-
return State[this._prevState].toLowerCase();
|
|
83
|
-
}
|
|
84
|
-
get localStream() {
|
|
85
|
-
return this.options.localStream;
|
|
86
|
-
}
|
|
87
|
-
get remoteStream() {
|
|
88
|
-
return this.options.remoteStream;
|
|
89
|
-
}
|
|
90
|
-
get messagePayload() {
|
|
91
|
-
if (this.session.relayProtocol === VERTO_PROTOCOL) {
|
|
92
|
-
return { sessid: this.session.sessionid, dialogParams: this.options };
|
|
93
|
-
}
|
|
94
|
-
const { id, destinationNumber, attach, callerName, callerNumber, remoteCallerName, remoteCallerNumber, userVariables, screenShare } = this.options;
|
|
95
|
-
return {
|
|
96
|
-
sessid: this.session.sessionid,
|
|
97
|
-
dialogParams: {
|
|
98
|
-
id, destinationNumber, attach, callerName, callerNumber, remoteCallerName, remoteCallerNumber, userVariables, screenShare,
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
get currentParticipant() {
|
|
103
|
-
const participant = {
|
|
104
|
-
id: this.participantId,
|
|
105
|
-
role: this.participantRole,
|
|
106
|
-
layer: null,
|
|
107
|
-
layerIndex: this.participantLayerIndex,
|
|
108
|
-
isLayerBehind: false,
|
|
109
|
-
};
|
|
110
|
-
if (this.canvasInfo && this.participantLayerIndex >= 0) {
|
|
111
|
-
const { layoutOverlap, canvasLayouts } = this.canvasInfo;
|
|
112
|
-
participant.layer = canvasLayouts[this.participantLayerIndex] || null;
|
|
113
|
-
participant.isLayerBehind = layoutOverlap && participant.layer && participant.layer.overlap === 0;
|
|
114
|
-
}
|
|
115
|
-
return participant;
|
|
116
|
-
}
|
|
117
|
-
get participantId() {
|
|
118
|
-
return this.pvtData ? String(this.pvtData.conferenceMemberID) : null;
|
|
119
|
-
}
|
|
120
|
-
get participantRole() {
|
|
121
|
-
return this.pvtData ? this.pvtData.role : null;
|
|
122
|
-
}
|
|
123
|
-
get role() {
|
|
124
|
-
return this.participantRole;
|
|
125
|
-
}
|
|
126
|
-
get cameraId() {
|
|
127
|
-
return this.peer ? this.peer.getDeviceId('video') : null;
|
|
128
|
-
}
|
|
129
|
-
get cameraLabel() {
|
|
130
|
-
return this.peer ? this.peer.getDeviceLabel('video') : null;
|
|
131
|
-
}
|
|
132
|
-
get microphoneId() {
|
|
133
|
-
return this.peer ? this.peer.getDeviceId('audio') : null;
|
|
134
|
-
}
|
|
135
|
-
get microphoneLabel() {
|
|
136
|
-
return this.peer ? this.peer.getDeviceLabel('audio') : null;
|
|
137
|
-
}
|
|
138
|
-
get withAudio() {
|
|
139
|
-
return this.remoteStream ? this.remoteStream.getAudioTracks().length > 0 : false;
|
|
140
|
-
}
|
|
141
|
-
get withVideo() {
|
|
142
|
-
return this.remoteStream ? this.remoteStream.getVideoTracks().length > 0 : false;
|
|
143
|
-
}
|
|
144
|
-
get htmlVideoElement() {
|
|
145
|
-
return this.videoElements.length ? this.videoElements[0] : null;
|
|
146
|
-
}
|
|
147
|
-
get htmlAudioElement() {
|
|
148
|
-
return this.audioElements.length ? this.audioElements[0] : null;
|
|
149
|
-
}
|
|
150
|
-
get conferenceChannels() {
|
|
151
|
-
if (!this.pvtData) {
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
const { laChannel, chatChannel, infoChannel, modChannel } = this.pvtData;
|
|
155
|
-
return [laChannel, chatChannel, infoChannel, modChannel].filter(Boolean);
|
|
156
|
-
}
|
|
157
|
-
get conferenceName() {
|
|
158
|
-
if (this.pvtData) {
|
|
159
|
-
const { conferenceDisplayName, conferenceName } = this.pvtData;
|
|
160
|
-
return conferenceDisplayName || conferenceName;
|
|
161
|
-
}
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
164
|
-
get conferenceMd5() {
|
|
165
|
-
return this.pvtData ? this.pvtData.conferenceMD5 : null;
|
|
166
|
-
}
|
|
167
|
-
get conferenceUuid() {
|
|
168
|
-
if (this.pvtData) {
|
|
169
|
-
const { conferenceDisplayName, conferenceName, conferenceUUID } = this.pvtData;
|
|
170
|
-
return conferenceDisplayName ? conferenceName : conferenceUUID;
|
|
171
|
-
}
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
_upgrade() {
|
|
175
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
logger.warn(`Untested upgrade method!`);
|
|
177
|
-
this.doReinvite = true;
|
|
178
|
-
this.peer.type = PeerType.Offer;
|
|
179
|
-
const stream = yield getUserMedia({ video: true });
|
|
180
|
-
stream.getTracks().forEach(t => {
|
|
181
|
-
this.options.localStream.addTrack(t);
|
|
182
|
-
this.peer.instance.addTrack(t, this.options.localStream);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
updateDevices(constraints) {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
try {
|
|
189
|
-
console.debug('updateDevices trying constraints', this.id, constraints);
|
|
190
|
-
if (!Object.keys(constraints).length) {
|
|
191
|
-
return console.warn('Invalid constraints:', constraints);
|
|
192
|
-
}
|
|
193
|
-
const newStream = yield getUserMedia(constraints);
|
|
194
|
-
console.debug('updateDevices got stream', newStream);
|
|
195
|
-
if (!this.options.localStream) {
|
|
196
|
-
this.options.localStream = new MediaStream();
|
|
197
|
-
}
|
|
198
|
-
const { instance } = this.peer;
|
|
199
|
-
const tracks = newStream.getTracks();
|
|
200
|
-
for (let i = 0; i < tracks.length; i++) {
|
|
201
|
-
const newTrack = tracks[i];
|
|
202
|
-
console.debug('updateDevices apply track: ', newTrack);
|
|
203
|
-
const transceiver = instance.getTransceivers().find(({ mid, sender, receiver }) => {
|
|
204
|
-
if (sender.track && sender.track.kind === newTrack.kind) {
|
|
205
|
-
console.debug('Found transceiver by sender');
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
if (receiver.track && receiver.track.kind === newTrack.kind) {
|
|
209
|
-
console.debug('Found transceiver by receiver');
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
if (mid === null) {
|
|
213
|
-
console.debug('Found disassociated transceiver');
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
return false;
|
|
217
|
-
});
|
|
218
|
-
if (transceiver && transceiver.sender) {
|
|
219
|
-
console.debug('updateDevices FOUND - replaceTrack on it and on localStream');
|
|
220
|
-
yield transceiver.sender.replaceTrack(newTrack);
|
|
221
|
-
this.options.localStream.addTrack(newTrack);
|
|
222
|
-
console.debug('updateDevices replaceTrack SUCCESS');
|
|
223
|
-
this.options.localStream.getTracks().forEach(track => {
|
|
224
|
-
if (track.kind === newTrack.kind && track.id !== newTrack.id) {
|
|
225
|
-
console.debug('updateDevices stop old track and apply new one - ');
|
|
226
|
-
stopTrack(track);
|
|
227
|
-
this.options.localStream.removeTrack(track);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
console.debug('updateDevices NOT FOUND - addTrack and start dancing!');
|
|
233
|
-
this.peer.type = PeerType.Offer;
|
|
234
|
-
this.doReinvite = true;
|
|
235
|
-
this.options.localStream.addTrack(newTrack);
|
|
236
|
-
instance.addTrack(newTrack, this.options.localStream);
|
|
237
|
-
}
|
|
238
|
-
console.debug('updateDevices Simply update mic/cam');
|
|
239
|
-
if (newTrack.kind === 'audio') {
|
|
240
|
-
this.options.micId = newTrack.getSettings().deviceId;
|
|
241
|
-
}
|
|
242
|
-
else if (newTrack.kind === 'video') {
|
|
243
|
-
this.options.camId = newTrack.getSettings().deviceId;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
console.debug('updateDevices done!');
|
|
247
|
-
this._dispatchNotification({ type: Notification.DeviceUpdated });
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
250
|
-
console.error('updateDevices', error);
|
|
251
|
-
throw error;
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
invite() {
|
|
256
|
-
this.direction = Direction.Outbound;
|
|
257
|
-
this.peer = new RTCPeer(this, PeerType.Offer, this.options);
|
|
258
|
-
}
|
|
259
|
-
answer() {
|
|
260
|
-
this.direction = Direction.Inbound;
|
|
261
|
-
this.peer = new RTCPeer(this, PeerType.Answer, this.options);
|
|
262
|
-
}
|
|
263
|
-
hangup(params) {
|
|
264
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
265
|
-
const states = [State.Hangup, State.Destroy];
|
|
266
|
-
if (states.includes(this._state)) {
|
|
267
|
-
logger.info(`Call ${this.id} already in ${this.state} state.`);
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
try {
|
|
271
|
-
const bye = new Bye(this.messagePayload);
|
|
272
|
-
yield this._execute(bye);
|
|
273
|
-
}
|
|
274
|
-
catch (error) {
|
|
275
|
-
logger.error('Hangup error:', error);
|
|
276
|
-
}
|
|
277
|
-
finally {
|
|
278
|
-
this._hangup(params);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
dtmf(dtmf) {
|
|
283
|
-
const msg = new Info(Object.assign(Object.assign({}, this.messagePayload), { dtmf }));
|
|
284
|
-
this._execute(msg);
|
|
285
|
-
}
|
|
286
|
-
sendCurrentMediaSettings() {
|
|
287
|
-
const params = {
|
|
288
|
-
type: 'mediaSettings',
|
|
289
|
-
audioinput: this.peer.getTrackSettings('audio'),
|
|
290
|
-
videoinput: this.peer.getTrackSettings('video'),
|
|
291
|
-
audiooutput: {
|
|
292
|
-
deviceId: this.options.speakerId
|
|
293
|
-
},
|
|
294
|
-
};
|
|
295
|
-
return this._sendVertoInfo(params);
|
|
296
|
-
}
|
|
297
|
-
_sendVertoInfo(params) {
|
|
298
|
-
const msg = new Info(Object.assign(Object.assign({}, this.messagePayload), params));
|
|
299
|
-
return this._execute(msg);
|
|
300
|
-
}
|
|
301
|
-
transfer(destination) {
|
|
302
|
-
const msg = new Modify(Object.assign(Object.assign({}, this.messagePayload), { action: 'transfer', destination }));
|
|
303
|
-
this._execute(msg);
|
|
304
|
-
}
|
|
305
|
-
replace(callId) {
|
|
306
|
-
const msg = new Modify(Object.assign(Object.assign({}, this.messagePayload), { action: 'replace', replaceCallID: callId }));
|
|
307
|
-
this._execute(msg);
|
|
308
|
-
}
|
|
309
|
-
askVideoKeyFrame() {
|
|
310
|
-
const msg = new Modify(Object.assign(Object.assign({}, this.messagePayload), { action: 'videoRefresh' }));
|
|
311
|
-
return this._execute(msg);
|
|
312
|
-
}
|
|
313
|
-
hold() {
|
|
314
|
-
return this._changeHold('hold');
|
|
315
|
-
}
|
|
316
|
-
unhold() {
|
|
317
|
-
return this._changeHold('unhold');
|
|
318
|
-
}
|
|
319
|
-
toggleHold() {
|
|
320
|
-
return this._changeHold('toggleHold');
|
|
321
|
-
}
|
|
322
|
-
disableOutboundAudio() {
|
|
323
|
-
disableAudioTracks(this.options.localStream);
|
|
324
|
-
}
|
|
325
|
-
enableOutboundAudio() {
|
|
326
|
-
enableAudioTracks(this.options.localStream);
|
|
327
|
-
}
|
|
328
|
-
toggleOutboundAudio() {
|
|
329
|
-
toggleAudioTracks(this.options.localStream);
|
|
330
|
-
}
|
|
331
|
-
disableOutboundVideo() {
|
|
332
|
-
disableVideoTracks(this.options.localStream);
|
|
333
|
-
}
|
|
334
|
-
enableOutboundVideo() {
|
|
335
|
-
enableVideoTracks(this.options.localStream);
|
|
336
|
-
}
|
|
337
|
-
toggleOutboundVideo() {
|
|
338
|
-
toggleVideoTracks(this.options.localStream);
|
|
339
|
-
}
|
|
340
|
-
muteAudio() {
|
|
341
|
-
disableAudioTracks(this.options.localStream);
|
|
342
|
-
}
|
|
343
|
-
unmuteAudio() {
|
|
344
|
-
enableAudioTracks(this.options.localStream);
|
|
345
|
-
}
|
|
346
|
-
toggleAudioMute() {
|
|
347
|
-
toggleAudioTracks(this.options.localStream);
|
|
348
|
-
}
|
|
349
|
-
muteVideo() {
|
|
350
|
-
disableVideoTracks(this.options.localStream);
|
|
351
|
-
}
|
|
352
|
-
unmuteVideo() {
|
|
353
|
-
enableVideoTracks(this.options.localStream);
|
|
354
|
-
}
|
|
355
|
-
toggleVideoMute() {
|
|
356
|
-
toggleVideoTracks(this.options.localStream);
|
|
357
|
-
}
|
|
358
|
-
deaf() {
|
|
359
|
-
disableAudioTracks(this.options.remoteStream);
|
|
360
|
-
}
|
|
361
|
-
undeaf() {
|
|
362
|
-
enableAudioTracks(this.options.remoteStream);
|
|
363
|
-
}
|
|
364
|
-
toggleDeaf() {
|
|
365
|
-
toggleAudioTracks(this.options.remoteStream);
|
|
366
|
-
}
|
|
367
|
-
sfuLowResolution(streamId, trackId) {
|
|
368
|
-
console.debug('Set video res to low');
|
|
369
|
-
const msg = new Modify(Object.assign(Object.assign({}, this.messagePayload), { action: 'set-sfu-low-res', streamId, trackId }));
|
|
370
|
-
return this._execute(msg);
|
|
371
|
-
}
|
|
372
|
-
sfuHighResolution(streamId, trackId) {
|
|
373
|
-
console.debug('Set video res to high');
|
|
374
|
-
const msg = new Modify(Object.assign(Object.assign({}, this.messagePayload), { action: 'set-sfu-high-res', streamId, trackId }));
|
|
375
|
-
return this._execute(msg);
|
|
376
|
-
}
|
|
377
|
-
sfuDefaultResolution(streamId, trackId) {
|
|
378
|
-
console.debug('Set video res to default');
|
|
379
|
-
const msg = new Modify(Object.assign(Object.assign({}, this.messagePayload), { action: 'set-sfu-default-res', streamId, trackId }));
|
|
380
|
-
return this._execute(msg);
|
|
381
|
-
}
|
|
382
|
-
doReinviteWithRelayOnly() {
|
|
383
|
-
if (this.peer && this.active) {
|
|
384
|
-
this.peer.restartIceWithRelayOnly();
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
stopOutboundAudio() {
|
|
388
|
-
if (this.peer && this.active) {
|
|
389
|
-
this.peer.stopTrackSender('audio');
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
restoreOutboundAudio() {
|
|
393
|
-
if (this.peer && this.active) {
|
|
394
|
-
this.peer.restoreTrackSender('audio');
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
stopOutboundVideo() {
|
|
398
|
-
if (this.peer && this.active) {
|
|
399
|
-
this.peer.stopTrackSender('video');
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
restoreOutboundVideo() {
|
|
403
|
-
if (this.peer && this.active) {
|
|
404
|
-
this.peer.restoreTrackSender('video');
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
setState(state) {
|
|
408
|
-
this._prevState = this._state;
|
|
409
|
-
this._state = state;
|
|
410
|
-
logger.info(`Call ${this.id} state change from ${this.prevState} to ${this.state}`);
|
|
411
|
-
this._dispatchNotification({ type: Notification.CallUpdate });
|
|
412
|
-
switch (state) {
|
|
413
|
-
case State.Purge:
|
|
414
|
-
if (this.screenShare instanceof WebRTCCall) {
|
|
415
|
-
this.screenShare.setState(State.Purge);
|
|
416
|
-
}
|
|
417
|
-
if (this.secondSource instanceof WebRTCCall) {
|
|
418
|
-
this.secondSource.setState(State.Purge);
|
|
419
|
-
}
|
|
420
|
-
this._finalize();
|
|
421
|
-
break;
|
|
422
|
-
case State.Active: {
|
|
423
|
-
setTimeout(() => {
|
|
424
|
-
const { remoteElement, speakerId } = this.options;
|
|
425
|
-
setMediaElementSinkId(remoteElement, speakerId);
|
|
426
|
-
}, 0);
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
case State.Hangup:
|
|
430
|
-
if (this.screenShare instanceof WebRTCCall) {
|
|
431
|
-
this.screenShare.hangup();
|
|
432
|
-
}
|
|
433
|
-
if (this.secondSource instanceof WebRTCCall) {
|
|
434
|
-
this.secondSource.hangup();
|
|
435
|
-
}
|
|
436
|
-
this.setState(State.Destroy);
|
|
437
|
-
break;
|
|
438
|
-
case State.Destroy:
|
|
439
|
-
this._finalize();
|
|
440
|
-
break;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
conferencePartHandler(pvtData) {
|
|
444
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
445
|
-
this.pvtData = pvtData;
|
|
446
|
-
const notification = {
|
|
447
|
-
action: ConferenceAction.Leave,
|
|
448
|
-
conferenceName: this.conferenceName,
|
|
449
|
-
conferenceMd5: this.conferenceMd5,
|
|
450
|
-
conferenceUuid: this.conferenceUuid,
|
|
451
|
-
participantId: this.participantId,
|
|
452
|
-
role: this.participantRole,
|
|
453
|
-
};
|
|
454
|
-
this._dispatchConferenceUpdate(notification);
|
|
455
|
-
this._removeConferenceChannels();
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
conferenceJoinHandler(pvtData) {
|
|
459
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
460
|
-
this.pvtData = pvtData;
|
|
461
|
-
this.extension = pvtData.conferenceDisplayName || pvtData.laName;
|
|
462
|
-
const laObject = {
|
|
463
|
-
session: this.session,
|
|
464
|
-
nodeId: this.nodeId,
|
|
465
|
-
channel: this.pvtData.laChannel || null,
|
|
466
|
-
laName: this.pvtData.laName || null,
|
|
467
|
-
};
|
|
468
|
-
Object.keys(publicLiveArrayMethods).forEach(method => {
|
|
469
|
-
Object.defineProperty(this, method, {
|
|
470
|
-
configurable: true,
|
|
471
|
-
writable: true,
|
|
472
|
-
value: publicLiveArrayMethods[method].bind(laObject)
|
|
473
|
-
});
|
|
474
|
-
});
|
|
475
|
-
const chatObject = {
|
|
476
|
-
session: this.session,
|
|
477
|
-
nodeId: this.nodeId,
|
|
478
|
-
channel: this.pvtData.chatChannel || null,
|
|
479
|
-
};
|
|
480
|
-
Object.keys(publicChatMethods).forEach(method => {
|
|
481
|
-
Object.defineProperty(this, method, {
|
|
482
|
-
configurable: true,
|
|
483
|
-
writable: true,
|
|
484
|
-
value: publicChatMethods[method].bind(chatObject)
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
const modObject = {
|
|
488
|
-
session: this.session,
|
|
489
|
-
nodeId: this.nodeId,
|
|
490
|
-
channel: this.pvtData.modChannel || null,
|
|
491
|
-
callID: this.id,
|
|
492
|
-
};
|
|
493
|
-
Object.keys(publicModMethods).forEach(method => {
|
|
494
|
-
Object.defineProperty(this, method, {
|
|
495
|
-
configurable: true,
|
|
496
|
-
writable: true,
|
|
497
|
-
value: publicModMethods[method].bind(modObject)
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
const infoObject = {
|
|
501
|
-
session: this.session,
|
|
502
|
-
nodeId: this.nodeId,
|
|
503
|
-
channel: this.pvtData.infoChannel || null,
|
|
504
|
-
callID: this.id,
|
|
505
|
-
};
|
|
506
|
-
Object.keys(publicInfoMethods).forEach(method => {
|
|
507
|
-
Object.defineProperty(this, method, {
|
|
508
|
-
configurable: true,
|
|
509
|
-
writable: true,
|
|
510
|
-
value: publicInfoMethods[method].bind(infoObject)
|
|
511
|
-
});
|
|
512
|
-
});
|
|
513
|
-
try {
|
|
514
|
-
const { relayProtocol } = this.session;
|
|
515
|
-
this.conferenceChannels.forEach(channel => {
|
|
516
|
-
deRegister(relayProtocol, null, channel);
|
|
517
|
-
this.session.addChannelCallIdEntry(channel, this.id);
|
|
518
|
-
});
|
|
519
|
-
const filteredChannels = this.conferenceChannels.filter(channel => {
|
|
520
|
-
const global = channel.split('.')[0];
|
|
521
|
-
return !this.session._existsSubscription(relayProtocol, global);
|
|
522
|
-
});
|
|
523
|
-
const result = yield this.session.vertoSubscribe({
|
|
524
|
-
nodeId: pvtData.nodeId,
|
|
525
|
-
channels: filteredChannels,
|
|
526
|
-
});
|
|
527
|
-
const { subscribed = [], alreadySubscribed = [] } = destructSubscribeResponse(result);
|
|
528
|
-
const all = subscribed.concat(alreadySubscribed);
|
|
529
|
-
const { laChannel, chatChannel, infoChannel, modChannel } = this.pvtData;
|
|
530
|
-
if (all.includes(laChannel)) {
|
|
531
|
-
deRegister(relayProtocol, null, laChannel);
|
|
532
|
-
register(relayProtocol, laChannelHandler.bind(this, this.session), laChannel);
|
|
533
|
-
}
|
|
534
|
-
if (all.includes(chatChannel)) {
|
|
535
|
-
deRegister(relayProtocol, null, chatChannel);
|
|
536
|
-
register(relayProtocol, chatChannelHandler.bind(this, this.session), chatChannel);
|
|
537
|
-
}
|
|
538
|
-
if (all.includes(infoChannel)) {
|
|
539
|
-
deRegister(relayProtocol, null, infoChannel);
|
|
540
|
-
register(relayProtocol, infoChannelHandler.bind(this, this.session), infoChannel);
|
|
541
|
-
}
|
|
542
|
-
if (all.includes(modChannel)) {
|
|
543
|
-
deRegister(relayProtocol, null, modChannel);
|
|
544
|
-
register(relayProtocol, modChannelHandler.bind(this, this.session), modChannel);
|
|
545
|
-
}
|
|
546
|
-
const notification = {
|
|
547
|
-
action: ConferenceAction.Join,
|
|
548
|
-
conferenceName: this.conferenceName,
|
|
549
|
-
conferenceMd5: this.conferenceMd5,
|
|
550
|
-
conferenceUuid: this.conferenceUuid,
|
|
551
|
-
participantId: this.participantId,
|
|
552
|
-
role: this.participantRole,
|
|
553
|
-
};
|
|
554
|
-
this._dispatchConferenceUpdate(notification);
|
|
555
|
-
if (all.includes(laChannel)) {
|
|
556
|
-
this.liveArrayBootstrap();
|
|
557
|
-
}
|
|
558
|
-
if (all.includes(infoChannel)) {
|
|
559
|
-
this.getLayoutInfo();
|
|
560
|
-
this.getConferenceState();
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
catch (error) {
|
|
564
|
-
logger.error('Conference subscriptions error:', error);
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
updateLayouts(params) {
|
|
569
|
-
const { contentType, callID, canvasType, canvasInfo = null, currentLayerIdx = null } = params, rest = __rest(params, ["contentType", "callID", "canvasType", "canvasInfo", "currentLayerIdx"]);
|
|
570
|
-
this.canvasType = canvasType;
|
|
571
|
-
if (contentType === 'layer-info' && currentLayerIdx !== null) {
|
|
572
|
-
this.participantLayerIndex = currentLayerIdx;
|
|
573
|
-
}
|
|
574
|
-
if (canvasInfo !== null) {
|
|
575
|
-
this.canvasInfo = mutateCanvasInfoData(canvasInfo);
|
|
576
|
-
}
|
|
577
|
-
const action = contentType === 'layer-info' ? ConferenceAction.LayerInfo : ConferenceAction.LayoutInfo;
|
|
578
|
-
this._dispatchConferenceUpdate(Object.assign({ action, participant: this.currentParticipant, canvasInfo: this.canvasInfo, contentType, canvasType }, rest));
|
|
579
|
-
}
|
|
580
|
-
updateLogo(params) {
|
|
581
|
-
const { logoURL: logo } = params;
|
|
582
|
-
this.participantLogo = logo;
|
|
583
|
-
this._dispatchConferenceUpdate({ action: ConferenceAction.LogoInfo, logo });
|
|
584
|
-
}
|
|
585
|
-
handleCaptionInfo(params) {
|
|
586
|
-
const { contentType } = params, rest = __rest(params, ["contentType"]);
|
|
587
|
-
this._dispatchConferenceUpdate(Object.assign({ action: ConferenceAction.CaptionInfo }, rest));
|
|
588
|
-
}
|
|
589
|
-
handleConferenceInfo(params) {
|
|
590
|
-
const { conferenceState, messages = [] } = params;
|
|
591
|
-
this._dispatchConferenceUpdate({ action: ConferenceAction.ConferenceInfo, conferenceState: destructConferenceState(conferenceState), messages });
|
|
592
|
-
}
|
|
593
|
-
updateFromLaChannel(muted, vmuted) {
|
|
594
|
-
this._laChannelAudioMuted = muted;
|
|
595
|
-
if (this._laChannelVideoMuted !== vmuted) {
|
|
596
|
-
vmuted ? this.stopOutboundVideo() : this.restoreOutboundVideo();
|
|
597
|
-
}
|
|
598
|
-
this._laChannelVideoMuted = vmuted;
|
|
599
|
-
}
|
|
600
|
-
_removeConferenceChannels() {
|
|
601
|
-
var _a;
|
|
602
|
-
if (!((_a = this.conferenceChannels) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
this.conferenceChannels.forEach(channel => {
|
|
606
|
-
deRegister(this.session.relayProtocol, null, channel);
|
|
607
|
-
this.session.removeChannelCallIdEntry(channel, this.id);
|
|
608
|
-
});
|
|
609
|
-
this.session.vertoUnsubscribe({
|
|
610
|
-
nodeId: this.nodeId,
|
|
611
|
-
channels: this.conferenceChannels,
|
|
612
|
-
}).catch((error) => {
|
|
613
|
-
logger.error('Conference unsubscribe error:', error);
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
_changeHold(action) {
|
|
617
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
618
|
-
if (this._state >= State.Hangup) {
|
|
619
|
-
return logger.warn('This call is not active', this.id, this.state);
|
|
620
|
-
}
|
|
621
|
-
const msg = new Modify(Object.assign(Object.assign({}, this.messagePayload), { action }));
|
|
622
|
-
try {
|
|
623
|
-
const { holdState } = yield this._execute(msg);
|
|
624
|
-
holdState === 'active' ? this.setState(State.Active) : this.setState(State.Held);
|
|
625
|
-
return true;
|
|
626
|
-
}
|
|
627
|
-
catch (error) {
|
|
628
|
-
logger.error('Error changing hold state', error);
|
|
629
|
-
return false;
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
_hangup(params = {}) {
|
|
634
|
-
const { cause = 'NORMAL_CLEARING', code = '16', redirectDestination = null } = params;
|
|
635
|
-
this.cause = cause;
|
|
636
|
-
this.causeCode = code;
|
|
637
|
-
if (redirectDestination && this.trying) {
|
|
638
|
-
return this.peer.executeInvite();
|
|
639
|
-
}
|
|
640
|
-
this.setState(State.Hangup);
|
|
641
|
-
}
|
|
642
|
-
_onMediaError(error) {
|
|
643
|
-
this._dispatchNotification({ type: Notification.UserMediaError, error });
|
|
644
|
-
this._hangup();
|
|
645
|
-
}
|
|
646
|
-
_onGenericEvent(params) {
|
|
647
|
-
this._dispatchNotification(Object.assign(Object.assign({}, params), { type: Notification.Generic }));
|
|
648
|
-
}
|
|
649
|
-
_onParticipantData(params) {
|
|
650
|
-
const { display_name: displayName, display_number: displayNumber, display_direction } = params, rest = __rest(params, ["display_name", "display_number", "display_direction"]);
|
|
651
|
-
this.extension = displayNumber;
|
|
652
|
-
const displayDirection = display_direction === Direction.Inbound ? Direction.Outbound : Direction.Inbound;
|
|
653
|
-
this._dispatchNotification(Object.assign({ type: Notification.ParticipantData, displayName, displayNumber, displayDirection }, rest));
|
|
654
|
-
}
|
|
655
|
-
_onVertoAnswer(params) {
|
|
656
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
657
|
-
if (this._state >= State.Active) {
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
if (!this.gotEarly) {
|
|
661
|
-
yield this.peer.onRemoteSdp(params.sdp);
|
|
662
|
-
}
|
|
663
|
-
this.isDirect = checkIsDirectCall(params);
|
|
664
|
-
this.setState(State.Active);
|
|
665
|
-
});
|
|
666
|
-
}
|
|
667
|
-
_onVertoMedia(params) {
|
|
668
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
669
|
-
if (this._state >= State.Early) {
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
this.gotEarly = true;
|
|
673
|
-
yield this.peer.onRemoteSdp(params.sdp);
|
|
674
|
-
this.isDirect = checkIsDirectCall(params);
|
|
675
|
-
this.setState(State.Early);
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
_onVertoMediaParams(params) {
|
|
679
|
-
const { mediaParams } = params;
|
|
680
|
-
if (this.options.autoApplyMediaParams === false) {
|
|
681
|
-
return this._dispatchNotification({ type: Notification.MediaParams, mediaParams });
|
|
682
|
-
}
|
|
683
|
-
if (this.peer && mediaParams) {
|
|
684
|
-
Object.keys(mediaParams).forEach(kind => {
|
|
685
|
-
this.peer.applyMediaConstraints(kind, mediaParams[kind]);
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
_onVertoPrompt(params) {
|
|
690
|
-
const notification = Object.assign(Object.assign({}, params), { promptType: params.type, type: Notification.Prompt, call: this });
|
|
691
|
-
this._dispatchNotification(notification);
|
|
692
|
-
}
|
|
693
|
-
_dispatchNotification(notification) {
|
|
694
|
-
if (this.options.skipNotifications === true) {
|
|
695
|
-
return;
|
|
696
|
-
}
|
|
697
|
-
notification.call = this;
|
|
698
|
-
if (!trigger(this.id, notification, SwEvent.Notification, false)) {
|
|
699
|
-
trigger(SwEvent.Notification, notification, this.session.uuid);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
_dispatchConferenceUpdate(params) {
|
|
703
|
-
this._dispatchNotification(Object.assign({ type: Notification.ConferenceUpdate }, params));
|
|
704
|
-
}
|
|
705
|
-
_execute(msg) {
|
|
706
|
-
if (this.nodeId) {
|
|
707
|
-
msg.targetNodeId = this.nodeId;
|
|
708
|
-
}
|
|
709
|
-
const { requestTimeout = 10000 } = this.options;
|
|
710
|
-
return Promise.race([
|
|
711
|
-
new Promise((_resolve, reject) => setTimeout(reject, requestTimeout, 'timeout')),
|
|
712
|
-
this.session.execute(msg),
|
|
713
|
-
]);
|
|
714
|
-
}
|
|
715
|
-
_onVertoAttach(params) {
|
|
716
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
717
|
-
if (this.options.simulcast === true) {
|
|
718
|
-
console.debug('Handle verto.attach for a simulcast call?', params);
|
|
719
|
-
}
|
|
720
|
-
switch (this._state) {
|
|
721
|
-
case State.New:
|
|
722
|
-
this.session.autoRecoverCalls ? this.answer() : this.setState(State.Recovering);
|
|
723
|
-
break;
|
|
724
|
-
case State.Active: {
|
|
725
|
-
if (this.doReinvite) {
|
|
726
|
-
console.debug('doReinvite IS ACTIVE!', params);
|
|
727
|
-
return logger.warn('>>>> This leg alreay sent a reinvite??');
|
|
728
|
-
}
|
|
729
|
-
this.peer.type = PeerType.Answer;
|
|
730
|
-
this.options.remoteSdp = params.sdp;
|
|
731
|
-
const stream = yield getUserMedia({ video: true });
|
|
732
|
-
stream.getVideoTracks().forEach(t => {
|
|
733
|
-
this.options.localStream.addTrack(t);
|
|
734
|
-
this.peer.instance.addTrack(t, this.options.localStream);
|
|
735
|
-
});
|
|
736
|
-
break;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
_init() {
|
|
742
|
-
const { id, userVariables, remoteCallerNumber, onNotification } = this.options;
|
|
743
|
-
if (!id) {
|
|
744
|
-
this.options.id = uuidv4();
|
|
745
|
-
}
|
|
746
|
-
this.id = this.options.id;
|
|
747
|
-
if (!userVariables || objEmpty(userVariables)) {
|
|
748
|
-
this.options.userVariables = this.session.options.userVariables || {};
|
|
749
|
-
}
|
|
750
|
-
this.options.userVariables.hostname = getHostname();
|
|
751
|
-
if (!remoteCallerNumber) {
|
|
752
|
-
this.options.remoteCallerNumber = this.options.destinationNumber;
|
|
753
|
-
}
|
|
754
|
-
this.session.calls[this.id] = this;
|
|
755
|
-
if (isFunction(onNotification)) {
|
|
756
|
-
register(this.id, onNotification.bind(this), SwEvent.Notification);
|
|
757
|
-
}
|
|
758
|
-
register(this.id, this._onMediaError, SwEvent.MediaError);
|
|
759
|
-
register(this.id, this._onVertoAnswer, VertoMethod.Answer);
|
|
760
|
-
register(this.id, this._onVertoMedia, VertoMethod.Media);
|
|
761
|
-
register(this.id, this._onVertoMediaParams, VertoMethod.MediaParams);
|
|
762
|
-
register(this.id, this._onVertoPrompt, VertoMethod.Prompt);
|
|
763
|
-
register(this.id, this._hangup, VertoMethod.Bye);
|
|
764
|
-
register(this.id, this._onParticipantData, VertoMethod.Display);
|
|
765
|
-
register(this.id, this._onVertoAttach, VertoMethod.Attach);
|
|
766
|
-
register(this.id, this._onGenericEvent, VertoMethod.Info);
|
|
767
|
-
register(this.id, this._onGenericEvent, VertoMethod.Event);
|
|
768
|
-
this.setState(State.New);
|
|
769
|
-
logger.info('New Call with Options:', this.options);
|
|
770
|
-
}
|
|
771
|
-
_finalize() {
|
|
772
|
-
if (this.peer && this.peer.instance) {
|
|
773
|
-
this.peer.instance.close();
|
|
774
|
-
this.peer = null;
|
|
775
|
-
}
|
|
776
|
-
this._removeConferenceChannels();
|
|
777
|
-
const { remoteStream, localStream } = this.options;
|
|
778
|
-
stopStream(remoteStream);
|
|
779
|
-
stopStream(localStream);
|
|
780
|
-
deRegisterAll(this.id);
|
|
781
|
-
this.session.calls[this.id] = null;
|
|
782
|
-
delete this.session.calls[this.id];
|
|
783
|
-
}
|
|
784
|
-
}
|