@vgroup/dialbox 0.3.4 → 0.3.6

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.
@@ -1994,11 +1994,33 @@ class IncomingCallComponent {
1994
1994
  this.extensionService.getRemoveParticipants(this.incomingCallData.participantId, this.incomingCallData.conferenceId).toPromise();
1995
1995
  }
1996
1996
  async add() {
1997
- let device = await this.twilioService.connect('');
1998
- console.log(device, 'callConnect');
1999
- // this.device = new Device();/
2000
- // Device.connect({ conferenceName: 'my-conference-room' });
2001
- // this.device = new Device({ conferenceName: 'my-conference-room' });
1997
+ try {
1998
+ console.log('Connecting to conference...', this.incomingCallData);
1999
+ // Step 1: Get conference token
2000
+ const tokenResponse = await this.extensionService.getConferenceCallToken({
2001
+ authId: this.incomingCallData.conferenceId || this.incomingCallData.conferenceSid
2002
+ }).toPromise();
2003
+ console.log('Conference token received:', tokenResponse);
2004
+ // Step 2: Create a new device with conference token
2005
+ const conferenceDevice = new Device(tokenResponse.token.value, {
2006
+ codecPreferences: ['opus', 'pcmu'],
2007
+ closeProtection: true
2008
+ });
2009
+ // Step 3: Connect to the conference
2010
+ const call = await conferenceDevice.connect({
2011
+ params: {
2012
+ conferenceName: this.twilioService.conferenceName
2013
+ }
2014
+ });
2015
+ console.log('Conference call connected:', call);
2016
+ this.twilioCallData = call;
2017
+ // Step 4: Emit to parent component
2018
+ this.closeIncomingCallDiv.emit({ show: 1, call: call });
2019
+ }
2020
+ catch (error) {
2021
+ console.error('Error connecting to conference:', error);
2022
+ swal("Error", "Failed to join the conference. Please try again.", "error");
2023
+ }
2002
2024
  }
2003
2025
  }
2004
2026
  IncomingCallComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IncomingCallComponent, deps: [{ token: ExtensionService }, { token: TwilioService }, { token: NotificationService }], target: i0.ɵɵFactoryTarget.Component });
@@ -2063,6 +2085,7 @@ class CallProgressComponent {
2063
2085
  this.isConcurrentIncoming = false;
2064
2086
  this.isCallOnHold = false;
2065
2087
  this.contacts = [];
2088
+ this.currentCallList = [];
2066
2089
  this.isMinimised = false;
2067
2090
  console.log('Call Progress Component');
2068
2091
  }
@@ -2201,6 +2224,7 @@ class CallProgressComponent {
2201
2224
  });
2202
2225
  this.callData = { ...this.callData, participantId: this.addRes?.participantId };
2203
2226
  this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
2227
+ this.currentCallList.push(this.call);
2204
2228
  console.log('Initial participantId:', this.addRes?.participantId);
2205
2229
  }
2206
2230
  catch (e) {
@@ -2494,6 +2518,7 @@ class CallProgressComponent {
2494
2518
  img: contact?.img || 'assets/images/user.jpg'
2495
2519
  };
2496
2520
  this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
2521
+ this.currentCallList.push(this.call);
2497
2522
  this.cdr.detectChanges();
2498
2523
  // Get the conference ID from the current call or use the stored one
2499
2524
  const conferenceId = this.conferenceId;
@@ -2585,6 +2610,7 @@ class CallProgressComponent {
2585
2610
  return;
2586
2611
  console.log(this.call, 'this.call');
2587
2612
  console.log(this.heldCall, 'this.heldCall');
2613
+ console.log(this.currentCallList, 'this.currentCallList');
2588
2614
  await this.onholdOrUnholdParticipant({
2589
2615
  participantId: this.call?.callInfo?.participantId,
2590
2616
  conferenceId: this.conferenceId,
@@ -3104,7 +3130,7 @@ class DialboxComponent {
3104
3130
  console.log("WS Event Received:", incomingCallData);
3105
3131
  console.log("WS Event Received:", incomingCallData.data);
3106
3132
  this.twilioService.conferenceName = incomingCallData.conferenceName;
3107
- let participants = incomingCallData.participants.filter((item) => !item.isLeft);
3133
+ let participants = incomingCallData.participants.length > 0 ? incomingCallData.participants.filter((item) => !item.isLeft) : [];
3108
3134
  if (participants.length > 0) {
3109
3135
  // this.showIncomingCallPopup(incoming, data/
3110
3136
  this.isCallInProgress = true;