@vgroup/dialbox 0.0.29 → 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.
- package/esm2020/lib/components/call-progress/call-progress.component.mjs +7 -7
- package/esm2020/lib/components/call-progress/incoming-call/incoming-call.component.mjs +2 -2
- package/esm2020/lib/dialbox.component.mjs +19 -24
- package/esm2020/lib/service/twilio.service.mjs +7 -23
- package/fesm2015/vgroup-dialbox.mjs +27 -53
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +31 -52
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/service/twilio.service.d.ts +0 -2
- package/package.json +1 -1
|
@@ -115,28 +115,12 @@ class TwilioService {
|
|
|
115
115
|
this.callerIdList = new BehaviorSubject([]);
|
|
116
116
|
this.triggerSMSReload = new BehaviorSubject(false);
|
|
117
117
|
}
|
|
118
|
-
onIncomingCall()
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.currentCallState.next('ringing');
|
|
125
|
-
// Emit a custom event with the call data
|
|
126
|
-
this.dispatchIncomingCallEvent(call);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
dispatchIncomingCallEvent(call) {
|
|
130
|
-
const event = new CustomEvent('incomingCall', {
|
|
131
|
-
detail: {
|
|
132
|
-
call,
|
|
133
|
-
isIncomingCall: true,
|
|
134
|
-
from: call.parameters['From'],
|
|
135
|
-
to: call.parameters['To']
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
window.dispatchEvent(event);
|
|
139
|
-
}
|
|
118
|
+
// onIncomingCall(){
|
|
119
|
+
// this.device.on('incoming', (call:any) => {
|
|
120
|
+
// console.log(call);
|
|
121
|
+
// //call.accept();
|
|
122
|
+
// });
|
|
123
|
+
// }
|
|
140
124
|
saveContact(payload) {
|
|
141
125
|
const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json', 'Auth-Key': "Bearer " + localStorage.getItem('ext_token') }) };
|
|
142
126
|
return this.http.post(environment.apiUrl + '/utilities/phonebook/add/contacts/manually', payload, httpOptions);
|
|
@@ -1587,7 +1571,7 @@ class IncomingCallComponent {
|
|
|
1587
1571
|
}
|
|
1588
1572
|
getUserInformation(incomingCallData) {
|
|
1589
1573
|
let data = this.fromEntries(Array.from(incomingCallData.customParameters.entries()));
|
|
1590
|
-
this.extensionService.getUserInformation(data
|
|
1574
|
+
this.extensionService.getUserInformation(data['twilioAuthId']).subscribe(response => {
|
|
1591
1575
|
setTimeout(() => {
|
|
1592
1576
|
incomingCallData['userInfo'] = response;
|
|
1593
1577
|
}, 5000);
|
|
@@ -1666,16 +1650,16 @@ class CallProgressComponent {
|
|
|
1666
1650
|
this.startCall(changes['callData'].currentValue);
|
|
1667
1651
|
}
|
|
1668
1652
|
}
|
|
1669
|
-
if (changes
|
|
1653
|
+
if (changes['newIncomingCallData']) {
|
|
1670
1654
|
try {
|
|
1671
|
-
if (changes
|
|
1655
|
+
if (changes['newIncomingCallData'].currentValue) {
|
|
1672
1656
|
if (this.call && (this.call.status() == 'open')) {
|
|
1673
1657
|
this.call.disconnect();
|
|
1674
|
-
this.call = changes
|
|
1658
|
+
this.call = changes['newIncomingCallData'].currentValue;
|
|
1675
1659
|
this.call?.accept();
|
|
1676
|
-
this.callData.phone =
|
|
1677
|
-
this.callData.name =
|
|
1678
|
-
this.callData.img =
|
|
1660
|
+
this.callData.phone = this.call?.parameters['From'];
|
|
1661
|
+
this.callData.name = this.call?.customParameters.get('name');
|
|
1662
|
+
this.callData.img = this.call?.customParameters.get('image') || 'assets/images/user.jpg';
|
|
1679
1663
|
this.incomingCallInitiated.emit();
|
|
1680
1664
|
this.startTimer();
|
|
1681
1665
|
}
|
|
@@ -2176,16 +2160,13 @@ class DialboxComponent {
|
|
|
2176
2160
|
// }
|
|
2177
2161
|
if (incomingCallData) {
|
|
2178
2162
|
// Create a new call data object to ensure change detection works
|
|
2179
|
-
const callSid = incomingCallData.parameters.CallSid;
|
|
2180
|
-
const fromNumber = incomingCallData.parameters.From;
|
|
2181
2163
|
const newCallData = {
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
name: incomingCallData.customParameters.get('name') || fromNumber,
|
|
2164
|
+
...this.callData,
|
|
2165
|
+
phone: incomingCallData.parameters['From'],
|
|
2166
|
+
name: incomingCallData.customParameters.get('name') || incomingCallData.parameters['From'],
|
|
2186
2167
|
img: incomingCallData.customParameters.get('image') || 'assets/images/user.jpg',
|
|
2187
2168
|
isIncomingCall: true,
|
|
2188
|
-
callSid:
|
|
2169
|
+
callSid: incomingCallData.parameters['CallSid']
|
|
2189
2170
|
};
|
|
2190
2171
|
if (this.isCallInProgress) {
|
|
2191
2172
|
// If there's already a call in progress, add to new incoming calls
|
|
@@ -2206,13 +2187,13 @@ class DialboxComponent {
|
|
|
2206
2187
|
this.getUserInformation(incomingCallData);
|
|
2207
2188
|
}
|
|
2208
2189
|
incomingCallData.on('cancel', () => {
|
|
2209
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters
|
|
2190
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
|
|
2210
2191
|
if (this.incomingCallsList.length == 0) {
|
|
2211
2192
|
this.isCallInProgress = false;
|
|
2212
2193
|
}
|
|
2213
2194
|
});
|
|
2214
2195
|
incomingCallData.on('disconnect', () => {
|
|
2215
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters
|
|
2196
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
|
|
2216
2197
|
if (this.incomingCallsList.length == 0) {
|
|
2217
2198
|
this.isCallInProgress = false;
|
|
2218
2199
|
}
|
|
@@ -2229,28 +2210,26 @@ class DialboxComponent {
|
|
|
2229
2210
|
getUserInformation(incomingCallData) {
|
|
2230
2211
|
console.log('getUserInformation', incomingCallData);
|
|
2231
2212
|
let data = this.fromEntries(Array.from(incomingCallData.customParameters.entries()));
|
|
2232
|
-
this.extensionService.getUserInformation(data
|
|
2213
|
+
this.extensionService.getUserInformation(data['twilioAuthId']).subscribe((response) => {
|
|
2233
2214
|
try {
|
|
2234
|
-
// Create a
|
|
2235
|
-
const
|
|
2236
|
-
const c2cInfo = safeResponse.c2cInformation || {};
|
|
2237
|
-
// Update the call data with user information
|
|
2238
|
-
this.callData = {
|
|
2215
|
+
// Create a new object to trigger change detection
|
|
2216
|
+
const updatedCallData = {
|
|
2239
2217
|
...this.callData,
|
|
2240
|
-
|
|
2241
|
-
displayNum: c2cInfo.number || this.callData.phone,
|
|
2242
|
-
userInfo: safeResponse
|
|
2218
|
+
userInfo: response
|
|
2243
2219
|
};
|
|
2220
|
+
// Update the call data with a new object to trigger change detection
|
|
2221
|
+
this.callData = { ...updatedCallData };
|
|
2244
2222
|
// Add to incoming calls list
|
|
2245
|
-
incomingCallData['userInfo'] =
|
|
2223
|
+
incomingCallData['userInfo'] = response;
|
|
2246
2224
|
this.incomingCallsList = [...this.incomingCallsList, incomingCallData];
|
|
2225
|
+
console.log('Updated callData:', this.callData);
|
|
2247
2226
|
}
|
|
2248
2227
|
catch (error) {
|
|
2249
2228
|
console.error('Error processing user information:', error);
|
|
2250
2229
|
}
|
|
2251
2230
|
}, error => {
|
|
2252
2231
|
console.error('Error fetching user information:', error);
|
|
2253
|
-
// Even if there's an error,
|
|
2232
|
+
// Even if there's an error, add the call to the list
|
|
2254
2233
|
incomingCallData['userInfo'] = { error: 'Failed to fetch user details' };
|
|
2255
2234
|
this.incomingCallsList = [...this.incomingCallsList, incomingCallData];
|
|
2256
2235
|
});
|
|
@@ -2265,7 +2244,7 @@ class DialboxComponent {
|
|
|
2265
2244
|
this.registerDragElement();
|
|
2266
2245
|
}
|
|
2267
2246
|
ngOnChanges(changes) {
|
|
2268
|
-
if (changes
|
|
2247
|
+
if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
|
|
2269
2248
|
this.getContactList();
|
|
2270
2249
|
this.getUserCallSetting();
|
|
2271
2250
|
setTimeout(() => {
|
|
@@ -2984,8 +2963,8 @@ class DialboxComponent {
|
|
|
2984
2963
|
}
|
|
2985
2964
|
rejectNewIncomingCall(call) {
|
|
2986
2965
|
call.reject();
|
|
2987
|
-
this.newIncomingCalls = this.newIncomingCalls.filter((item) => item.parameters.CallSid !== call.parameters
|
|
2988
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== call.parameters
|
|
2966
|
+
this.newIncomingCalls = this.newIncomingCalls.filter((item) => item.parameters.CallSid !== call.parameters['CallSid']);
|
|
2967
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== call.parameters['CallSid']);
|
|
2989
2968
|
}
|
|
2990
2969
|
newIncomingCallInitiated() {
|
|
2991
2970
|
this.isCallInProgress = true;
|