@vgroup/dialbox 0.8.23 → 0.8.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/esm2020/lib/components/call-progress/call-progress.component.mjs +73 -8
- package/fesm2015/vgroup-dialbox.mjs +79 -13
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +72 -7
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/components/call-progress/call-progress.component.d.ts +3 -0
- package/package.json +1 -1
- package/vgroup-dialbox-0.8.20.tgz +4 -0
- package/vgroup-dialbox-0.8.21.tgz +0 -0
|
@@ -2342,6 +2342,8 @@ class CallProgressComponent {
|
|
|
2342
2342
|
this.conferenceCallList = [];
|
|
2343
2343
|
this.isIncomingCallBtnDisable = false;
|
|
2344
2344
|
this.isConnecting = false;
|
|
2345
|
+
// Incoming calls the user already ended – blocks a quick Green click from accepting them again
|
|
2346
|
+
this.rejectedIncomingCallIds = new Set();
|
|
2345
2347
|
this.isNewAddedCall = false;
|
|
2346
2348
|
this.deviceNumberList = [];
|
|
2347
2349
|
this.ourNumberInfo = {};
|
|
@@ -3072,7 +3074,7 @@ class CallProgressComponent {
|
|
|
3072
3074
|
yield this.pollCallStatus(callAuthId);
|
|
3073
3075
|
console.log('Call initiated successfully:', response);
|
|
3074
3076
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
3075
|
-
var _f, _g, _h, _j;
|
|
3077
|
+
var _f, _g, _h, _j, _k;
|
|
3076
3078
|
try {
|
|
3077
3079
|
const clientSid = yield this.waitForClientCallSid(isNewConference);
|
|
3078
3080
|
// Client leg connected (or gave up) – socket idle handling can run normally again
|
|
@@ -3120,13 +3122,15 @@ class CallProgressComponent {
|
|
|
3120
3122
|
}).catch((err) => err === null || err === void 0 ? void 0 : err.error);
|
|
3121
3123
|
if (this.isAddParticipantFailed(this.addRes)) {
|
|
3122
3124
|
this.showAddParticipantError(this.addRes);
|
|
3125
|
+
this.disconnectFailedCall((_h = response === null || response === void 0 ? void 0 : response.callauth) === null || _h === void 0 ? void 0 : _h.id, isNewConference);
|
|
3126
|
+
return;
|
|
3123
3127
|
}
|
|
3124
3128
|
this.isNewCallLoader = false;
|
|
3125
3129
|
if (isNewConference) {
|
|
3126
|
-
this.conferenceCallIDForParticipantList = (
|
|
3130
|
+
this.conferenceCallIDForParticipantList = (_j = response === null || response === void 0 ? void 0 : response.callauth) === null || _j === void 0 ? void 0 : _j.id;
|
|
3127
3131
|
}
|
|
3128
3132
|
this.isNewAddedCall = false;
|
|
3129
|
-
if (((
|
|
3133
|
+
if (((_k = this.newIncomingCallsList) === null || _k === void 0 ? void 0 : _k.length) > 1) {
|
|
3130
3134
|
this.extensionService.isLoadershow.next(false);
|
|
3131
3135
|
this.isLoadershown.emit(false);
|
|
3132
3136
|
}
|
|
@@ -3389,6 +3393,33 @@ class CallProgressComponent {
|
|
|
3389
3393
|
const message = Array.isArray(res === null || res === void 0 ? void 0 : res.message) ? res.message.join('<br/>') : res === null || res === void 0 ? void 0 : res.message;
|
|
3390
3394
|
swal('Error', message || 'Failed to add participant. Please try again.', 'error');
|
|
3391
3395
|
}
|
|
3396
|
+
// addParticipant failed for a newly started call: close its conference (drops our client leg too).
|
|
3397
|
+
// Only call → back to the dialpad; otherwise the socket feed auto-unholds the previously held conference.
|
|
3398
|
+
disconnectFailedCall(conferenceId, isNewConference) {
|
|
3399
|
+
var _a, _b, _c;
|
|
3400
|
+
this.specialCallConferenceIds.delete(conferenceId);
|
|
3401
|
+
if (conferenceId) {
|
|
3402
|
+
this.extensionService.getRemoveParticipants('all', conferenceId).subscribe({
|
|
3403
|
+
error: (err) => console.error('Error closing failed call:', err)
|
|
3404
|
+
});
|
|
3405
|
+
}
|
|
3406
|
+
this.showRingAnimation = false;
|
|
3407
|
+
this.isNewCallLoader = false;
|
|
3408
|
+
this.isNewAddedCall = false;
|
|
3409
|
+
this.showNewCallLoader = false;
|
|
3410
|
+
this.extensionService.isLoadershow.next(false);
|
|
3411
|
+
this.isLoadershown.emit(false);
|
|
3412
|
+
const hasOtherCalls = (_a = this.newIncomingCallsList) === null || _a === void 0 ? void 0 : _a.some((c) => (c === null || c === void 0 ? void 0 : c.conferenceId) != conferenceId);
|
|
3413
|
+
if (isNewConference && hasOtherCalls) {
|
|
3414
|
+
this.pendingAutoUnhold = true;
|
|
3415
|
+
this.unholdPendingConference();
|
|
3416
|
+
}
|
|
3417
|
+
else {
|
|
3418
|
+
(_c = (_b = this.call) === null || _b === void 0 ? void 0 : _b.disconnect) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
3419
|
+
this.endCallEvent.emit();
|
|
3420
|
+
}
|
|
3421
|
+
this.cdr.detectChanges();
|
|
3422
|
+
}
|
|
3392
3423
|
initiateCall(payload) {
|
|
3393
3424
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3394
3425
|
return yield this.extensionService.initiateCall(payload).toPromise();
|
|
@@ -3758,6 +3789,10 @@ class CallProgressComponent {
|
|
|
3758
3789
|
acceptIncomingCall(data, ourNumberInfo, capturedCall) {
|
|
3759
3790
|
var _a;
|
|
3760
3791
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3792
|
+
// Call already ended by the user, or this call is already connecting – ignore the click
|
|
3793
|
+
if (!(data === null || data === void 0 ? void 0 : data.id) || this.rejectedIncomingCallIds.has(data.id) || this.isConnectingIncomingCallId == data.id) {
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3761
3796
|
if (!((_a = this.currentCallList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
3762
3797
|
this.twilioService.setIncomingMuted(false);
|
|
3763
3798
|
}
|
|
@@ -3766,10 +3801,17 @@ class CallProgressComponent {
|
|
|
3766
3801
|
this.twilioService.isConnectingIncomingCallId.next(data === null || data === void 0 ? void 0 : data.id);
|
|
3767
3802
|
this.isIncomingCallBtnDisable = true;
|
|
3768
3803
|
this.cdr.detectChanges();
|
|
3804
|
+
const acceptStartTime = Date.now();
|
|
3769
3805
|
let intervalId = setInterval(() => {
|
|
3770
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3806
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3771
3807
|
const callToAccept = this.twilioService.getIncomingCallById(data === null || data === void 0 ? void 0 : data.clientSid);
|
|
3772
|
-
|
|
3808
|
+
// Twilio call never showed up (ended meanwhile) – don't leave the UI stuck on Connecting
|
|
3809
|
+
if (!((_a = callToAccept === null || callToAccept === void 0 ? void 0 : callToAccept.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) && (this.rejectedIncomingCallIds.has(data.id) || Date.now() - acceptStartTime >= 15000)) {
|
|
3810
|
+
clearInterval(intervalId);
|
|
3811
|
+
this.resetIncomingConnectingState(data);
|
|
3812
|
+
return;
|
|
3813
|
+
}
|
|
3814
|
+
if ((_b = callToAccept === null || callToAccept === void 0 ? void 0 : callToAccept.parameters) === null || _b === void 0 ? void 0 : _b.CallSid) {
|
|
3773
3815
|
clearInterval(intervalId);
|
|
3774
3816
|
const acceptedEntry = {
|
|
3775
3817
|
call: callToAccept,
|
|
@@ -3824,7 +3866,7 @@ class CallProgressComponent {
|
|
|
3824
3866
|
// this listener. If it did, acceptedCallList would stay non-empty forever, which
|
|
3825
3867
|
// permanently blocks teardownSpareDevicesIfIdle(), the idle device.disconnectAll()
|
|
3826
3868
|
// reset in dialbox.component.ts, and twilioService's self-recovery guards.
|
|
3827
|
-
const acceptedSid = (
|
|
3869
|
+
const acceptedSid = (_c = callToAccept.parameters) === null || _c === void 0 ? void 0 : _c.CallSid;
|
|
3828
3870
|
callToAccept.on('disconnect', () => {
|
|
3829
3871
|
if (acceptedSid) {
|
|
3830
3872
|
this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== acceptedSid);
|
|
@@ -3873,17 +3915,18 @@ class CallProgressComponent {
|
|
|
3873
3915
|
this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
|
|
3874
3916
|
this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => { var _a; return ((_a = c.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) !== sid; });
|
|
3875
3917
|
this.twilioService.isConnectingIncomingCallId.next('');
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
this.currentCallList.splice(index, 1);
|
|
3879
|
-
}
|
|
3918
|
+
this.isConnectingIncomingCallId = '';
|
|
3919
|
+
this.currentCallList = this.currentCallList.filter((res) => (res === null || res === void 0 ? void 0 : res.id) != (data === null || data === void 0 ? void 0 : data.id));
|
|
3880
3920
|
this.twilioService.isShowIncomingCall = false;
|
|
3881
3921
|
this.isConnecting = false;
|
|
3882
3922
|
this.isIncomingCallBtnDisable = false;
|
|
3883
3923
|
this.incomeingCallSocketService.pause();
|
|
3884
3924
|
this.endCallEvent.emit(data);
|
|
3885
3925
|
this.cdr.detectChanges();
|
|
3886
|
-
|
|
3926
|
+
// User already ended this call – the "already answered" error is expected, don't show it
|
|
3927
|
+
if (!this.rejectedIncomingCallIds.has(data === null || data === void 0 ? void 0 : data.id)) {
|
|
3928
|
+
swal("Error", ((_e = (_d = res === null || res === void 0 ? void 0 : res.message) === null || _d === void 0 ? void 0 : _d.join) === null || _e === void 0 ? void 0 : _e.call(_d, "<br/>")) || 'Internal Server Error', "error");
|
|
3929
|
+
}
|
|
3887
3930
|
}
|
|
3888
3931
|
setTimeout(() => {
|
|
3889
3932
|
this.isUnholdConferenceCall = false;
|
|
@@ -3893,9 +3936,9 @@ class CallProgressComponent {
|
|
|
3893
3936
|
callToAccept.accept();
|
|
3894
3937
|
this.cdr.detectChanges();
|
|
3895
3938
|
}
|
|
3896
|
-
else if (((
|
|
3939
|
+
else if (((_f = (_e = (_d = this.missCallInfo) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.recordId) == (data === null || data === void 0 ? void 0 : data.id) && !((_g = callToAccept === null || callToAccept === void 0 ? void 0 : callToAccept.parameters) === null || _g === void 0 ? void 0 : _g.CallSid)) {
|
|
3897
3940
|
clearInterval(intervalId);
|
|
3898
|
-
const sid = (
|
|
3941
|
+
const sid = (_h = callToAccept === null || callToAccept === void 0 ? void 0 : callToAccept.parameters) === null || _h === void 0 ? void 0 : _h.CallSid;
|
|
3899
3942
|
this.twilioService.isConnectingIncomingCallId.next('');
|
|
3900
3943
|
this.isConnectingIncomingCallId = '';
|
|
3901
3944
|
this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
|
|
@@ -3923,6 +3966,21 @@ class CallProgressComponent {
|
|
|
3923
3966
|
}, 1000);
|
|
3924
3967
|
});
|
|
3925
3968
|
}
|
|
3969
|
+
// Accept could not start (Twilio call gone / timed out): drop the Connecting state and go back to idle
|
|
3970
|
+
resetIncomingConnectingState(data) {
|
|
3971
|
+
this.twilioService.isConnectingIncomingCallId.next('');
|
|
3972
|
+
this.isConnectingIncomingCallId = '';
|
|
3973
|
+
this.currentCallList = this.currentCallList.filter((res) => (res === null || res === void 0 ? void 0 : res.id) != (data === null || data === void 0 ? void 0 : data.id));
|
|
3974
|
+
this.twilioService.isShowIncomingCall = false;
|
|
3975
|
+
this.isConnecting = false;
|
|
3976
|
+
this.isIncomingCallBtnDisable = false;
|
|
3977
|
+
this.incomeingCallSocketService.pause();
|
|
3978
|
+
this.endCallEvent.emit(data);
|
|
3979
|
+
this.cdr.detectChanges();
|
|
3980
|
+
setTimeout(() => {
|
|
3981
|
+
this.isUnholdConferenceCall = false;
|
|
3982
|
+
}, 500);
|
|
3983
|
+
}
|
|
3926
3984
|
callContact(contact, isUnsavedNumber, options, participantInfo) {
|
|
3927
3985
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
3928
3986
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4663,6 +4721,14 @@ class CallProgressComponent {
|
|
|
4663
4721
|
return (hours * 60) + minutes;
|
|
4664
4722
|
}
|
|
4665
4723
|
onRejectCall(callInfo) {
|
|
4724
|
+
if (!(callInfo === null || callInfo === void 0 ? void 0 : callInfo.id) || this.rejectedIncomingCallIds.has(callInfo.id)) {
|
|
4725
|
+
return;
|
|
4726
|
+
}
|
|
4727
|
+
// Mark ended right away and hide the ringing screen so a quick Green click can't accept it
|
|
4728
|
+
this.rejectedIncomingCallIds.add(callInfo.id);
|
|
4729
|
+
setTimeout(() => this.rejectedIncomingCallIds.delete(callInfo.id), 60000);
|
|
4730
|
+
this.currentCallList = this.currentCallList.filter((res) => (res === null || res === void 0 ? void 0 : res.id) != (callInfo === null || callInfo === void 0 ? void 0 : callInfo.id));
|
|
4731
|
+
this.cdr.detectChanges();
|
|
4666
4732
|
let payload = {
|
|
4667
4733
|
channelId: environment.channelId,
|
|
4668
4734
|
recordId: callInfo === null || callInfo === void 0 ? void 0 : callInfo.id,
|