@vgroup/dialbox 0.0.52 → 0.0.53
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/incoming-call/incoming-call.component.mjs +1 -2
- package/esm2020/lib/dialbox.component.mjs +52 -9
- package/esm2020/lib/service/twilio.service.mjs +1 -1
- package/fesm2015/vgroup-dialbox.mjs +52 -9
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +51 -9
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/dialbox.component.d.ts +3 -0
- package/lib/service/twilio.service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1545,7 +1545,6 @@ class IncomingCallComponent {
|
|
|
1545
1545
|
if (call) {
|
|
1546
1546
|
this.twilioCallData = call;
|
|
1547
1547
|
this.twilioAuthId = call.customParameters.get('twilioAuthId');
|
|
1548
|
-
this.newIncomingCallsList.push(call);
|
|
1549
1548
|
if (!call.parameters) {
|
|
1550
1549
|
call.parameters = {};
|
|
1551
1550
|
}
|
|
@@ -2137,7 +2136,7 @@ class DialboxComponent {
|
|
|
2137
2136
|
this.ipService = ipService;
|
|
2138
2137
|
this.extensionService = extensionService;
|
|
2139
2138
|
this.router = router;
|
|
2140
|
-
this.isDialpadHidden =
|
|
2139
|
+
this.isDialpadHidden = true;
|
|
2141
2140
|
this.closeDialpadEvent = new EventEmitter();
|
|
2142
2141
|
this.callInitiated = new EventEmitter();
|
|
2143
2142
|
this.endCallEvent = new EventEmitter();
|
|
@@ -2183,14 +2182,22 @@ class DialboxComponent {
|
|
|
2183
2182
|
this.subscriptions = new Subscription();
|
|
2184
2183
|
this.shakeDedicatedBtn = false;
|
|
2185
2184
|
this.isSmartDialCall = false;
|
|
2185
|
+
this.isTwilioInitialized = false;
|
|
2186
2186
|
this.isMinimised = false;
|
|
2187
|
+
// Subscribe to incoming calls
|
|
2188
|
+
this.subscriptions.add(this.twilioService.currentCall.subscribe(call => {
|
|
2189
|
+
if (call) {
|
|
2190
|
+
this.handleIncomingCall(call);
|
|
2191
|
+
}
|
|
2192
|
+
}));
|
|
2187
2193
|
}
|
|
2188
2194
|
ngOnInit() {
|
|
2189
2195
|
try {
|
|
2190
2196
|
this.token = localStorage.getItem('ext_token') || '';
|
|
2191
|
-
|
|
2197
|
+
this.initializeTwilio();
|
|
2192
2198
|
this.getContactList();
|
|
2193
2199
|
this.getUserCallSetting();
|
|
2200
|
+
// Subscribe to dial number events
|
|
2194
2201
|
const sub1 = this.twilioService.dialNumberFromOtherModule.subscribe((contact) => {
|
|
2195
2202
|
if (contact.number) {
|
|
2196
2203
|
this.isSmartDialCall = false;
|
|
@@ -2309,12 +2316,47 @@ class DialboxComponent {
|
|
|
2309
2316
|
this.registerDragElement();
|
|
2310
2317
|
}
|
|
2311
2318
|
ngOnChanges(changes) {
|
|
2312
|
-
if (changes['isDialpadHidden']
|
|
2313
|
-
this.
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2319
|
+
if (changes['isDialpadHidden']) {
|
|
2320
|
+
if (!changes['isDialpadHidden'].firstChange && !this.isDialpadHidden) {
|
|
2321
|
+
// Re-initialize Twilio when dialpad becomes visible
|
|
2322
|
+
this.initializeTwilio();
|
|
2323
|
+
}
|
|
2324
|
+
if (!this.isDialpadHidden) {
|
|
2325
|
+
this.getContactList();
|
|
2326
|
+
this.getUserCallSetting();
|
|
2327
|
+
setTimeout(() => {
|
|
2328
|
+
if (this.dialInputElement?.nativeElement) {
|
|
2329
|
+
this.dialInputElement.nativeElement.focus();
|
|
2330
|
+
}
|
|
2331
|
+
}, 0);
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
initializeTwilio() {
|
|
2336
|
+
if (this.isTwilioInitialized || !this.token)
|
|
2337
|
+
return;
|
|
2338
|
+
this.isTwilioInitialized = true;
|
|
2339
|
+
this.twilioService.initializeTwilioDevice();
|
|
2340
|
+
}
|
|
2341
|
+
handleIncomingCall(call) {
|
|
2342
|
+
try {
|
|
2343
|
+
if (!call)
|
|
2344
|
+
return;
|
|
2345
|
+
this.incomingCallInitiated.emit();
|
|
2346
|
+
this.newIncomingCallData = call;
|
|
2347
|
+
// Add to incoming calls list if not already present
|
|
2348
|
+
const existingCall = this.incomingCallsList.find((c) => c.parameters.CallSid === call.parameters.CallSid);
|
|
2349
|
+
if (!existingCall) {
|
|
2350
|
+
this.incomingCallsList.unshift(call);
|
|
2351
|
+
this.incomingCallsNewInfoEvent.emit(this.incomingCallsList);
|
|
2352
|
+
}
|
|
2353
|
+
// Show the dialpad if it's hidden
|
|
2354
|
+
if (this.isDialpadHidden) {
|
|
2355
|
+
this.isDialpadHidden = false;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
catch (error) {
|
|
2359
|
+
console.error('Error handling incoming call:', error);
|
|
2318
2360
|
}
|
|
2319
2361
|
}
|
|
2320
2362
|
registerDragElement() {
|