@vgroup/dialbox 0.2.80 → 0.2.82
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 +5 -3
- package/esm2020/lib/dialbox.component.mjs +43 -43
- package/esm2020/lib/service/incomeing-call-socket.service.mjs +11 -7
- package/fesm2015/vgroup-dialbox.mjs +56 -50
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +56 -50
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1647,23 +1647,27 @@ class IncomeingCallSocketService {
|
|
|
1647
1647
|
}
|
|
1648
1648
|
connect() {
|
|
1649
1649
|
// Replace with your WebSocket URL
|
|
1650
|
-
this.socket = new WebSocket(`${environment.websocketUrl}incoming/call`);
|
|
1650
|
+
this.socket = new WebSocket(`${environment.websocketUrl}incoming/call?userId=${localStorage.getItem('userId')}&authKey=${localStorage.getItem('ext_token')}`);
|
|
1651
1651
|
this.socket.onopen = () => {
|
|
1652
1652
|
console.log("WebSocket connected");
|
|
1653
1653
|
// Authenticate (if needed)
|
|
1654
|
-
const authMessage = {
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1654
|
+
const authMessage = { "incomingCall": {
|
|
1655
|
+
"userId": localStorage.getItem('userId')
|
|
1656
|
+
} };
|
|
1657
|
+
// {
|
|
1658
|
+
// userId: localStorage.getItem('userId'),
|
|
1659
|
+
// authKey: localStorage.getItem('ext_token')
|
|
1660
|
+
// };
|
|
1658
1661
|
this.socket?.send(JSON.stringify(authMessage));
|
|
1659
1662
|
};
|
|
1660
1663
|
this.socket.onmessage = (msg) => {
|
|
1664
|
+
console.log("WS RAW:", msg.data);
|
|
1661
1665
|
try {
|
|
1662
1666
|
const data = JSON.parse(msg.data);
|
|
1663
1667
|
this.eventSubject.next(data);
|
|
1664
1668
|
}
|
|
1665
1669
|
catch (e) {
|
|
1666
|
-
console.error("
|
|
1670
|
+
console.error("WS PARSE ERROR:", msg.data);
|
|
1667
1671
|
}
|
|
1668
1672
|
};
|
|
1669
1673
|
this.socket.onerror = (err) => {
|
|
@@ -2080,6 +2084,7 @@ class CallProgressComponent {
|
|
|
2080
2084
|
if (changes['callData']) {
|
|
2081
2085
|
if (changes['callData'].currentValue?.isIncomingCall) {
|
|
2082
2086
|
this.incomingCallDiv = true;
|
|
2087
|
+
this.call['callInfo'] = { ...this.callData };
|
|
2083
2088
|
this.cdr.detectChanges();
|
|
2084
2089
|
}
|
|
2085
2090
|
else if (changes['callData'].currentValue?.displayNum || changes['callData'].currentValue?.from) {
|
|
@@ -2179,7 +2184,7 @@ class CallProgressComponent {
|
|
|
2179
2184
|
conferenceId: this.conferenceId
|
|
2180
2185
|
});
|
|
2181
2186
|
this.callData = { ...this.callData, participantId: this.addRes?.participantId };
|
|
2182
|
-
this.call['callInfo'] = this.callData;
|
|
2187
|
+
this.call['callInfo'] = { ...this.callData };
|
|
2183
2188
|
console.log('Initial participantId:', this.addRes?.participantId);
|
|
2184
2189
|
}
|
|
2185
2190
|
catch (e) {
|
|
@@ -2449,7 +2454,7 @@ class CallProgressComponent {
|
|
|
2449
2454
|
hold: true
|
|
2450
2455
|
});
|
|
2451
2456
|
// Put current call on hold
|
|
2452
|
-
this.heldCall = this.call;
|
|
2457
|
+
this.heldCall = { ...this.call };
|
|
2453
2458
|
this.isCallOnHold = true;
|
|
2454
2459
|
this.heldCall.mute(true);
|
|
2455
2460
|
// Close contacts panel and show ring animation
|
|
@@ -2466,6 +2471,7 @@ class CallProgressComponent {
|
|
|
2466
2471
|
name: contactName || phoneNumber,
|
|
2467
2472
|
img: contact?.img || 'assets/images/user.jpg'
|
|
2468
2473
|
};
|
|
2474
|
+
this.call['callInfo'] = { ...this.callData };
|
|
2469
2475
|
this.cdr.detectChanges();
|
|
2470
2476
|
// Get the conference ID from the current call or use the stored one
|
|
2471
2477
|
const conferenceId = this.conferenceId;
|
|
@@ -3069,50 +3075,50 @@ class DialboxComponent {
|
|
|
3069
3075
|
// Ensure Twilio is initialized even when dialpad starts hidden,
|
|
3070
3076
|
// so we can auto-open on incoming calls.
|
|
3071
3077
|
this.initializeTwilio();
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
if (incomingCallData) {
|
|
3078
|
-
if (
|
|
3079
|
-
this._isDialpadHidden
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
this.
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3078
|
+
try {
|
|
3079
|
+
this.incomeingCallSocketService.connect();
|
|
3080
|
+
this.incomeingCallSocketService.listen().subscribe((incomingCallData) => {
|
|
3081
|
+
console.log("WS Event Received:", incomingCallData);
|
|
3082
|
+
console.log("WS Event Received:", incomingCallData.data);
|
|
3083
|
+
if (incomingCallData.type === "/incoming/call") {
|
|
3084
|
+
if (incomingCallData) {
|
|
3085
|
+
if (this.autoOpenOnIncoming && this._isDialpadHidden) {
|
|
3086
|
+
this._isDialpadHidden = false;
|
|
3087
|
+
}
|
|
3088
|
+
if (this.isCallInProgress) {
|
|
3089
|
+
this.newIncomingCalls.push(incomingCallData);
|
|
3090
|
+
console.log('325', incomingCallData);
|
|
3091
|
+
this.getUserInformation(incomingCallData);
|
|
3092
|
+
}
|
|
3093
|
+
else {
|
|
3094
|
+
incomingCallData['isFirstCall'] = true;
|
|
3095
|
+
console.log('dd1');
|
|
3096
|
+
this.isCallInProgress = true;
|
|
3097
|
+
this.isDialpadHidden = false;
|
|
3098
|
+
this.callData.phone = incomingCallData.parameters['From'];
|
|
3099
|
+
console.log('dd2');
|
|
3100
|
+
this.getUserInformation(incomingCallData);
|
|
3101
|
+
this.callData.name = incomingCallData.customParameters.get('name');
|
|
3102
|
+
this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
|
|
3103
|
+
this.callData.isIncomingCall = true;
|
|
3104
|
+
}
|
|
3105
|
+
incomingCallData.on('cancel', () => {
|
|
3106
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
|
|
3107
|
+
// if(this.incomingCallsList.length == 0){
|
|
3108
|
+
// console.log('dd3')
|
|
3109
|
+
// this.isCallInProgress = false;
|
|
3110
|
+
// }
|
|
3111
|
+
});
|
|
3112
|
+
incomingCallData.on('disconnect', () => {
|
|
3113
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
|
|
3114
|
+
// if(this.incomingCallsList.length == 0){
|
|
3115
|
+
// console.log('dd4')
|
|
3116
|
+
// this.isCallInProgress = false;
|
|
3117
|
+
// }
|
|
3118
|
+
});
|
|
3097
3119
|
}
|
|
3098
|
-
incomingCallData.on('cancel', () => {
|
|
3099
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
|
|
3100
|
-
// if(this.incomingCallsList.length == 0){
|
|
3101
|
-
// console.log('dd3')
|
|
3102
|
-
// this.isCallInProgress = false;
|
|
3103
|
-
// }
|
|
3104
|
-
});
|
|
3105
|
-
incomingCallData.on('disconnect', () => {
|
|
3106
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
|
|
3107
|
-
// if(this.incomingCallsList.length == 0){
|
|
3108
|
-
// console.log('dd4')
|
|
3109
|
-
// this.isCallInProgress = false;
|
|
3110
|
-
// }
|
|
3111
|
-
});
|
|
3112
3120
|
}
|
|
3113
|
-
}
|
|
3114
|
-
});
|
|
3115
|
-
try {
|
|
3121
|
+
});
|
|
3116
3122
|
this.token = localStorage.getItem('ext_token') || '';
|
|
3117
3123
|
//this.isCallInProgress = true;
|
|
3118
3124
|
this.getContactList();
|