@vgroup/dialbox 0.7.91 → 0.7.93
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 +43 -17
- package/esm2020/lib/dialbox.component.mjs +16 -15
- package/esm2020/lib/environments/environments.mjs +12 -12
- package/esm2020/lib/service/twilio.service.mjs +6 -1
- package/fesm2015/vgroup-dialbox.mjs +89 -57
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +73 -41
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -62,23 +62,23 @@ const keypad = [
|
|
|
62
62
|
];
|
|
63
63
|
|
|
64
64
|
const environment = {
|
|
65
|
-
abb: "
|
|
65
|
+
abb: "u",
|
|
66
66
|
production: false,
|
|
67
67
|
secureCookies: true,
|
|
68
|
-
feUrl: 'https://
|
|
69
|
-
apiUrl: 'https://
|
|
70
|
-
websocketUrl: 'wss://
|
|
68
|
+
feUrl: 'https://c2c-uat.contexttocall.com:85/',
|
|
69
|
+
apiUrl: 'https://c2c-uatapi-t10.contexttocall.com/uat_softphone',
|
|
70
|
+
websocketUrl: 'wss://c2c-uatapi-t10.contexttocall.com/uat_softphone/',
|
|
71
71
|
captchaKey: "6LfpOmEaAAAAAGsI6JXlMzOl3b7rW4YmYXFDjldD",
|
|
72
|
-
stripePublishableKey: "
|
|
72
|
+
stripePublishableKey: "pk_live_51NbMVaA3guus6fhl85gdcvAWHzfHba5LdGlsnV7DxBT9spHghn4IHT9rDCjSRgFh2ijTiZn9qeazdciY1PbreOuB00t1GdQAZJ",
|
|
73
73
|
sessionTimeout: 15,
|
|
74
74
|
deviceType: "web",
|
|
75
|
-
appVersion: "2.
|
|
76
|
-
channelId: '
|
|
75
|
+
appVersion: "2.9",
|
|
76
|
+
channelId: '6511738039ee10367cbde2e9',
|
|
77
77
|
c2c_support_point_id: '60424735f74ac306c1bfa900',
|
|
78
|
-
c2c_support_channel_id: '
|
|
79
|
-
c2c_point_url: 'https://
|
|
80
|
-
c2c_call_label_id: '
|
|
81
|
-
c2c_email_label_id: '
|
|
78
|
+
c2c_support_channel_id: '677f68fcbe93ab507fbbfe0b',
|
|
79
|
+
c2c_point_url: 'https://bit.ly/3blWnPv',
|
|
80
|
+
c2c_call_label_id: '5M4taT8xzAg9pPIUADOW',
|
|
81
|
+
c2c_email_label_id: 'MUUC4NV5bLqHixXyhmok',
|
|
82
82
|
radarAPIKey: 'prj_live_sk_569b6f639edde6120a26f703511c61aaecd3f7ef',
|
|
83
83
|
firebase: {
|
|
84
84
|
apiKey: "AIzaSyCA8LSPrqlDq_thk26LhBQexAQeY6pkU5Y",
|
|
@@ -1650,6 +1650,11 @@ class TwilioService {
|
|
|
1650
1650
|
};
|
|
1651
1651
|
this.currentDeviceErrorHandler = onDeviceError;
|
|
1652
1652
|
device.on('error', onDeviceError);
|
|
1653
|
+
device.on('disconnect', () => {
|
|
1654
|
+
console.log('Twilio Device disconnected');
|
|
1655
|
+
this.isShowIncomingCall = false;
|
|
1656
|
+
this.scheduleDeviceRecovery();
|
|
1657
|
+
});
|
|
1653
1658
|
const onDeviceUnregistered = () => {
|
|
1654
1659
|
// Stale event from a device we've already intentionally replaced — ignore.
|
|
1655
1660
|
if (this.device !== device)
|
|
@@ -2342,7 +2347,6 @@ class CallProgressComponent {
|
|
|
2342
2347
|
if (!this.deviceNumberList?.length) {
|
|
2343
2348
|
this.deviceNumberList = this.callerIdList.map((res) => res.number);
|
|
2344
2349
|
}
|
|
2345
|
-
console.log('newIncomingCallsList', this.newIncomingCallsList);
|
|
2346
2350
|
this.newIncomingCallsList.forEach((callInfo, i) => {
|
|
2347
2351
|
this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
|
|
2348
2352
|
let ourNumberInfo = this.newIncomingCallsList[i]?.participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.direction == 'outgoing-call' && resData?.client) || (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call' && (!resData?.businessNumber || (resData?.businessNumber && callInfo?.participants?.length == 1)))) && !resData?.isLeft);
|
|
@@ -2424,7 +2428,6 @@ class CallProgressComponent {
|
|
|
2424
2428
|
this.startTimer(this.currentCall?.joinedAt);
|
|
2425
2429
|
}
|
|
2426
2430
|
else if (index != -1 && !res?.isLeft) {
|
|
2427
|
-
//console.log(res);
|
|
2428
2431
|
const participantId = res.id;
|
|
2429
2432
|
// Check if a mute update is pending for this participant
|
|
2430
2433
|
const isMutePending = this.pendingMuteParticipants.has(participantId);
|
|
@@ -2635,7 +2638,7 @@ class CallProgressComponent {
|
|
|
2635
2638
|
if (!this.currentConferenceCall?.conferenceId && this.currentCall?.conferenceId) {
|
|
2636
2639
|
this.timer = this.getTimeDifference(this.currentCall?.joinedAt);
|
|
2637
2640
|
}
|
|
2638
|
-
if (this.selectedUserInfo?.
|
|
2641
|
+
if (this.selectedUserInfo?.id) {
|
|
2639
2642
|
let selectedUser = this.currentCallList.find((item) => item?.id == this.selectedUserInfo?.id);
|
|
2640
2643
|
if (selectedUser && (selectedUser?.conferenceId == this.currentConferenceCall?.conferenceId || this.isClickExpand)) {
|
|
2641
2644
|
selectedUser.IsUserInfoShow = true;
|
|
@@ -2977,7 +2980,7 @@ class CallProgressComponent {
|
|
|
2977
2980
|
await this.pollCallStatus(callAuthId);
|
|
2978
2981
|
setTimeout(async () => {
|
|
2979
2982
|
try {
|
|
2980
|
-
let addClientParticipantRes = this.addClientParticipant({
|
|
2983
|
+
let addClientParticipantRes = await this.addClientParticipant({
|
|
2981
2984
|
from: callData?.from,
|
|
2982
2985
|
route: "OUTGOING",
|
|
2983
2986
|
participantNumber: callData?.phone,
|
|
@@ -2988,9 +2991,9 @@ class CallProgressComponent {
|
|
|
2988
2991
|
deviceId: this.deviceId,
|
|
2989
2992
|
clientSid: this.call?.parameters['CallSid']
|
|
2990
2993
|
});
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
+
if (addClientParticipantRes?.status != 200) {
|
|
2995
|
+
swal("Error", addClientParticipantRes?.message, "error");
|
|
2996
|
+
}
|
|
2994
2997
|
this.addRes = await this.addParticipantToCall({
|
|
2995
2998
|
from: callData?.from,
|
|
2996
2999
|
route: "OUTGOING",
|
|
@@ -3028,14 +3031,34 @@ class CallProgressComponent {
|
|
|
3028
3031
|
this.unholdPendingConference();
|
|
3029
3032
|
}
|
|
3030
3033
|
else {
|
|
3034
|
+
console.log(896);
|
|
3035
|
+
this.endCallEvent.emit();
|
|
3031
3036
|
this.endCall(); // regular call failure – disconnect everything
|
|
3032
3037
|
}
|
|
3033
3038
|
}
|
|
3034
3039
|
}
|
|
3035
3040
|
catch (error) {
|
|
3036
3041
|
this.showRingAnimation = false;
|
|
3037
|
-
|
|
3038
|
-
this
|
|
3042
|
+
// Whatever failed above (backend call, Twilio connect, etc.), the "Connecting..."
|
|
3043
|
+
// loader must always come down — previously this was left to endCall()/the socket
|
|
3044
|
+
// feed, and if either of those didn't run (or threw), the loader stayed on screen
|
|
3045
|
+
// forever with no way back to the dialpad.
|
|
3046
|
+
this.extensionService.isLoadershow.next(false);
|
|
3047
|
+
this.isLoadershown.emit(false);
|
|
3048
|
+
if (isNewConference) {
|
|
3049
|
+
this.unholdPendingConference();
|
|
3050
|
+
}
|
|
3051
|
+
else {
|
|
3052
|
+
console.log(896);
|
|
3053
|
+
this.endCallEvent.emit();
|
|
3054
|
+
try {
|
|
3055
|
+
this.endCall(); // regular call failure – disconnect everything
|
|
3056
|
+
}
|
|
3057
|
+
catch (cleanupError) {
|
|
3058
|
+
console.error('Error during call failure cleanup:', cleanupError);
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
this.handleError('Call not initiating due to a technical issue. Please try again.');
|
|
3039
3062
|
return false;
|
|
3040
3063
|
}
|
|
3041
3064
|
}
|
|
@@ -3130,9 +3153,19 @@ class CallProgressComponent {
|
|
|
3130
3153
|
// await this.getAllParticipants(c?.conferenceId);
|
|
3131
3154
|
}
|
|
3132
3155
|
async onEndCall(c, isAllCallEnd, isContect) {
|
|
3133
|
-
let participantId = isAllCallEnd ? 'all' : c
|
|
3156
|
+
let participantId = isAllCallEnd ? 'all' : c?.participantId || c?.id;
|
|
3134
3157
|
const currentConferenceCallInfo = this.getCurrentCallInfo();
|
|
3135
|
-
|
|
3158
|
+
// A call that failed/aborted before the backend ever created a conference for it
|
|
3159
|
+
// (e.g. initiateCall()/connectToDevice() threw) has no `c` and no matching entry
|
|
3160
|
+
// here — there is nothing to remove server-side, so just fall through to the
|
|
3161
|
+
// local cleanup below instead of throwing on `undefined.participants`.
|
|
3162
|
+
if (!c?.conferenceId && !isAllCallEnd) {
|
|
3163
|
+
this.conferenceCallIDForParticipantList = currentConferenceCallInfo?.conferenceId;
|
|
3164
|
+
this.incomeingCallSocketService.pause();
|
|
3165
|
+
this.cdr.detectChanges();
|
|
3166
|
+
return false;
|
|
3167
|
+
}
|
|
3168
|
+
const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId)?.participants.filter((resData) => !resData?.isLeft) || [];
|
|
3136
3169
|
if (participantList?.length <= 2 && !isContect) {
|
|
3137
3170
|
participantId = 'all';
|
|
3138
3171
|
}
|
|
@@ -3418,7 +3451,7 @@ class CallProgressComponent {
|
|
|
3418
3451
|
if (!this.C2ConfoList[userInfo?.participantId] && !this.C2ConfoList[userInfo?.businessParticipantId]) {
|
|
3419
3452
|
this.extensionService.getUserInformation(participantID).subscribe({
|
|
3420
3453
|
next: (resInfo) => {
|
|
3421
|
-
let index = this.currentCallList.findIndex((item) => item?.participantId ==
|
|
3454
|
+
let index = this.currentCallList.findIndex((item) => item?.participantId == participantID);
|
|
3422
3455
|
this.currentCallList[index] = this.mapUserInfo(this.currentCallList[index], resInfo?.c2cInformation);
|
|
3423
3456
|
this.selectedUserInfo = this.currentCallList[index];
|
|
3424
3457
|
this.C2ConfoList[participantID] = this.currentCallList[index];
|
|
@@ -3601,7 +3634,7 @@ class CallProgressComponent {
|
|
|
3601
3634
|
else if (this.missCallInfo?.data?.data?.recordId == data?.id && !callToAccept.parameters?.CallSid) {
|
|
3602
3635
|
clearInterval(intervalId);
|
|
3603
3636
|
const sid = callToAccept.parameters?.CallSid;
|
|
3604
|
-
this.isConnectingIncomingCallId
|
|
3637
|
+
this.twilioService.isConnectingIncomingCallId.next('');
|
|
3605
3638
|
this.isConnectingIncomingCallId = '';
|
|
3606
3639
|
this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
|
|
3607
3640
|
this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => c.parameters?.CallSid !== sid);
|
|
@@ -3742,7 +3775,7 @@ class CallProgressComponent {
|
|
|
3742
3775
|
catch (error) {
|
|
3743
3776
|
console.error('Error adding participant:', error);
|
|
3744
3777
|
this.showRingAnimation = false;
|
|
3745
|
-
this.handleError(
|
|
3778
|
+
this.handleError('Failed to add participant. Please try again.');
|
|
3746
3779
|
}
|
|
3747
3780
|
}
|
|
3748
3781
|
async CallToUnsavedNumber(number, isNewConference, options, participantInfo) {
|
|
@@ -4084,9 +4117,7 @@ class CallProgressComponent {
|
|
|
4084
4117
|
console.log(ev);
|
|
4085
4118
|
try {
|
|
4086
4119
|
let selfCall = this.newIncomingCallsList.find((res) => res?.conferenceId == this.currentCall?.conferenceId)?.participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.client) || (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call' && resData?.host)) && !resData?.isLeft);
|
|
4087
|
-
console.log(selfCall);
|
|
4088
4120
|
let device = this.twilioService.getIncomingCallById(selfCall?.callSid || selfCall?.clientSid);
|
|
4089
|
-
console.log(device);
|
|
4090
4121
|
if (device && device?._status == 'open') {
|
|
4091
4122
|
device.sendDigits(String(ev.key));
|
|
4092
4123
|
}
|
|
@@ -4903,7 +4934,7 @@ class DialboxComponent {
|
|
|
4903
4934
|
});
|
|
4904
4935
|
// Remove active-call entries whose conferenceId is no longer in the socket
|
|
4905
4936
|
// but keep incoming-call notifications (they are managed by notificationCallList expiry)
|
|
4906
|
-
this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.
|
|
4937
|
+
this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.callDirection === 'incoming-call');
|
|
4907
4938
|
// Remove expired notification entries
|
|
4908
4939
|
this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= new Date().getTime());
|
|
4909
4940
|
// Merge notificationCallList ONCE (not inside forEach). A pending incoming-call
|
|
@@ -4941,7 +4972,7 @@ class DialboxComponent {
|
|
|
4941
4972
|
this.cdk.detectChanges();
|
|
4942
4973
|
}
|
|
4943
4974
|
else {
|
|
4944
|
-
const hasPendingNotifications = this.incomingCallsList.some((res) => res?._isNotification || res?.
|
|
4975
|
+
const hasPendingNotifications = this.incomingCallsList.some((res) => res?._isNotification || res?.callDirection === 'incoming-call');
|
|
4945
4976
|
const hasAcceptedCalls = this.twilioService.acceptedCallList?.length > 0;
|
|
4946
4977
|
if ((hasAcceptedCalls || hasPendingNotifications) && this.incomingCallsList?.length) {
|
|
4947
4978
|
this.isCallInProgress = true;
|
|
@@ -4959,9 +4990,9 @@ class DialboxComponent {
|
|
|
4959
4990
|
}, 2000);
|
|
4960
4991
|
}
|
|
4961
4992
|
}
|
|
4962
|
-
if (!this.incomingCallsList?.length
|
|
4993
|
+
if (!this.incomingCallsList?.length) {
|
|
4963
4994
|
setTimeout(() => {
|
|
4964
|
-
if (!this.incomingCallsList?.length
|
|
4995
|
+
if (!this.incomingCallsList?.length) {
|
|
4965
4996
|
this.isCallInProgress = false;
|
|
4966
4997
|
this.twilioService.device?.disconnectAll();
|
|
4967
4998
|
this.twilioService.spareDevice?.disconnectAll();
|
|
@@ -4984,12 +5015,12 @@ class DialboxComponent {
|
|
|
4984
5015
|
if (acceptedParticipantId != null) {
|
|
4985
5016
|
this.notificationCallList = this.notificationCallList.filter((call) => call?.participantId != acceptedParticipantId);
|
|
4986
5017
|
this.incomingCallsList = this.incomingCallsList.filter((call) => !((call?.participantId == acceptedParticipantId || call?.id == acceptedParticipantId) &&
|
|
4987
|
-
call?.
|
|
5018
|
+
call?.callDirection == 'incoming-call'));
|
|
4988
5019
|
}
|
|
4989
5020
|
else {
|
|
4990
5021
|
// Legacy fallback: remove by conferenceId.
|
|
4991
5022
|
this.notificationCallList = this.notificationCallList.filter((call) => call?.conferenceId != acceptedConferenceId);
|
|
4992
|
-
this.incomingCallsList = this.incomingCallsList.filter((call) => call?.conferenceId != acceptedConferenceId || call?.
|
|
5023
|
+
this.incomingCallsList = this.incomingCallsList.filter((call) => call?.conferenceId != acceptedConferenceId || call?.callDirection != 'incoming-call');
|
|
4993
5024
|
}
|
|
4994
5025
|
});
|
|
4995
5026
|
this.getUserCallSetting();
|
|
@@ -5160,16 +5191,16 @@ class DialboxComponent {
|
|
|
5160
5191
|
else if (snapshot?.data?.content == "Missed Call" || snapshot?.data?.data?.status == "rejected" || snapshot?.data?.data?.status == "accepted") {
|
|
5161
5192
|
this.notificationCallList = this.notificationCallList.filter((call) => call?.participantId != snapshot?.data?.data?.recordId && call?.participantId != snapshot?.data?.data?.participantId);
|
|
5162
5193
|
this.missCallInfo = snapshot;
|
|
5163
|
-
let incomingCallIndex = this.incomingCallsList.findIndex((call) => (call?.participantId == snapshot?.data?.data?.recordId || call.participantId == snapshot?.data?.data?.participantId) && call?.
|
|
5194
|
+
let incomingCallIndex = this.incomingCallsList.findIndex((call) => (call?.participantId == snapshot?.data?.data?.recordId || call.participantId == snapshot?.data?.data?.participantId) && call?.callDirection == 'incoming-call');
|
|
5164
5195
|
if (incomingCallIndex > -1) {
|
|
5165
5196
|
console.log('incomingCallIndex', incomingCallIndex, snapshot);
|
|
5166
5197
|
this.incomingCallsList.splice(incomingCallIndex, 1);
|
|
5167
5198
|
this.incomeingCallSocketService.pause();
|
|
5168
5199
|
this.cdk.detectChanges();
|
|
5169
|
-
if (!this.incomingCallsList?.length) {
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
}
|
|
5200
|
+
// if (!this.incomingCallsList?.length) {
|
|
5201
|
+
// console.log('407');
|
|
5202
|
+
// this.isCallInProgress = false;
|
|
5203
|
+
// }
|
|
5173
5204
|
}
|
|
5174
5205
|
if (this.connectingIncomingCallId == snapshot?.data?.data?.recordId || this.connectingIncomingCallId == snapshot?.data?.data?.participantId && snapshot?.data?.data?.status != "accepted") {
|
|
5175
5206
|
// swal("Error", 'Internal Server Error', "error");
|
|
@@ -5192,7 +5223,7 @@ class DialboxComponent {
|
|
|
5192
5223
|
this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= (new Date().getTime()));
|
|
5193
5224
|
this.notificationCallList.forEach((call) => {
|
|
5194
5225
|
this.incomingCallsList.forEach((item) => {
|
|
5195
|
-
let info = item.participants.find((resInfo) => resInfo?.id === call?.participantId && call?.
|
|
5226
|
+
let info = item.participants.find((resInfo) => resInfo?.id === call?.participantId && call?.callDirection !== 'incoming');
|
|
5196
5227
|
if (info) {
|
|
5197
5228
|
parentCall.push(info.id);
|
|
5198
5229
|
}
|
|
@@ -5219,7 +5250,7 @@ class DialboxComponent {
|
|
|
5219
5250
|
if (this.twilioService.incomingCallToken != this.updatedTwilioToken) {
|
|
5220
5251
|
this.twilioService.incomingCallToken = this.updatedTwilioToken;
|
|
5221
5252
|
this.twilioService.tokenInitialized = true;
|
|
5222
|
-
this.twilioService.initializeTwilioDevice(
|
|
5253
|
+
this.twilioService.initializeTwilioDevice(localStorage.getItem('deviceId'));
|
|
5223
5254
|
}
|
|
5224
5255
|
}
|
|
5225
5256
|
if (changes['userId']?.currentValue && this.userId) {
|
|
@@ -5385,7 +5416,7 @@ class DialboxComponent {
|
|
|
5385
5416
|
// so a notification can coexist with an active conference that shares its conferenceId.
|
|
5386
5417
|
_isNotification: true,
|
|
5387
5418
|
participantId: notification?.participantId,
|
|
5388
|
-
|
|
5419
|
+
callDirection: "incoming-call",
|
|
5389
5420
|
participants: [
|
|
5390
5421
|
{
|
|
5391
5422
|
direction: "incoming-call", businessNumber: notification.c2cBusiness, img: notification.fromImage || notification.image || 'assets/images/user.jpg', isIncomingCall: true, isHold: false, isConference: false, isAcceptCall: false, dial: true, phone: notification.fromNumber, to: notification.toNumber,
|
|
@@ -5955,6 +5986,7 @@ class DialboxComponent {
|
|
|
5955
5986
|
this.incomingCallsList = [];
|
|
5956
5987
|
// Clean up Twilio device when component is destroyed
|
|
5957
5988
|
if (this.twilioService['device']) {
|
|
5989
|
+
console.log('Destroying Twilio device...');
|
|
5958
5990
|
this.twilioService['device'].disconnectAll();
|
|
5959
5991
|
this.twilioService['device'].destroy();
|
|
5960
5992
|
}
|