@vgroup/dialbox 0.0.97 → 0.0.99

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.
@@ -2249,29 +2249,30 @@ class DialboxComponent {
2249
2249
  this.isMinimised = false;
2250
2250
  // Initialize if dialpad is visible by default
2251
2251
  if (!this.isDialpadHidden) {
2252
+ console.log('sfsdfdsf');
2252
2253
  this.initializeTwilio();
2253
2254
  }
2254
2255
  }
2255
2256
  initializeTwilio() {
2256
- if (this.isInitialized)
2257
- return;
2258
- this.token = localStorage.getItem('ext_token') || '';
2259
- if (!this.token) {
2260
- console.error('No authentication token found');
2261
- return;
2262
- }
2263
- this.isInitialized = true;
2264
- // Initialize Twilio service
2265
- this.twilioService.initializeTwilioDevice();
2266
- // Subscribe to incoming calls to show dialpad when call comes in
2267
- const callSub = this.twilioService.currentCall.subscribe(call => {
2268
- if (call) {
2269
- console.log('Incoming call received:', call);
2270
- this.isCallInProgress = true;
2271
- this.isDialpadHidden = false; // Show dialpad on incoming call
2257
+ if (!this.isInitialized) {
2258
+ this.token = localStorage.getItem('ext_token') || '';
2259
+ if (!this.token) {
2260
+ console.error('No authentication token found');
2261
+ return;
2272
2262
  }
2273
- });
2274
- this.subscriptions.add(callSub);
2263
+ this.isInitialized = true;
2264
+ // Initialize Twilio service
2265
+ this.twilioService.initializeTwilioDevice();
2266
+ // Subscribe to incoming calls to show dialpad when call comes in
2267
+ const callSub = this.twilioService.currentCall.subscribe(call => {
2268
+ if (call) {
2269
+ console.log('Incoming call received:', call);
2270
+ this.isCallInProgress = true;
2271
+ this.isDialpadHidden = false; // Show dialpad on incoming call
2272
+ }
2273
+ });
2274
+ this.subscriptions.add(callSub);
2275
+ }
2275
2276
  }
2276
2277
  // ngOnChange() {
2277
2278
  // this.initializeTwilio();
@@ -2512,65 +2513,32 @@ class DialboxComponent {
2512
2513
  setTimeout(() => {
2513
2514
  this.dialInputElement.nativeElement.focus();
2514
2515
  }, 0);
2515
- // if(this.incomingCallData) {
2516
- // if (this.isCallInProgress) {
2517
- // this.newIncomingCalls.push(this.incomingCallData);
2518
- // console.log('404', this.incomingCallData)
2519
- // this.getUserInformation(this.incomingCallData);
2520
- // } else {
2521
- // this.isCallInProgress = true;
2522
- // this.isDialpadHidden = false;
2523
- // this.callData.phone = this.incomingCallData.parameters['From'];
2524
- // console.log('411', this.incomingCallData)
2525
- // this.getUserInformation(this.incomingCallData);
2526
- // this.callData.name = this.incomingCallData.customParameters.get('name');
2527
- // this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
2528
- // this.callData.isIncomingCall = true;
2529
- // }
2530
- // this.incomingCallData.on('cancel', () => {
2531
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2532
- // if(this.incomingCallsList.length == 0){
2533
- // this.isCallInProgress = false;
2534
- // }
2535
- // });
2536
- // this.incomingCallData.on('disconnect', () => {
2537
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2538
- // if(this.incomingCallsList.length == 0){
2539
- // this.isCallInProgress = false;
2540
- // }
2541
- // });
2542
- // }
2516
+ if (this.incomingCallData) {
2517
+ if (this.isCallInProgress) {
2518
+ this.newIncomingCalls.push(this.incomingCallData);
2519
+ console.log('404', this.incomingCallData);
2520
+ this.getUserInformation(this.incomingCallData);
2521
+ }
2522
+ else {
2523
+ this.isCallInProgress = true;
2524
+ this.isDialpadHidden = false;
2525
+ this.callData.phone = this.incomingCallData.parameters['From'];
2526
+ console.log('411', this.incomingCallData);
2527
+ this.getUserInformation(this.incomingCallData);
2528
+ this.callData.name = this.incomingCallData.customParameters.get('name');
2529
+ this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
2530
+ this.callData.isIncomingCall = true;
2531
+ }
2532
+ this.incomingCallData.on('cancel', () => {
2533
+ this.incomingCallsList = [];
2534
+ this.isCallInProgress = false;
2535
+ });
2536
+ this.incomingCallData.on('disconnect', () => {
2537
+ this.incomingCallsList = [];
2538
+ this.isCallInProgress = false;
2539
+ });
2540
+ }
2543
2541
  }
2544
- // if(changes['incomingCallData'] && this.incomingCallData) {
2545
- // // this.isCallInProgress = true;
2546
- // // this.isDialpadHidden = false; // Show dialpad on incoming call
2547
- // if (this.isCallInProgress) {
2548
- // this.newIncomingCalls.push(this.incomingCallData);
2549
- // console.log('404', this.incomingCallData)
2550
- // this.getUserInformation(this.incomingCallData);
2551
- // } else {
2552
- // this.isCallInProgress = true;
2553
- // this.isDialpadHidden = false;
2554
- // this.callData.phone = this.incomingCallData.parameters['From'];
2555
- // console.log('411', this.incomingCallData)
2556
- // this.getUserInformation(this.incomingCallData);
2557
- // this.callData.name = this.incomingCallData.customParameters.get('name');
2558
- // this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
2559
- // this.callData.isIncomingCall = true;
2560
- // }
2561
- // this.incomingCallData.on('cancel', () => {
2562
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2563
- // if(this.incomingCallsList.length == 0){
2564
- // this.isCallInProgress = false;
2565
- // }
2566
- // });
2567
- // this.incomingCallData.on('disconnect', () => {
2568
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2569
- // if(this.incomingCallsList.length == 0){
2570
- // this.isCallInProgress = false;
2571
- // }
2572
- // });
2573
- // }
2574
2542
  }
2575
2543
  registerDragElement() {
2576
2544
  try {