@vgroup/dialbox 0.2.39 โ†’ 0.2.41

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.
@@ -2436,6 +2436,28 @@ class CallProgressComponent {
2436
2436
  this.handleError(error);
2437
2437
  }
2438
2438
  }
2439
+ // acceptConcurrentCall(incomingCall: any) {
2440
+ // if (!incomingCall) return;
2441
+ // // Put current call on hold instead of disconnecting
2442
+ // if (this.call) {
2443
+ // this.heldCall = this.call;
2444
+ // this.isCallOnHold = true;
2445
+ // // Mute the held call
2446
+ // this.heldCall.mute(true);
2447
+ // }
2448
+ // incomingCall.accept();
2449
+ // this.call = incomingCall;
2450
+ // this.callData.phone = incomingCall.parameters['From'];
2451
+ // this.callData.name = incomingCall.customParameters?.get('name') || '-';
2452
+ // this.callData.img = incomingCall.customParameters?.get('image') || 'assets/images/user.jpg';
2453
+ // this.isConcurrentIncoming = false;
2454
+ // this.incomingCallDiv = false;
2455
+ // this.disbaleEndCallBtn = false;
2456
+ // // Reset timer for new call
2457
+ // this.stopTimer();
2458
+ // this.startTimer();
2459
+ // this.cdr.detectChanges();
2460
+ // }
2439
2461
  acceptConcurrentCall(incomingCall) {
2440
2462
  if (!incomingCall)
2441
2463
  return;
@@ -2446,6 +2468,7 @@ class CallProgressComponent {
2446
2468
  // Mute the held call
2447
2469
  this.heldCall.mute(true);
2448
2470
  }
2471
+ // Accept the new call
2449
2472
  incomingCall.accept();
2450
2473
  this.call = incomingCall;
2451
2474
  this.callData.phone = incomingCall.parameters['From'];
@@ -2454,7 +2477,10 @@ class CallProgressComponent {
2454
2477
  this.isConcurrentIncoming = false;
2455
2478
  this.incomingCallDiv = false;
2456
2479
  this.disbaleEndCallBtn = false;
2457
- // Reset timer for new call
2480
+ // ๐ŸŸข Remove the accepted call from incoming list
2481
+ this.newIncomingCallsList = (this.newIncomingCallsList || []).filter((c) => c?.parameters?.CallSid !== incomingCall?.parameters?.CallSid);
2482
+ this.incomingCallsNewInfo.emit(this.newIncomingCallsList);
2483
+ // ๐Ÿ•’ Reset timer for new call
2458
2484
  this.stopTimer();
2459
2485
  this.startTimer();
2460
2486
  this.cdr.detectChanges();
@@ -2510,13 +2536,25 @@ class CallProgressComponent {
2510
2536
  rejectConcurrentCall(incomingCall) {
2511
2537
  if (!incomingCall)
2512
2538
  return;
2513
- if (incomingCall.reject) {
2514
- incomingCall.reject();
2539
+ try {
2540
+ // ๐ŸŸฅ Reject or hang up the call at SDK level
2541
+ if (incomingCall.reject) {
2542
+ incomingCall.reject(); // Twilio-like API
2543
+ }
2544
+ else if (incomingCall.disconnect) {
2545
+ incomingCall.disconnect(); // Some SDKs use disconnect()
2546
+ }
2547
+ else if (incomingCall.hangup) {
2548
+ incomingCall.hangup(); // Fallback if the SDK uses hangup()
2549
+ }
2550
+ }
2551
+ catch (err) {
2552
+ console.error('Error rejecting call:', err);
2515
2553
  }
2516
- // Remove from list
2554
+ // ๐Ÿงน Remove the call from the incoming list
2517
2555
  this.newIncomingCallsList = (this.newIncomingCallsList || []).filter((c) => c?.parameters?.CallSid !== incomingCall?.parameters?.CallSid);
2518
2556
  this.incomingCallsNewInfo.emit(this.newIncomingCallsList);
2519
- // If no more incoming, hide banner
2557
+ // ๐ŸŽฏ Update UI state
2520
2558
  if (!this.newIncomingCallsList || this.newIncomingCallsList.length === 0) {
2521
2559
  this.isConcurrentIncoming = false;
2522
2560
  this.incomingCallDiv = false;