@wazo/sdk 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +16 -7
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/__voice__/call.test.js +52 -3
- package/esm/api/auth.js +3 -0
- package/esm/checker/checks/webrtc.js +2 -2
- package/esm/domain/CallLog.js +2 -3
- package/esm/domain/Phone/CTIPhone.js +2 -2
- package/esm/domain/Phone/WebRTCPhone.js +59 -57
- package/esm/index.js +3 -1
- package/esm/service/CallApi.js +4 -4
- package/esm/simple/Auth.js +13 -3
- package/esm/simple/Phone.js +5 -5
- package/esm/simple/index.js +2 -1
- package/esm/simple/room/Room.js +2 -2
- package/esm/simple/room/SipRoom.js +2 -2
- package/esm/state-machine/call-state-machine.js +34 -19
- package/esm/state-machine/softphone-state-machine.js +1 -2
- package/esm/state-machine/utils.js +10 -4
- package/esm/types/api/auth.d.ts +3 -0
- package/esm/types/api/auth.d.ts.map +1 -1
- package/esm/types/checker/checks/index.d.ts +1 -1
- package/esm/types/checker/checks/webrtc-transport.d.ts +2 -2
- package/esm/types/checker/checks/webrtc-transport.d.ts.map +1 -1
- package/esm/types/domain/CallLog.d.ts.map +1 -1
- package/esm/types/domain/CallSession.d.ts +3 -3
- package/esm/types/domain/CallSession.d.ts.map +1 -1
- package/esm/types/domain/Phone/CTIPhone.d.ts.map +1 -1
- package/esm/types/domain/Phone/WebRTCPhone.d.ts +22 -22
- package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/esm/types/domain/types.d.ts +0 -4
- package/esm/types/domain/types.d.ts.map +1 -1
- package/esm/types/index.d.ts +3 -1
- package/esm/types/index.d.ts.map +1 -1
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts +3 -3
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
- package/esm/types/service/CallApi.d.ts +5 -5
- package/esm/types/service/CallApi.d.ts.map +1 -1
- package/esm/types/simple/Auth.d.ts +6 -1
- package/esm/types/simple/Auth.d.ts.map +1 -1
- package/esm/types/simple/Phone.d.ts +8 -8
- package/esm/types/simple/Phone.d.ts.map +1 -1
- package/esm/types/simple/index.d.ts +3 -1
- package/esm/types/simple/index.d.ts.map +1 -1
- package/esm/types/state-machine/call-state-machine.d.ts +12 -1
- package/esm/types/state-machine/call-state-machine.d.ts.map +1 -1
- package/esm/types/state-machine/softphone-state-machine.d.ts +1 -2
- package/esm/types/state-machine/softphone-state-machine.d.ts.map +1 -1
- package/esm/types/state-machine/utils.d.ts +1 -1
- package/esm/types/state-machine/utils.d.ts.map +1 -1
- package/esm/types/utils/sdp.d.ts +1 -2
- package/esm/types/utils/sdp.d.ts.map +1 -1
- package/esm/types/utils/update-from.d.ts +1 -1
- package/esm/types/utils/update-from.d.ts.map +1 -1
- package/esm/types/utils/webrtc.d.ts.map +1 -1
- package/esm/types/voice/call.d.ts +15 -3
- package/esm/types/voice/call.d.ts.map +1 -1
- package/esm/types/voice/softphone.d.ts +7 -0
- package/esm/types/voice/softphone.d.ts.map +1 -1
- package/esm/types/web-rtc-client.d.ts +39 -38
- package/esm/types/web-rtc-client.d.ts.map +1 -1
- package/esm/utils/sdp.js +16 -9
- package/esm/utils/update-from.js +2 -2
- package/esm/utils/webrtc.js +10 -4
- package/esm/voice/call.js +86 -28
- package/esm/voice/softphone.js +58 -17
- package/esm/web-rtc-client.js +67 -58
- package/lib/__tests__/__voice__/call.test.js +51 -2
- package/lib/api/auth.js +3 -0
- package/lib/checker/checks/webrtc.js +1 -1
- package/lib/domain/CallLog.js +2 -3
- package/lib/domain/Phone/CTIPhone.js +2 -2
- package/lib/domain/Phone/WebRTCPhone.js +58 -56
- package/lib/index.js +7 -3
- package/lib/service/CallApi.js +2 -2
- package/lib/simple/Auth.js +15 -3
- package/lib/simple/Phone.js +2 -2
- package/lib/simple/index.js +2 -1
- package/lib/simple/room/Room.js +1 -1
- package/lib/simple/room/SipRoom.js +1 -1
- package/lib/state-machine/call-state-machine.js +35 -20
- package/lib/state-machine/softphone-state-machine.js +1 -2
- package/lib/state-machine/utils.js +10 -4
- package/lib/types/api/auth.d.ts +3 -0
- package/lib/types/api/auth.d.ts.map +1 -1
- package/lib/types/checker/checks/index.d.ts +1 -1
- package/lib/types/checker/checks/webrtc-transport.d.ts +2 -2
- package/lib/types/checker/checks/webrtc-transport.d.ts.map +1 -1
- package/lib/types/domain/CallLog.d.ts.map +1 -1
- package/lib/types/domain/CallSession.d.ts +3 -3
- package/lib/types/domain/CallSession.d.ts.map +1 -1
- package/lib/types/domain/Phone/CTIPhone.d.ts.map +1 -1
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +22 -22
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/lib/types/domain/types.d.ts +0 -4
- package/lib/types/domain/types.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +3 -3
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
- package/lib/types/service/CallApi.d.ts +5 -5
- package/lib/types/service/CallApi.d.ts.map +1 -1
- package/lib/types/simple/Auth.d.ts +6 -1
- package/lib/types/simple/Auth.d.ts.map +1 -1
- package/lib/types/simple/Phone.d.ts +8 -8
- package/lib/types/simple/Phone.d.ts.map +1 -1
- package/lib/types/simple/index.d.ts +3 -1
- package/lib/types/simple/index.d.ts.map +1 -1
- package/lib/types/state-machine/call-state-machine.d.ts +12 -1
- package/lib/types/state-machine/call-state-machine.d.ts.map +1 -1
- package/lib/types/state-machine/softphone-state-machine.d.ts +1 -2
- package/lib/types/state-machine/softphone-state-machine.d.ts.map +1 -1
- package/lib/types/state-machine/utils.d.ts +1 -1
- package/lib/types/state-machine/utils.d.ts.map +1 -1
- package/lib/types/utils/sdp.d.ts +1 -2
- package/lib/types/utils/sdp.d.ts.map +1 -1
- package/lib/types/utils/update-from.d.ts +1 -1
- package/lib/types/utils/update-from.d.ts.map +1 -1
- package/lib/types/utils/webrtc.d.ts.map +1 -1
- package/lib/types/voice/call.d.ts +15 -3
- package/lib/types/voice/call.d.ts.map +1 -1
- package/lib/types/voice/softphone.d.ts +7 -0
- package/lib/types/voice/softphone.d.ts.map +1 -1
- package/lib/types/web-rtc-client.d.ts +39 -38
- package/lib/types/web-rtc-client.d.ts.map +1 -1
- package/lib/utils/sdp.js +17 -10
- package/lib/utils/update-from.js +2 -2
- package/lib/utils/webrtc.js +11 -4
- package/lib/voice/call.js +89 -27
- package/lib/voice/softphone.js +62 -17
- package/lib/web-rtc-client.js +66 -57
- package/package.json +1 -1
- package/src/__tests__/__voice__/call.test.ts +61 -3
- package/src/api/auth.ts +5 -0
- package/src/checker/checks/webrtc-transport.ts +2 -2
- package/src/checker/checks/webrtc.ts +2 -2
- package/src/domain/CallLog.ts +2 -3
- package/src/domain/CallSession.ts +3 -3
- package/src/domain/Phone/CTIPhone.ts +3 -2
- package/src/domain/Phone/WebRTCPhone.ts +87 -85
- package/src/domain/__tests__/CallSession.test.ts +4 -0
- package/src/domain/types.ts +0 -5
- package/src/index.ts +4 -1
- package/src/lib/WazoSessionDescriptionHandler.ts +3 -3
- package/src/service/CallApi.ts +7 -7
- package/src/simple/Auth.ts +15 -3
- package/src/simple/Phone.ts +11 -11
- package/src/simple/index.ts +2 -1
- package/src/simple/room/Room.ts +3 -3
- package/src/simple/room/SipRoom.ts +3 -3
- package/src/state-machine/call-state-machine.ts +38 -19
- package/src/state-machine/softphone-state-machine.ts +1 -2
- package/src/state-machine/utils.ts +12 -4
- package/src/utils/sdp.ts +18 -11
- package/src/utils/update-from.ts +2 -2
- package/src/utils/webrtc.ts +11 -4
- package/src/voice/call.ts +109 -36
- package/src/voice/softphone.ts +75 -18
- package/src/web-rtc-client.ts +112 -98
|
@@ -125,7 +125,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
125
125
|
return __awaiter(this, arguments, void 0, function* (callSession, constraints = null, conference = false, audioOnly = false, iceRestart = false) {
|
|
126
126
|
const sipSession = this.findSipSession(callSession);
|
|
127
127
|
logger.info('WebRTC phone - send reinvite', {
|
|
128
|
-
sessionId:
|
|
128
|
+
sessionId: (0, sdp_1.getSipCallId)(sipSession),
|
|
129
129
|
constraints,
|
|
130
130
|
audioOnly,
|
|
131
131
|
conference,
|
|
@@ -283,7 +283,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
283
283
|
content: {
|
|
284
284
|
type: exports.ON_MESSAGE_TRACK_UPDATED,
|
|
285
285
|
update: isUpgrade ? 'upgrade' : 'downgrade',
|
|
286
|
-
sipCallId: sipSession && (0, sdp_1.
|
|
286
|
+
sipCallId: sipSession && (0, sdp_1.getSipCallId)(sipSession),
|
|
287
287
|
callId: callSession ? callSession.callId : null,
|
|
288
288
|
number: callSession ? callSession.number : null,
|
|
289
289
|
},
|
|
@@ -291,7 +291,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
291
291
|
}, 2500);
|
|
292
292
|
}
|
|
293
293
|
_bindEvents(sipSession) {
|
|
294
|
-
const sipSessionId = (0, sdp_1.
|
|
294
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
295
295
|
if (sipSession instanceof api_1.Invitation) {
|
|
296
296
|
// Monkey patch to know when canceled with the CANCEL message
|
|
297
297
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
@@ -303,7 +303,9 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
303
303
|
onCancel(message);
|
|
304
304
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
305
305
|
const callSession = this._createCallSession(sipSession);
|
|
306
|
-
|
|
306
|
+
if (sipSessionId) {
|
|
307
|
+
delete this.callSessions[sipSessionId];
|
|
308
|
+
}
|
|
307
309
|
this.eventEmitter.emit(exports.ON_CALL_CANCELED, callSession, elsewhere);
|
|
308
310
|
};
|
|
309
311
|
}
|
|
@@ -311,14 +313,14 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
311
313
|
switch (newState) {
|
|
312
314
|
case session_state_1.SessionState.Terminating:
|
|
313
315
|
logger.info('WebRTC phone - call terminating', {
|
|
314
|
-
sipId: sipSession
|
|
316
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
315
317
|
});
|
|
316
318
|
this.eventEmitter.emit(exports.ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
317
319
|
break;
|
|
318
320
|
case session_state_1.SessionState.Terminated:
|
|
319
321
|
{
|
|
320
322
|
logger.info('WebRTC phone - call terminated', {
|
|
321
|
-
sipId: sipSession
|
|
323
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
322
324
|
});
|
|
323
325
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
324
326
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -345,7 +347,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
345
347
|
const [stream] = event.streams;
|
|
346
348
|
const kind = event && event.track && event.track.kind;
|
|
347
349
|
logger.info('on track stream called on the peer connection', {
|
|
348
|
-
callId: (0, sdp_1.
|
|
350
|
+
callId: (0, sdp_1.getSipCallId)(sipSession),
|
|
349
351
|
streamId: stream ? stream.id : null,
|
|
350
352
|
tracks: stream ? stream.getTracks() : null,
|
|
351
353
|
kind,
|
|
@@ -375,9 +377,9 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
375
377
|
}
|
|
376
378
|
const screenTrack = screenShareStream.getVideoTracks()[0];
|
|
377
379
|
const sipSession = this.currentSipSession;
|
|
378
|
-
const pc = sipSession && this.client.getPeerConnection((0, sdp_1.
|
|
380
|
+
const pc = sipSession && this.client.getPeerConnection((0, sdp_1.getSipCallId)(sipSession));
|
|
379
381
|
const sender = pc && pc.getSenders && pc.getSenders().find((s) => s && s.track && s.track.kind === 'video');
|
|
380
|
-
const localStream = sipSession && this.client.getLocalStream((0, sdp_1.
|
|
382
|
+
const localStream = sipSession && this.client.getLocalStream((0, sdp_1.getSipCallId)(sipSession));
|
|
381
383
|
const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
|
|
382
384
|
const hadVideo = !!videoTrack;
|
|
383
385
|
// Stop local video tracks
|
|
@@ -442,19 +444,19 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
442
444
|
}
|
|
443
445
|
_onScreenSharing(screenStream, sipSession, callSession, hadVideo, desktop) {
|
|
444
446
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
445
|
-
const sipSessionId = (0, sdp_1.
|
|
447
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
446
448
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
447
449
|
const sender = pc && pc.getSenders && pc.getSenders().find((s) => s && s.track && s.track.kind === 'video');
|
|
448
450
|
logger.info('WebRTC phone - on screensharing', {
|
|
449
451
|
hadVideo,
|
|
450
|
-
id: (0, sdp_1.
|
|
452
|
+
id: (0, sdp_1.getSipCallId)(sipSession),
|
|
451
453
|
screenTrack,
|
|
452
454
|
});
|
|
453
455
|
if (screenTrack) {
|
|
454
456
|
screenTrack.onended = () => {
|
|
455
457
|
logger.info('WebRTC phone - on screenshare ended', {
|
|
456
458
|
hadVideo,
|
|
457
|
-
id: (0, sdp_1.
|
|
459
|
+
id: (0, sdp_1.getSipCallId)(sipSession),
|
|
458
460
|
screenTrack,
|
|
459
461
|
});
|
|
460
462
|
this.eventEmitter.emit(exports.ON_SHARE_SCREEN_ENDING, this._createCallSession(sipSession, callSession));
|
|
@@ -474,13 +476,13 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
474
476
|
}
|
|
475
477
|
_onCallAccepted(sipSession, cameraEnabled) {
|
|
476
478
|
logger.info('WebRTC phone - on call accepted', {
|
|
477
|
-
sipId: sipSession
|
|
479
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
478
480
|
cameraEnabled,
|
|
479
481
|
});
|
|
480
482
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
481
483
|
if (this.currentSipSession && !this.isCurrentCallSipSession(callSession)) {
|
|
482
484
|
logger.info('WebRTC phone - on call accepted with another ongoing call, holding it', {
|
|
483
|
-
sipId: sipSession
|
|
485
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
484
486
|
cameraEnabled,
|
|
485
487
|
});
|
|
486
488
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
@@ -488,7 +490,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
488
490
|
this.currentSipSession = sipSession;
|
|
489
491
|
this.currentCallSession = callSession;
|
|
490
492
|
this.eventEmitter.emit(exports.ON_TERMINATE_SOUND, callSession, 'call accepted');
|
|
491
|
-
const sipSessionId = (0, sdp_1.
|
|
493
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
492
494
|
if (sipSessionId) {
|
|
493
495
|
this.removeIncomingSessions(sipSessionId);
|
|
494
496
|
}
|
|
@@ -551,9 +553,9 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
551
553
|
return this.currentSipSession && this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
552
554
|
}
|
|
553
555
|
_onCallTerminated(sipSession) {
|
|
554
|
-
const sipSessionId = (0, sdp_1.
|
|
556
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
555
557
|
logger.info('WebRTC phone - on call terminated', {
|
|
556
|
-
sipId: sipSession
|
|
558
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
557
559
|
sipSessionId,
|
|
558
560
|
ids: Object.keys(this.callSessions),
|
|
559
561
|
});
|
|
@@ -573,8 +575,8 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
573
575
|
}
|
|
574
576
|
if (sipSessionId) {
|
|
575
577
|
this.removeIncomingSessions(sipSessionId);
|
|
578
|
+
delete this.callSessions[sipSessionId];
|
|
576
579
|
}
|
|
577
|
-
delete this.callSessions[sipSessionId];
|
|
578
580
|
if (isCurrentSession) {
|
|
579
581
|
this.currentSipSession = undefined;
|
|
580
582
|
this.currentCallSession = undefined;
|
|
@@ -582,7 +584,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
582
584
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
583
585
|
// Re-trigger incoming call event for remaining incoming calls
|
|
584
586
|
logger.info('WebRTC phone - check to re-trigger incoming call', {
|
|
585
|
-
sipId: sipSession
|
|
587
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
586
588
|
shouldRetrigger,
|
|
587
589
|
hasIncomingCallSession,
|
|
588
590
|
});
|
|
@@ -643,7 +645,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
643
645
|
if (!this.currentSipSession) {
|
|
644
646
|
return false;
|
|
645
647
|
}
|
|
646
|
-
return this.currentSipSession && (0, sdp_1.
|
|
648
|
+
return this.currentSipSession && (0, sdp_1.getSipCallId)(this.currentSipSession) === callSession.getId();
|
|
647
649
|
}
|
|
648
650
|
hasVideo(callSession) {
|
|
649
651
|
return this.client.hasVideo(callSession.getId());
|
|
@@ -677,7 +679,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
677
679
|
logger.warn('no CallSession to accept.');
|
|
678
680
|
return Promise.resolve(null);
|
|
679
681
|
}
|
|
680
|
-
const sipSessionId = this.
|
|
682
|
+
const sipSessionId = this.getSipCallIdFromCallSession(callSession);
|
|
681
683
|
if (sipSessionId && !(sipSessionId in this.callSessions)) {
|
|
682
684
|
logger.warn('Call session already ended or not found, can\'t accept it.', {
|
|
683
685
|
sipSessionId,
|
|
@@ -697,7 +699,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
697
699
|
this.eventEmitter.emit(exports.ON_CALL_ANSWERED, callSession);
|
|
698
700
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
699
701
|
if (sipSession) {
|
|
700
|
-
logger.info('accept call, session found', { sipId: sipSession
|
|
702
|
+
logger.info('accept call, session found', { sipId: (0, sdp_1.getSipCallId)(sipSession) });
|
|
701
703
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
702
704
|
return callSession.sipCallId;
|
|
703
705
|
}).catch(e => {
|
|
@@ -709,7 +711,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
709
711
|
const error = 'No CallSession found to accept.';
|
|
710
712
|
logger.warn(error, {
|
|
711
713
|
id: callSession ? callSession.getId() : 'n/a',
|
|
712
|
-
ids: this.client.
|
|
714
|
+
ids: this.client.getSipCallIds(),
|
|
713
715
|
});
|
|
714
716
|
if (callSession) {
|
|
715
717
|
this.eventEmitter.emit(exports.ON_CALL_ERROR, new Error(error), callSession);
|
|
@@ -733,7 +735,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
733
735
|
const sipSession = this.findSipSession(callSession);
|
|
734
736
|
if (sipSession) {
|
|
735
737
|
logger.info('WebRTC rejecting', {
|
|
736
|
-
sipId: sipSession
|
|
738
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
737
739
|
});
|
|
738
740
|
this.client.hangup(sipSession);
|
|
739
741
|
}
|
|
@@ -754,7 +756,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
754
756
|
const sipSession = this.findSipSession(callSession);
|
|
755
757
|
if (sipSession) {
|
|
756
758
|
logger.info('WebRTC atxfer', {
|
|
757
|
-
sipId: sipSession
|
|
759
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
758
760
|
});
|
|
759
761
|
return this.client.atxfer(sipSession);
|
|
760
762
|
}
|
|
@@ -780,12 +782,12 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
780
782
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
781
783
|
}
|
|
782
784
|
logger.info('WebRTC resuming', {
|
|
783
|
-
sipId: sipSession
|
|
785
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
784
786
|
});
|
|
785
787
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
786
|
-
if (this.currentSipSession && this.currentSipSession
|
|
788
|
+
if (this.currentSipSession && (0, sdp_1.getSipCallId)(this.currentSipSession) !== (0, sdp_1.getSipCallId)(sipSession)) {
|
|
787
789
|
logger.info('WebRTC hold call after resume', {
|
|
788
|
-
id: this.currentSipSession
|
|
790
|
+
id: (0, sdp_1.getSipCallId)(this.currentSipSession),
|
|
789
791
|
});
|
|
790
792
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, withEvent);
|
|
791
793
|
}
|
|
@@ -801,10 +803,10 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
801
803
|
if (!sipSession) {
|
|
802
804
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
803
805
|
}
|
|
804
|
-
const sessionId = (0, sdp_1.
|
|
806
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
805
807
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
806
808
|
logger.info('WebRTC hold sip session', {
|
|
807
|
-
sipId: sipSession
|
|
809
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
808
810
|
hasVideo,
|
|
809
811
|
});
|
|
810
812
|
// Stop screenshare if needed
|
|
@@ -830,7 +832,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
830
832
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
831
833
|
}
|
|
832
834
|
const isConference = !!callSession && callSession.isConference();
|
|
833
|
-
const sessionId = (0, sdp_1.
|
|
835
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
834
836
|
logger.info('WebRTC unhold sip session', {
|
|
835
837
|
sessionId,
|
|
836
838
|
isConference,
|
|
@@ -883,7 +885,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
883
885
|
return;
|
|
884
886
|
}
|
|
885
887
|
logger.info('WebRTC muting', {
|
|
886
|
-
sipId: sipSession
|
|
888
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
887
889
|
});
|
|
888
890
|
this.client.mute(sipSession);
|
|
889
891
|
const newCallSession = this._createCallSession(sipSession, callSession, {
|
|
@@ -905,7 +907,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
905
907
|
return;
|
|
906
908
|
}
|
|
907
909
|
logger.info('WebRTC unmuting', {
|
|
908
|
-
sipId: sipSession
|
|
910
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
909
911
|
});
|
|
910
912
|
this.client.unmute(sipSession);
|
|
911
913
|
const newCallSession = this._createCallSession(sipSession, callSession, {
|
|
@@ -931,7 +933,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
931
933
|
return;
|
|
932
934
|
}
|
|
933
935
|
logger.info('WebRTC turn camera on', {
|
|
934
|
-
sipId: sipSession
|
|
936
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
935
937
|
});
|
|
936
938
|
this.client.toggleCameraOn(sipSession);
|
|
937
939
|
this.eventEmitter.emit(exports.ON_CAMERA_RESUMED, this._createCameraResumedCallSession(sipSession, callSession));
|
|
@@ -942,7 +944,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
942
944
|
return;
|
|
943
945
|
}
|
|
944
946
|
logger.info('WebRTC turn camera off', {
|
|
945
|
-
sipId: sipSession
|
|
947
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
946
948
|
});
|
|
947
949
|
this.client.toggleCameraOff(sipSession);
|
|
948
950
|
this.eventEmitter.emit(exports.ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -953,7 +955,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
953
955
|
return;
|
|
954
956
|
}
|
|
955
957
|
logger.info('WebRTC send key', {
|
|
956
|
-
sipId: sipSession
|
|
958
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
957
959
|
tone,
|
|
958
960
|
});
|
|
959
961
|
this.client.sendDTMF(sipSession, tone);
|
|
@@ -1018,7 +1020,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1018
1020
|
return;
|
|
1019
1021
|
}
|
|
1020
1022
|
logger.info('WebRTC transfer', {
|
|
1021
|
-
sipId: sipSession
|
|
1023
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
1022
1024
|
target,
|
|
1023
1025
|
});
|
|
1024
1026
|
this.client.transfer(sipSession, target);
|
|
@@ -1028,8 +1030,8 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1028
1030
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
1029
1031
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
1030
1032
|
logger.info('WebRTC indirect transfer', {
|
|
1031
|
-
sipId: sipSession ? sipSession
|
|
1032
|
-
target: sipSessionTarget ? sipSessionTarget
|
|
1033
|
+
sipId: sipSession ? (0, sdp_1.getSipCallId)(sipSession) : null,
|
|
1034
|
+
target: sipSessionTarget ? (0, sdp_1.getSipCallId)(sipSessionTarget) : null,
|
|
1033
1035
|
});
|
|
1034
1036
|
if (!sipSessionTarget) {
|
|
1035
1037
|
return Promise.reject();
|
|
@@ -1059,9 +1061,9 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1059
1061
|
console.error('Call is unknown to the WebRTC phone', callSession ? callSession.sipCallId : null, callSession ? callSession.callId : null);
|
|
1060
1062
|
return false;
|
|
1061
1063
|
}
|
|
1062
|
-
const sipSessionId = (0, sdp_1.
|
|
1064
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1063
1065
|
logger.info('WebRTC hangup', {
|
|
1064
|
-
sipId: sipSession
|
|
1066
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
1065
1067
|
sipSessionId,
|
|
1066
1068
|
});
|
|
1067
1069
|
yield this.client.hangup(sipSession);
|
|
@@ -1219,7 +1221,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1219
1221
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
1220
1222
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
1221
1223
|
logger.info('WebRTC invite received', {
|
|
1222
|
-
sipId: sipSession
|
|
1224
|
+
sipId: (0, sdp_1.getSipCallId)(sipSession),
|
|
1223
1225
|
withVideo,
|
|
1224
1226
|
autoAnswer,
|
|
1225
1227
|
});
|
|
@@ -1251,12 +1253,12 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1251
1253
|
// if `_createCallSession` is called too soon `hasVideo` will return false because the stream doesn't exists yet
|
|
1252
1254
|
setTimeout(() => {
|
|
1253
1255
|
// Update callSession
|
|
1254
|
-
this._createCallSession(sipSession, this.callSessions[(0, sdp_1.
|
|
1256
|
+
this._createCallSession(sipSession, this.callSessions[(0, sdp_1.getSipCallId)(sipSession)]);
|
|
1255
1257
|
this.eventEmitter.emit.apply(this.eventEmitter, [this.client.ON_REINVITE, ...args]);
|
|
1256
1258
|
}, 2000);
|
|
1257
1259
|
});
|
|
1258
1260
|
this.client.on(this.client.ACCEPTED, (sipSession) => __awaiter(this, void 0, void 0, function* () {
|
|
1259
|
-
const sessionId = (0, sdp_1.
|
|
1261
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1260
1262
|
const hasSession = (sessionId in this.callSessions);
|
|
1261
1263
|
logger.info('WebRTC call accepted', {
|
|
1262
1264
|
sipId: sessionId,
|
|
@@ -1279,11 +1281,11 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1279
1281
|
this.eventEmitter.emit(exports.ON_CALL_ERROR, e);
|
|
1280
1282
|
});
|
|
1281
1283
|
this.client.on(this.client.REJECTED, session => {
|
|
1282
|
-
logger.info('WebRTC call rejected',
|
|
1284
|
+
logger.info('WebRTC call rejected', { id: (0, sdp_1.getSipCallId)(session) });
|
|
1283
1285
|
const callSession = this._createCallSession(session);
|
|
1284
1286
|
// `_createCallSession` add the CallSession in `this.callSessions`.
|
|
1285
1287
|
// so we have to remove it or `callCount` will always return 1 even if the call was rejected
|
|
1286
|
-
delete this.callSessions[(0, sdp_1.
|
|
1288
|
+
delete this.callSessions[(0, sdp_1.getSipCallId)(session)];
|
|
1287
1289
|
callSession.endTime = new Date();
|
|
1288
1290
|
this.eventEmitter.emit(exports.ON_CALL_REJECTED, callSession);
|
|
1289
1291
|
});
|
|
@@ -1300,7 +1302,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1300
1302
|
const callSession = this._createCallSession(session, null, {
|
|
1301
1303
|
incoming: false,
|
|
1302
1304
|
ringing: true,
|
|
1303
|
-
callId: (0, sdp_1.
|
|
1305
|
+
callId: (0, sdp_1.getSipCallId)(session),
|
|
1304
1306
|
});
|
|
1305
1307
|
this.eventEmitter.emit(exports.ON_PROGRESS, callSession, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
1306
1308
|
});
|
|
@@ -1309,7 +1311,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1309
1311
|
const callSession = this._createCallSession(session, null, {
|
|
1310
1312
|
incoming: false,
|
|
1311
1313
|
ringing: true,
|
|
1312
|
-
callId: (0, sdp_1.
|
|
1314
|
+
callId: (0, sdp_1.getSipCallId)(session),
|
|
1313
1315
|
});
|
|
1314
1316
|
this.eventEmitter.emit(exports.ON_EARLY_MEDIA, callSession, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
1315
1317
|
});
|
|
@@ -1366,12 +1368,12 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1366
1368
|
this.eventEmitter.emit(exports.ON_MESSAGE, message);
|
|
1367
1369
|
});
|
|
1368
1370
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
1369
|
-
const callSession = this.getCallSession((0, sdp_1.
|
|
1371
|
+
const callSession = this.getCallSession((0, sdp_1.getSipCallId)(session));
|
|
1370
1372
|
this.eventEmitter.emit(exports.ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
1371
1373
|
});
|
|
1372
1374
|
// Used when upgrading directly in screenshare mode
|
|
1373
1375
|
this.client.on(this.client.ON_SCREEN_SHARING_REINVITE, (sipSession, response, desktop) => {
|
|
1374
|
-
const sipSessionId = (0, sdp_1.
|
|
1376
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1375
1377
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
1376
1378
|
const callSession = this.callSessions[sipSessionId];
|
|
1377
1379
|
logger.info('Updrading directly in screensharing mode', {
|
|
@@ -1383,10 +1385,10 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1383
1385
|
}
|
|
1384
1386
|
// Find a corresponding sipSession from a CallSession
|
|
1385
1387
|
findSipSession(callSession) {
|
|
1386
|
-
const keys = this.client.
|
|
1388
|
+
const keys = this.client.getSipCallIds();
|
|
1387
1389
|
const keyIndex = keys.findIndex(sessionId => callSession && callSession.isId(sessionId));
|
|
1388
1390
|
if (keyIndex === -1) {
|
|
1389
|
-
const currentSipSessionId = this.currentSipSession ? (0, sdp_1.
|
|
1391
|
+
const currentSipSessionId = this.currentSipSession ? (0, sdp_1.getSipCallId)(this.currentSipSession) : this.client.getSipCallIds()[0];
|
|
1390
1392
|
return currentSipSessionId ? this.client.getSipSession(currentSipSessionId) : null;
|
|
1391
1393
|
}
|
|
1392
1394
|
return this.client.getSipSession(keys[keyIndex]);
|
|
@@ -1394,12 +1396,12 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1394
1396
|
getCallSession(sipSessionId) {
|
|
1395
1397
|
return this.callSessions[sipSessionId];
|
|
1396
1398
|
}
|
|
1397
|
-
|
|
1399
|
+
getSipCallIdFromCallSession(callSession) {
|
|
1398
1400
|
const sipSession = this.findSipSession(callSession);
|
|
1399
|
-
return sipSession ? (0, sdp_1.
|
|
1401
|
+
return sipSession ? (0, sdp_1.getSipCallId)(sipSession) : null;
|
|
1400
1402
|
}
|
|
1401
1403
|
_updateCallSession(callSession) {
|
|
1402
|
-
const sipSessionId = this.
|
|
1404
|
+
const sipSessionId = this.getSipCallIdFromCallSession(callSession);
|
|
1403
1405
|
if (sipSessionId) {
|
|
1404
1406
|
this.callSessions[sipSessionId] = callSession;
|
|
1405
1407
|
}
|
|
@@ -1472,7 +1474,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1472
1474
|
const number = (0, sdp_1.getCallNumber)(sipSession);
|
|
1473
1475
|
const displayName = (0, sdp_1.getCallDisplayName)(sipSession);
|
|
1474
1476
|
const { state } = sipSession || {};
|
|
1475
|
-
const sessionId = (0, sdp_1.
|
|
1477
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1476
1478
|
fromSession = fromSession || this.callSessions[sessionId];
|
|
1477
1479
|
const callSession = new CallSession_1.default(Object.assign({ callId: fromSession && fromSession.callId, sipCallId: sessionId, sipStatus: state, displayName,
|
|
1478
1480
|
// @ts-ignore: date / number
|
package/lib/index.js
CHANGED
|
@@ -17,8 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.SOCKET_EVENTS = exports.WebSocketClient = exports.AdHocAPIConference = exports.CallApi = exports.setIsMobile = exports.setOnRefreshTokenError = exports.setOnRefreshToken = exports.setCurrentServer = exports.setApiToken = exports.getApiClient = exports.SipLine = exports.MeetingAuthorization = exports.MeetingStatus = exports.ApiRequester = exports.Checker = exports.DebugDevice = exports.Meeting = exports.CTIPhone = exports.WebRTCPhone = exports.CallerID = exports.SwitchboardCall = exports.IndirectTransfer = exports.CallSession = exports.Room = exports.Relocation = exports.Voicemail = exports.Session = exports.LINE_STATE = exports.PROFILE_STATE = exports.Profile = exports.NotificationOptions = exports.Line = exports.Incall = exports.FORWARD_KEYS = exports.ForwardOption = exports.Features = exports.COUNTRIES = exports.Contact = exports.ChatRoom = exports.ChatMessage = exports.Recording = exports.CallLog = exports.
|
|
21
|
-
exports.SessionDescriptionHandler = exports.ExternalApp = exports.Agent = exports.WazoApiClient = exports.WebRTCClient = void 0;
|
|
20
|
+
exports.SOCKET_EVENTS = exports.WebSocketClient = exports.AdHocAPIConference = exports.CallApi = exports.setIsMobile = exports.setOnRefreshTokenError = exports.setOnRefreshToken = exports.setCurrentServer = exports.setApiToken = exports.getApiClient = exports.SipLine = exports.MeetingAuthorization = exports.MeetingStatus = exports.ApiRequester = exports.Checker = exports.DebugDevice = exports.Meeting = exports.CTIPhone = exports.WebRTCPhone = exports.CallerID = exports.SwitchboardCall = exports.IndirectTransfer = exports.CallSession = exports.Room = exports.Relocation = exports.Voicemail = exports.Session = exports.LINE_STATE = exports.PROFILE_STATE = exports.Profile = exports.NotificationOptions = exports.Line = exports.Incall = exports.FORWARD_KEYS = exports.ForwardOption = exports.Features = exports.COUNTRIES = exports.Contact = exports.ChatRoom = exports.ChatMessage = exports.Recording = exports.CallLog = exports.ApiCall = exports.SFUNotAvailableError = exports.InvalidState = exports.InvalidStateTransition = exports.ServerError = exports.BadResponse = exports.IssueReporter = exports.Emitter = void 0;
|
|
21
|
+
exports.Softphone = exports.Call = exports.SessionDescriptionHandler = exports.ExternalApp = exports.Agent = exports.WazoApiClient = exports.WebRTCClient = void 0;
|
|
22
22
|
const index_1 = __importDefault(require("./simple/index"));
|
|
23
23
|
var Emitter_1 = require("./utils/Emitter");
|
|
24
24
|
Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return __importDefault(Emitter_1).default; } });
|
|
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "InvalidState", { enumerable: true, get: function
|
|
|
35
35
|
var SFUNotAvailableError_1 = require("./domain/SFUNotAvailableError");
|
|
36
36
|
Object.defineProperty(exports, "SFUNotAvailableError", { enumerable: true, get: function () { return __importDefault(SFUNotAvailableError_1).default; } });
|
|
37
37
|
var Call_1 = require("./domain/Call");
|
|
38
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "ApiCall", { enumerable: true, get: function () { return __importDefault(Call_1).default; } });
|
|
39
39
|
var CallLog_1 = require("./domain/CallLog");
|
|
40
40
|
Object.defineProperty(exports, "CallLog", { enumerable: true, get: function () { return __importDefault(CallLog_1).default; } });
|
|
41
41
|
var Recording_1 = require("./domain/Recording");
|
|
@@ -121,6 +121,10 @@ var ExternalApp_1 = require("./domain/ExternalApp");
|
|
|
121
121
|
Object.defineProperty(exports, "ExternalApp", { enumerable: true, get: function () { return __importDefault(ExternalApp_1).default; } });
|
|
122
122
|
var WazoSessionDescriptionHandler_1 = require("./lib/WazoSessionDescriptionHandler");
|
|
123
123
|
Object.defineProperty(exports, "SessionDescriptionHandler", { enumerable: true, get: function () { return __importDefault(WazoSessionDescriptionHandler_1).default; } });
|
|
124
|
+
var call_1 = require("./voice/call");
|
|
125
|
+
Object.defineProperty(exports, "Call", { enumerable: true, get: function () { return __importDefault(call_1).default; } });
|
|
126
|
+
var softphone_1 = require("./voice/softphone");
|
|
127
|
+
Object.defineProperty(exports, "Softphone", { enumerable: true, get: function () { return softphone_1.Softphone; } });
|
|
124
128
|
__exportStar(require("./types/WebSocketMessage"), exports);
|
|
125
129
|
__exportStar(require("./utils/PhoneNumberUtil"), exports);
|
|
126
130
|
__exportStar(require("./utils/string"), exports);
|
package/lib/service/CallApi.js
CHANGED
|
@@ -51,9 +51,9 @@ class CallApi {
|
|
|
51
51
|
return (0, getApiClient_1.default)().confd.getUserLineSip(session.uuid, lineToUse ? lineToUse.id : '');
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
static cancelCall(
|
|
54
|
+
static cancelCall(call) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
return (0, getApiClient_1.default)().calld.cancelCall(
|
|
56
|
+
return (0, getApiClient_1.default)().calld.cancelCall(call.apiId || '');
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
static makeCall(callFromLine_1, extension_1) {
|
package/lib/simple/Auth.js
CHANGED
|
@@ -154,6 +154,11 @@ class Auth {
|
|
|
154
154
|
return this._onAuthenticated(rawSession);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
+
samlLogOut() {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
return yield this.logout(false, true);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
157
162
|
initiateIdpAuthentication(domain, redirectUrl) {
|
|
158
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
164
|
try {
|
|
@@ -206,20 +211,26 @@ class Auth {
|
|
|
206
211
|
});
|
|
207
212
|
}
|
|
208
213
|
logout() {
|
|
209
|
-
return __awaiter(this, arguments, void 0, function* (deleteRefreshToken = true) {
|
|
214
|
+
return __awaiter(this, arguments, void 0, function* (deleteRefreshToken = true, saml = false) {
|
|
210
215
|
var _a;
|
|
211
216
|
try {
|
|
212
217
|
index_1.default.Websocket.close(true);
|
|
213
|
-
if (this.clientId && deleteRefreshToken) {
|
|
218
|
+
if (!saml && this.clientId && deleteRefreshToken) {
|
|
214
219
|
yield (0, getApiClient_1.default)().auth.deleteRefreshToken(this.clientId);
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
catch (e) {
|
|
218
223
|
// Nothing to
|
|
219
224
|
}
|
|
225
|
+
let response;
|
|
220
226
|
try {
|
|
221
227
|
if ((_a = this.session) === null || _a === void 0 ? void 0 : _a.token) {
|
|
222
|
-
|
|
228
|
+
if (saml) {
|
|
229
|
+
response = yield (0, getApiClient_1.default)().auth.samlLogOut();
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
yield (0, getApiClient_1.default)().auth.logOut(this.session.token);
|
|
233
|
+
}
|
|
223
234
|
}
|
|
224
235
|
}
|
|
225
236
|
catch (e) {
|
|
@@ -231,6 +242,7 @@ class Auth {
|
|
|
231
242
|
this.authenticated = false;
|
|
232
243
|
this.usingEdgeServer = undefined;
|
|
233
244
|
(0, getApiClient_1.setFetchOptions)({});
|
|
245
|
+
return response;
|
|
234
246
|
});
|
|
235
247
|
}
|
|
236
248
|
setOnHostFromHeaders(callback) {
|
package/lib/simple/Phone.js
CHANGED
|
@@ -237,11 +237,11 @@ class Phone extends Emitter_1.default {
|
|
|
237
237
|
stopNetworkMonitoring(callSession) {
|
|
238
238
|
return this.phone ? this.phone.stopNetworkMonitoring(callSession) : null;
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
getSipCallId(sipSession) {
|
|
241
241
|
if (!sipSession || !this.phone) {
|
|
242
242
|
return null;
|
|
243
243
|
}
|
|
244
|
-
return (0, sdp_1.
|
|
244
|
+
return (0, sdp_1.getSipCallId)(sipSession);
|
|
245
245
|
}
|
|
246
246
|
sendMessage(body, sipSession, contentType = 'text/plain') {
|
|
247
247
|
const toSipSession = sipSession || this.getCurrentSipSession();
|
package/lib/simple/index.js
CHANGED
|
@@ -68,7 +68,7 @@ const IssueReporter_1 = __importDefault(require("../service/IssueReporter"));
|
|
|
68
68
|
const Features_1 = __importDefault(require("../domain/Features"));
|
|
69
69
|
const Meeting_1 = __importDefault(require("../domain/Meeting"));
|
|
70
70
|
const Checker_1 = __importDefault(require("../checker/Checker"));
|
|
71
|
-
const softphone_1 =
|
|
71
|
+
const softphone_1 = __importStar(require("../voice/softphone"));
|
|
72
72
|
const call_1 = __importDefault(require("../voice/call"));
|
|
73
73
|
const Wazo = {
|
|
74
74
|
Auth: Auth_1.default,
|
|
@@ -117,6 +117,7 @@ const Wazo = {
|
|
|
117
117
|
SwitchboardCall: SwitchboardCall_1.default,
|
|
118
118
|
WebRTCPhone: WebRTCPhone_1.default,
|
|
119
119
|
Meeting: Meeting_1.default,
|
|
120
|
+
SoftphoneClass: softphone_1.Softphone,
|
|
120
121
|
},
|
|
121
122
|
// Api
|
|
122
123
|
get api() {
|
package/lib/simple/room/Room.js
CHANGED
|
@@ -372,7 +372,7 @@ class Room extends Emitter_1.default {
|
|
|
372
372
|
logger.info('on room audio stream');
|
|
373
373
|
this.audioStream = stream;
|
|
374
374
|
if (!this.roomAudioElement) {
|
|
375
|
-
const sessionId = (0, sdp_1.
|
|
375
|
+
const sessionId = (0, sdp_1.getSipCallId)((_b = index_1.default.Phone.phone) === null || _b === void 0 ? void 0 : _b.currentSipSession);
|
|
376
376
|
this.roomAudioElement = (yield ((_c = index_1.default.Phone.phone) === null || _c === void 0 ? void 0 : _c.createAudioElementFor(sessionId)));
|
|
377
377
|
this.roomAudioElement.srcObject = stream;
|
|
378
378
|
}
|
|
@@ -136,7 +136,7 @@ class SipRoom extends Room_1.default {
|
|
|
136
136
|
}
|
|
137
137
|
_getCurrentSipCallIs() {
|
|
138
138
|
var _a;
|
|
139
|
-
return (0, sdp_1.
|
|
139
|
+
return (0, sdp_1.getSipCallId)((_a = index_1.default.Phone.phone) === null || _a === void 0 ? void 0 : _a.currentSipSession);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
exports.default = SipRoom;
|