@vgroup/dialbox 0.3.27 → 0.3.29

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.
@@ -2515,79 +2515,109 @@ class CallProgressComponent {
2515
2515
  return;
2516
2516
  }
2517
2517
  try {
2518
- this.currentCallList.forEach(async (c) => {
2519
- if (c?.participantId && !c?.isHold) {
2520
- c.isHold = true;
2521
- await this.onholdOrUnholdParticipant({
2522
- participantId: c?.participantId,
2523
- conferenceId: this.conferenceId,
2524
- hold: c?.isHold
2525
- });
2518
+ if (this.isConference) {
2519
+ let data = await this.addParticipantToCall({
2520
+ from: this.callData?.from || this.selectedCallerId?.number,
2521
+ route: "OUTGOING",
2522
+ participantNumber: phoneNumber,
2523
+ conferenceId: this.conferenceId
2524
+ });
2525
+ this.callData = {
2526
+ // ...this.callData,
2527
+ phone: phoneNumber,
2528
+ displayNum: phoneNumber,
2529
+ name: contact?.name || `${contact?.firstName} ${contact?.lastName}` || phoneNumber,
2530
+ img: contact?.img || 'assets/images/user.jpg',
2531
+ participantId: data?.participantId,
2532
+ from: this.selectedCallerId?.number,
2533
+ isIncomingCall: false,
2534
+ isHold: false,
2535
+ isLeft: false,
2536
+ isConference: false
2537
+ };
2538
+ this.cdr.detectChanges();
2539
+ console.log(this.callData, 'this.callData5656');
2540
+ console.log('test1111115555555555');
2541
+ this.currentCall = this.callData;
2542
+ this.currentCallList.push({ ...this.callData });
2543
+ console.log("Participant added to conference:", phoneNumber);
2544
+ this.showRingAnimation = false;
2545
+ }
2546
+ else {
2547
+ this.currentCallList.forEach(async (c) => {
2548
+ if (c?.participantId && !c?.isHold) {
2549
+ c.isHold = true;
2550
+ await this.onholdOrUnholdParticipant({
2551
+ participantId: c?.participantId,
2552
+ conferenceId: this.conferenceId,
2553
+ hold: c?.isHold
2554
+ });
2555
+ }
2556
+ });
2557
+ // Put current call on hold
2558
+ // this.heldCall = this.call;
2559
+ // this.isCallOnHold = true;
2560
+ // this.heldCall.mute(true);
2561
+ // this.heldCall['parameters']['caller_name'] = { ...this.callData }
2562
+ // this.call=null
2563
+ // Close contacts panel and show ring animation
2564
+ this.showContactsPanel = false;
2565
+ this.showRingAnimation = true;
2566
+ // Update UI to reflect the new outbound leg being dialed
2567
+ const contactName = [contact?.firstName, contact?.middleName, contact?.lastName]
2568
+ .filter(Boolean)
2569
+ .join(' ');
2570
+ // this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
2571
+ // Get the conference ID from the current call or use the stored one
2572
+ // const conferenceId = this.conferenceId;
2573
+ if (!this.conferenceId) {
2574
+ console.error("No conferenceId found for active call");
2575
+ swal("Error", "Cannot add participant: conference not found", "error");
2576
+ this.showRingAnimation = false;
2577
+ return;
2526
2578
  }
2527
- });
2528
- // Put current call on hold
2529
- this.heldCall = this.call;
2530
- this.isCallOnHold = true;
2531
- // this.heldCall.mute(true);
2532
- this.heldCall['parameters']['caller_name'] = { ...this.callData };
2533
- // this.call=null
2534
- // Close contacts panel and show ring animation
2535
- this.showContactsPanel = false;
2536
- this.showRingAnimation = true;
2537
- // Update UI to reflect the new outbound leg being dialed
2538
- const contactName = [contact?.firstName, contact?.middleName, contact?.lastName]
2539
- .filter(Boolean)
2540
- .join(' ');
2541
- // this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
2542
- // Get the conference ID from the current call or use the stored one
2543
- const conferenceId = this.conferenceId;
2544
- if (!conferenceId) {
2545
- console.error("No conferenceId found for active call");
2546
- swal("Error", "Cannot add participant: conference not found", "error");
2579
+ // Add participant to the conference
2580
+ let data = await this.addParticipantToCall({
2581
+ from: this.callData?.from || this.selectedCallerId?.number,
2582
+ route: "OUTGOING",
2583
+ participantNumber: phoneNumber,
2584
+ conferenceId: this.conferenceId
2585
+ });
2586
+ // this.callData = {
2587
+ // ...this.callData,
2588
+ // participantId: ,
2589
+ // }
2590
+ this.callData = {
2591
+ // ...this.callData,
2592
+ phone: phoneNumber,
2593
+ displayNum: phoneNumber,
2594
+ name: contact?.name || `${contact?.firstName} ${contact?.lastName}` || phoneNumber,
2595
+ img: contact?.img || 'assets/images/user.jpg',
2596
+ participantId: data?.participantId,
2597
+ from: this.selectedCallerId?.number,
2598
+ isIncomingCall: false,
2599
+ isHold: false,
2600
+ isLeft: false,
2601
+ isConference: false
2602
+ };
2603
+ this.cdr.detectChanges();
2604
+ console.log(this.callData, 'this.callData');
2605
+ console.log('test111111');
2606
+ this.currentCall = this.callData;
2607
+ this.currentCallList.push({ ...this.callData });
2608
+ console.log("Participant added to conference:", phoneNumber);
2547
2609
  this.showRingAnimation = false;
2548
- return;
2549
2610
  }
2550
- // Add participant to the conference
2551
- let data = await this.addParticipantToCall({
2552
- from: this.callData?.from || this.selectedCallerId?.number,
2553
- route: "OUTGOING",
2554
- participantNumber: phoneNumber,
2555
- conferenceId: conferenceId
2556
- });
2557
- // this.callData = {
2558
- // ...this.callData,
2559
- // participantId: ,
2560
- // }
2561
- this.callData = {
2562
- // ...this.callData,
2563
- phone: phoneNumber,
2564
- displayNum: phoneNumber,
2565
- name: contact?.name || `${contact?.firstName} ${contact?.lastName}` || phoneNumber,
2566
- img: contact?.img || 'assets/images/user.jpg',
2567
- participantId: data?.participantId,
2568
- from: this.selectedCallerId?.number,
2569
- isIncomingCall: false,
2570
- isHold: false,
2571
- isLeft: false,
2572
- isConference: false
2573
- };
2574
- this.cdr.detectChanges();
2575
- console.log(this.callData, 'this.callData');
2576
- console.log('test111111');
2577
- this.currentCall = this.callData;
2578
- this.currentCallList.push({ ...this.callData });
2579
- console.log("Participant added to conference:", phoneNumber);
2580
- this.showRingAnimation = false;
2581
2611
  }
2582
2612
  catch (error) {
2583
2613
  console.error('Error adding participant:', error);
2584
2614
  this.showRingAnimation = false;
2585
2615
  // Restore held call on error
2586
2616
  if (this.heldCall) {
2587
- this.call = this.heldCall;
2588
- this.heldCall = undefined;
2589
- this.isCallOnHold = false;
2590
- this.call.mute(false);
2617
+ // this.call = this.heldCall;
2618
+ // this.heldCall = undefined;
2619
+ // this.isCallOnHold = false;
2620
+ // this.call.mute(false);
2591
2621
  }
2592
2622
  this.handleError(error);
2593
2623
  }