@vgroup/dialbox 0.0.30 → 0.0.31
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.
|
@@ -2175,18 +2175,21 @@ class DialboxComponent {
|
|
|
2175
2175
|
// this.callData.isIncomingCall = true;
|
|
2176
2176
|
// }
|
|
2177
2177
|
if (incomingCallData) {
|
|
2178
|
+
// Create a new call data object to ensure change detection works
|
|
2179
|
+
const newCallData = Object.assign(Object.assign({}, this.callData), { phone: incomingCallData.parameters['From'], name: incomingCallData.customParameters.get('name') || incomingCallData.parameters['From'], img: incomingCallData.customParameters.get('image') || 'assets/images/user.jpg', isIncomingCall: true, callSid: incomingCallData.parameters['CallSid'] });
|
|
2178
2180
|
if (this.isCallInProgress) {
|
|
2179
|
-
|
|
2181
|
+
// If there's already a call in progress, add to new incoming calls
|
|
2182
|
+
this.newIncomingCalls.push(Object.assign(Object.assign({}, newCallData), { parameters: incomingCallData.parameters, customParameters: incomingCallData.customParameters }));
|
|
2180
2183
|
this.getUserInformation(incomingCallData);
|
|
2181
2184
|
}
|
|
2182
2185
|
else {
|
|
2186
|
+
// If no call in progress, handle as primary incoming call
|
|
2183
2187
|
this.isCallInProgress = true;
|
|
2184
2188
|
this.isDialpadHidden = false;
|
|
2185
|
-
|
|
2189
|
+
// Update callData with a new object to trigger change detection
|
|
2190
|
+
this.callData = Object.assign({}, newCallData);
|
|
2191
|
+
// Get additional user information
|
|
2186
2192
|
this.getUserInformation(incomingCallData);
|
|
2187
|
-
this.callData.name = incomingCallData.customParameters.get('name');
|
|
2188
|
-
this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
|
|
2189
|
-
this.callData.isIncomingCall = true;
|
|
2190
2193
|
}
|
|
2191
2194
|
incomingCallData.on('cancel', () => {
|
|
2192
2195
|
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
|
|
@@ -2212,11 +2215,25 @@ class DialboxComponent {
|
|
|
2212
2215
|
getUserInformation(incomingCallData) {
|
|
2213
2216
|
console.log('getUserInformation', incomingCallData);
|
|
2214
2217
|
let data = this.fromEntries(Array.from(incomingCallData.customParameters.entries()));
|
|
2215
|
-
this.extensionService.getUserInformation(data['twilioAuthId']).subscribe(response => {
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
+
this.extensionService.getUserInformation(data['twilioAuthId']).subscribe((response) => {
|
|
2219
|
+
try {
|
|
2220
|
+
// Create a new object to trigger change detection
|
|
2221
|
+
const updatedCallData = Object.assign(Object.assign({}, this.callData), { userInfo: response });
|
|
2222
|
+
// Update the call data with a new object to trigger change detection
|
|
2223
|
+
this.callData = Object.assign({}, updatedCallData);
|
|
2224
|
+
// Add to incoming calls list
|
|
2225
|
+
incomingCallData['userInfo'] = response;
|
|
2226
|
+
this.incomingCallsList = [...this.incomingCallsList, incomingCallData];
|
|
2227
|
+
console.log('Updated callData:', this.callData);
|
|
2228
|
+
}
|
|
2229
|
+
catch (error) {
|
|
2230
|
+
console.error('Error processing user information:', error);
|
|
2231
|
+
}
|
|
2218
2232
|
}, error => {
|
|
2219
|
-
console.error('Error
|
|
2233
|
+
console.error('Error fetching user information:', error);
|
|
2234
|
+
// Even if there's an error, add the call to the list
|
|
2235
|
+
incomingCallData['userInfo'] = { error: 'Failed to fetch user details' };
|
|
2236
|
+
this.incomingCallsList = [...this.incomingCallsList, incomingCallData];
|
|
2220
2237
|
});
|
|
2221
2238
|
}
|
|
2222
2239
|
fromEntries(entries) {
|