@vgroup/dialbox 0.0.61 → 0.0.62

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.
@@ -1366,11 +1366,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1366
1366
  }], ctorParameters: function () { return [{ type: TwilioService }]; } });
1367
1367
 
1368
1368
  class TwilioService {
1369
- constructor(http, extensionService, notificationSerivce, twilioService) {
1369
+ constructor(http, extensionService, notificationSerivce) {
1370
1370
  this.http = http;
1371
1371
  this.extensionService = extensionService;
1372
1372
  this.notificationSerivce = notificationSerivce;
1373
- this.twilioService = twilioService;
1374
1373
  this.openInProgressDialpad = new BehaviorSubject(false);
1375
1374
  this.currentCall = new BehaviorSubject(null);
1376
1375
  this.currentCallState = new BehaviorSubject('none'); //in-progress, out-progress, none
@@ -1388,53 +1387,27 @@ class TwilioService {
1388
1387
  this.isAvailableNumber = new BehaviorSubject(false);
1389
1388
  this.callerIdList = new BehaviorSubject([]);
1390
1389
  this.triggerSMSReload = new BehaviorSubject(false);
1391
- this.isTwilioConnected = false;
1392
- this.doNotDisturb = true;
1393
1390
  this.initializeTwilioDevice();
1394
1391
  }
1395
1392
  initializeTwilioDevice() {
1396
- // if (this.token) {
1397
- // this.extensionService.getIncomingCallToken().subscribe((data: any) => {
1398
- // this.incomingCallToken = data.token;
1399
- // localStorage.setItem('in-token', data.token);
1400
- // this.device = new Device(this.incomingCallToken!, {
1401
- // allowIncomingWhileBusy: true,
1402
- // // Add any other necessary options
1403
- // });
1404
- // this.device.register();
1405
- // this.device.on('incoming', (call: Call) => {
1406
- // this.currentCall.next(call);
1407
- // this.callType.next('INCOMING');
1408
- // this.currentCallState.next('incoming');
1409
- // this.notificationSerivce.showNotification(call);
1410
- // });
1411
- // this.device.on('error', (error: any) => {
1412
- // console.error('Twilio Device Error:', error);
1413
- // // Add error handling and reconnection logic
1414
- // });
1415
- // });
1416
- // }
1417
- if (localStorage.getItem('in-token')) {
1418
- this.isTwilioConnected = true;
1419
- this.doNotDisturb = false;
1393
+ if (this.token) {
1420
1394
  this.extensionService.getIncomingCallToken().subscribe((data) => {
1421
- this.twilioService.incomingCallToken = data.token;
1395
+ this.incomingCallToken = data.token;
1422
1396
  localStorage.setItem('in-token', data.token);
1423
- this.isTwilioConnected = true;
1424
- if (!this.twilioService.incomingCallToken) {
1425
- console.error('Cannot initialize Twilio device: No incoming call token available');
1426
- return;
1427
- }
1428
- this.twilioService.device = new Device(this.twilioService.incomingCallToken, { allowIncomingWhileBusy: true });
1429
- this.twilioService.device.register();
1430
- this.twilioService.device.on('incoming', (call) => {
1431
- this.twilioService.currentCall.next(call);
1432
- this.twilioService.callType.next('INCOMING');
1397
+ this.device = new Device(this.incomingCallToken, {
1398
+ allowIncomingWhileBusy: true,
1399
+ // Add any other necessary options
1400
+ });
1401
+ this.device.register();
1402
+ this.device.on('incoming', (call) => {
1403
+ this.currentCall.next(call);
1404
+ this.callType.next('INCOMING');
1405
+ this.currentCallState.next('incoming');
1433
1406
  this.notificationSerivce.showNotification(call);
1434
- //this.twilioService.openInProgressDialpad.next(true);
1435
1407
  });
1436
- this.twilioService.device.on('error', (err) => {
1437
- console.log(err);
1408
+ this.device.on('error', (error) => {
1409
+ console.error('Twilio Device Error:', error);
1410
+ // Add error handling and reconnection logic
1438
1411
  });
1439
1412
  });
1440
1413
  }
@@ -1531,14 +1504,14 @@ class TwilioService {
1531
1504
  return this.http.get(environment.apiUrl + '/utilities/softphone/check/countryCode/' + dialledNo, httpOptions);
1532
1505
  }
1533
1506
  }
1534
- TwilioService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TwilioService, deps: [{ token: i1.HttpClient }, { token: ExtensionService }, { token: NotificationService }, { token: TwilioService }], target: i0.ɵɵFactoryTarget.Injectable });
1507
+ TwilioService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TwilioService, deps: [{ token: i1.HttpClient }, { token: ExtensionService }, { token: NotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
1535
1508
  TwilioService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TwilioService, providedIn: 'root' });
1536
1509
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TwilioService, decorators: [{
1537
1510
  type: Injectable,
1538
1511
  args: [{
1539
1512
  providedIn: 'root'
1540
1513
  }]
1541
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ExtensionService }, { type: NotificationService }, { type: TwilioService }]; } });
1514
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ExtensionService }, { type: NotificationService }]; } });
1542
1515
 
1543
1516
  const GlobalConstant = {
1544
1517
  ErrorMsg500: "Unable to process request. Please try again later.",