@vgroup/dialbox 0.0.29 → 0.0.30
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 +15 -51
- package/esm2020/lib/service/twilio.service.mjs +7 -23
- package/fesm2015/vgroup-dialbox.mjs +27 -70
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +27 -79
- 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
|
}
|
|
@@ -2175,44 +2159,27 @@ class DialboxComponent {
|
|
|
2175
2159
|
// this.callData.isIncomingCall = true;
|
|
2176
2160
|
// }
|
|
2177
2161
|
if (incomingCallData) {
|
|
2178
|
-
// Create a new call data object to ensure change detection works
|
|
2179
|
-
const callSid = incomingCallData.parameters.CallSid;
|
|
2180
|
-
const fromNumber = incomingCallData.parameters.From;
|
|
2181
|
-
const newCallData = {
|
|
2182
|
-
phone: fromNumber,
|
|
2183
|
-
displayNum: fromNumber,
|
|
2184
|
-
dial: false,
|
|
2185
|
-
name: incomingCallData.customParameters.get('name') || fromNumber,
|
|
2186
|
-
img: incomingCallData.customParameters.get('image') || 'assets/images/user.jpg',
|
|
2187
|
-
isIncomingCall: true,
|
|
2188
|
-
callSid: callSid
|
|
2189
|
-
};
|
|
2190
2162
|
if (this.isCallInProgress) {
|
|
2191
|
-
|
|
2192
|
-
this.newIncomingCalls.push({
|
|
2193
|
-
...newCallData,
|
|
2194
|
-
parameters: incomingCallData.parameters,
|
|
2195
|
-
customParameters: incomingCallData.customParameters
|
|
2196
|
-
});
|
|
2163
|
+
this.newIncomingCalls.push(incomingCallData);
|
|
2197
2164
|
this.getUserInformation(incomingCallData);
|
|
2198
2165
|
}
|
|
2199
2166
|
else {
|
|
2200
|
-
// If no call in progress, handle as primary incoming call
|
|
2201
2167
|
this.isCallInProgress = true;
|
|
2202
2168
|
this.isDialpadHidden = false;
|
|
2203
|
-
|
|
2204
|
-
this.callData = { ...newCallData };
|
|
2205
|
-
// Get additional user information
|
|
2169
|
+
this.callData.phone = incomingCallData.parameters['From'];
|
|
2206
2170
|
this.getUserInformation(incomingCallData);
|
|
2171
|
+
this.callData.name = incomingCallData.customParameters.get('name');
|
|
2172
|
+
this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
|
|
2173
|
+
this.callData.isIncomingCall = true;
|
|
2207
2174
|
}
|
|
2208
2175
|
incomingCallData.on('cancel', () => {
|
|
2209
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters
|
|
2176
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
|
|
2210
2177
|
if (this.incomingCallsList.length == 0) {
|
|
2211
2178
|
this.isCallInProgress = false;
|
|
2212
2179
|
}
|
|
2213
2180
|
});
|
|
2214
2181
|
incomingCallData.on('disconnect', () => {
|
|
2215
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters
|
|
2182
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
|
|
2216
2183
|
if (this.incomingCallsList.length == 0) {
|
|
2217
2184
|
this.isCallInProgress = false;
|
|
2218
2185
|
}
|
|
@@ -2229,30 +2196,11 @@ class DialboxComponent {
|
|
|
2229
2196
|
getUserInformation(incomingCallData) {
|
|
2230
2197
|
console.log('getUserInformation', incomingCallData);
|
|
2231
2198
|
let data = this.fromEntries(Array.from(incomingCallData.customParameters.entries()));
|
|
2232
|
-
this.extensionService.getUserInformation(data
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
const safeResponse = response || {};
|
|
2236
|
-
const c2cInfo = safeResponse.c2cInformation || {};
|
|
2237
|
-
// Update the call data with user information
|
|
2238
|
-
this.callData = {
|
|
2239
|
-
...this.callData,
|
|
2240
|
-
name: c2cInfo.name || this.callData.name,
|
|
2241
|
-
displayNum: c2cInfo.number || this.callData.phone,
|
|
2242
|
-
userInfo: safeResponse
|
|
2243
|
-
};
|
|
2244
|
-
// Add to incoming calls list
|
|
2245
|
-
incomingCallData['userInfo'] = safeResponse;
|
|
2246
|
-
this.incomingCallsList = [...this.incomingCallsList, incomingCallData];
|
|
2247
|
-
}
|
|
2248
|
-
catch (error) {
|
|
2249
|
-
console.error('Error processing user information:', error);
|
|
2250
|
-
}
|
|
2199
|
+
this.extensionService.getUserInformation(data['twilioAuthId']).subscribe(response => {
|
|
2200
|
+
incomingCallData['userInfo'] = response;
|
|
2201
|
+
this.incomingCallsList.push(incomingCallData);
|
|
2251
2202
|
}, error => {
|
|
2252
|
-
console.error('Error
|
|
2253
|
-
// Even if there's an error, we should still add the call to the list
|
|
2254
|
-
incomingCallData['userInfo'] = { error: 'Failed to fetch user details' };
|
|
2255
|
-
this.incomingCallsList = [...this.incomingCallsList, incomingCallData];
|
|
2203
|
+
console.error('Error starting recording', error);
|
|
2256
2204
|
});
|
|
2257
2205
|
}
|
|
2258
2206
|
fromEntries(entries) {
|
|
@@ -2265,7 +2213,7 @@ class DialboxComponent {
|
|
|
2265
2213
|
this.registerDragElement();
|
|
2266
2214
|
}
|
|
2267
2215
|
ngOnChanges(changes) {
|
|
2268
|
-
if (changes
|
|
2216
|
+
if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
|
|
2269
2217
|
this.getContactList();
|
|
2270
2218
|
this.getUserCallSetting();
|
|
2271
2219
|
setTimeout(() => {
|
|
@@ -2984,8 +2932,8 @@ class DialboxComponent {
|
|
|
2984
2932
|
}
|
|
2985
2933
|
rejectNewIncomingCall(call) {
|
|
2986
2934
|
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
|
|
2935
|
+
this.newIncomingCalls = this.newIncomingCalls.filter((item) => item.parameters.CallSid !== call.parameters['CallSid']);
|
|
2936
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== call.parameters['CallSid']);
|
|
2989
2937
|
}
|
|
2990
2938
|
newIncomingCallInitiated() {
|
|
2991
2939
|
this.isCallInProgress = true;
|