@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.
@@ -2233,29 +2233,30 @@ class DialboxComponent {
2233
2233
  this.isMinimised = false;
2234
2234
  // Initialize if dialpad is visible by default
2235
2235
  if (!this.isDialpadHidden) {
2236
+ console.log('sfsdfdsf');
2236
2237
  this.initializeTwilio();
2237
2238
  }
2238
2239
  }
2239
2240
  initializeTwilio() {
2240
- if (this.isInitialized)
2241
- return;
2242
- this.token = localStorage.getItem('ext_token') || '';
2243
- if (!this.token) {
2244
- console.error('No authentication token found');
2245
- return;
2246
- }
2247
- this.isInitialized = true;
2248
- // Initialize Twilio service
2249
- this.twilioService.initializeTwilioDevice();
2250
- // Subscribe to incoming calls to show dialpad when call comes in
2251
- const callSub = this.twilioService.currentCall.subscribe(call => {
2252
- if (call) {
2253
- console.log('Incoming call received:', call);
2254
- this.isCallInProgress = true;
2255
- this.isDialpadHidden = false; // Show dialpad on incoming call
2241
+ if (!this.isInitialized) {
2242
+ this.token = localStorage.getItem('ext_token') || '';
2243
+ if (!this.token) {
2244
+ console.error('No authentication token found');
2245
+ return;
2256
2246
  }
2257
- });
2258
- this.subscriptions.add(callSub);
2247
+ this.isInitialized = true;
2248
+ // Initialize Twilio service
2249
+ this.twilioService.initializeTwilioDevice();
2250
+ // Subscribe to incoming calls to show dialpad when call comes in
2251
+ const callSub = this.twilioService.currentCall.subscribe(call => {
2252
+ if (call) {
2253
+ console.log('Incoming call received:', call);
2254
+ this.isCallInProgress = true;
2255
+ this.isDialpadHidden = false; // Show dialpad on incoming call
2256
+ }
2257
+ });
2258
+ this.subscriptions.add(callSub);
2259
+ }
2259
2260
  }
2260
2261
  // ngOnChange() {
2261
2262
  // this.initializeTwilio();
@@ -2496,65 +2497,32 @@ class DialboxComponent {
2496
2497
  setTimeout(() => {
2497
2498
  this.dialInputElement.nativeElement.focus();
2498
2499
  }, 0);
2499
- // if(this.incomingCallData) {
2500
- // if (this.isCallInProgress) {
2501
- // this.newIncomingCalls.push(this.incomingCallData);
2502
- // console.log('404', this.incomingCallData)
2503
- // this.getUserInformation(this.incomingCallData);
2504
- // } else {
2505
- // this.isCallInProgress = true;
2506
- // this.isDialpadHidden = false;
2507
- // this.callData.phone = this.incomingCallData.parameters['From'];
2508
- // console.log('411', this.incomingCallData)
2509
- // this.getUserInformation(this.incomingCallData);
2510
- // this.callData.name = this.incomingCallData.customParameters.get('name');
2511
- // this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
2512
- // this.callData.isIncomingCall = true;
2513
- // }
2514
- // this.incomingCallData.on('cancel', () => {
2515
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2516
- // if(this.incomingCallsList.length == 0){
2517
- // this.isCallInProgress = false;
2518
- // }
2519
- // });
2520
- // this.incomingCallData.on('disconnect', () => {
2521
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2522
- // if(this.incomingCallsList.length == 0){
2523
- // this.isCallInProgress = false;
2524
- // }
2525
- // });
2526
- // }
2500
+ if (this.incomingCallData) {
2501
+ if (this.isCallInProgress) {
2502
+ this.newIncomingCalls.push(this.incomingCallData);
2503
+ console.log('404', this.incomingCallData);
2504
+ this.getUserInformation(this.incomingCallData);
2505
+ }
2506
+ else {
2507
+ this.isCallInProgress = true;
2508
+ this.isDialpadHidden = false;
2509
+ this.callData.phone = this.incomingCallData.parameters['From'];
2510
+ console.log('411', this.incomingCallData);
2511
+ this.getUserInformation(this.incomingCallData);
2512
+ this.callData.name = this.incomingCallData.customParameters.get('name');
2513
+ this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
2514
+ this.callData.isIncomingCall = true;
2515
+ }
2516
+ this.incomingCallData.on('cancel', () => {
2517
+ this.incomingCallsList = [];
2518
+ this.isCallInProgress = false;
2519
+ });
2520
+ this.incomingCallData.on('disconnect', () => {
2521
+ this.incomingCallsList = [];
2522
+ this.isCallInProgress = false;
2523
+ });
2524
+ }
2527
2525
  }
2528
- // if(changes['incomingCallData'] && this.incomingCallData) {
2529
- // // this.isCallInProgress = true;
2530
- // // this.isDialpadHidden = false; // Show dialpad on incoming call
2531
- // if (this.isCallInProgress) {
2532
- // this.newIncomingCalls.push(this.incomingCallData);
2533
- // console.log('404', this.incomingCallData)
2534
- // this.getUserInformation(this.incomingCallData);
2535
- // } else {
2536
- // this.isCallInProgress = true;
2537
- // this.isDialpadHidden = false;
2538
- // this.callData.phone = this.incomingCallData.parameters['From'];
2539
- // console.log('411', this.incomingCallData)
2540
- // this.getUserInformation(this.incomingCallData);
2541
- // this.callData.name = this.incomingCallData.customParameters.get('name');
2542
- // this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
2543
- // this.callData.isIncomingCall = true;
2544
- // }
2545
- // this.incomingCallData.on('cancel', () => {
2546
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2547
- // if(this.incomingCallsList.length == 0){
2548
- // this.isCallInProgress = false;
2549
- // }
2550
- // });
2551
- // this.incomingCallData.on('disconnect', () => {
2552
- // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
2553
- // if(this.incomingCallsList.length == 0){
2554
- // this.isCallInProgress = false;
2555
- // }
2556
- // });
2557
- // }
2558
2526
  }
2559
2527
  registerDragElement() {
2560
2528
  try {