@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.
@@ -1997,11 +1997,33 @@ class IncomingCallComponent {
1997
1997
  }
1998
1998
  add() {
1999
1999
  return __awaiter(this, void 0, void 0, function* () {
2000
- let device = yield this.twilioService.connect('');
2001
- console.log(device, 'callConnect');
2002
- // this.device = new Device();/
2003
- // Device.connect({ conferenceName: 'my-conference-room' });
2004
- // this.device = new Device({ conferenceName: 'my-conference-room' });
2000
+ try {
2001
+ console.log('Connecting to conference...', this.incomingCallData);
2002
+ // Step 1: Get conference token
2003
+ const tokenResponse = yield this.extensionService.getConferenceCallToken({
2004
+ authId: this.incomingCallData.conferenceId || this.incomingCallData.conferenceSid
2005
+ }).toPromise();
2006
+ console.log('Conference token received:', tokenResponse);
2007
+ // Step 2: Create a new device with conference token
2008
+ const conferenceDevice = new Device(tokenResponse.token.value, {
2009
+ codecPreferences: ['opus', 'pcmu'],
2010
+ closeProtection: true
2011
+ });
2012
+ // Step 3: Connect to the conference
2013
+ const call = yield conferenceDevice.connect({
2014
+ params: {
2015
+ conferenceName: this.twilioService.conferenceName
2016
+ }
2017
+ });
2018
+ console.log('Conference call connected:', call);
2019
+ this.twilioCallData = call;
2020
+ // Step 4: Emit to parent component
2021
+ this.closeIncomingCallDiv.emit({ show: 1, call: call });
2022
+ }
2023
+ catch (error) {
2024
+ console.error('Error connecting to conference:', error);
2025
+ swal("Error", "Failed to join the conference. Please try again.", "error");
2026
+ }
2005
2027
  });
2006
2028
  }
2007
2029
  }
@@ -2067,6 +2089,7 @@ class CallProgressComponent {
2067
2089
  this.isConcurrentIncoming = false;
2068
2090
  this.isCallOnHold = false;
2069
2091
  this.contacts = [];
2092
+ this.currentCallList = [];
2070
2093
  this.isMinimised = false;
2071
2094
  console.log('Call Progress Component');
2072
2095
  }
@@ -2210,6 +2233,7 @@ class CallProgressComponent {
2210
2233
  });
2211
2234
  this.callData = Object.assign(Object.assign({}, this.callData), { participantId: (_b = this.addRes) === null || _b === void 0 ? void 0 : _b.participantId });
2212
2235
  this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
2236
+ this.currentCallList.push(this.call);
2213
2237
  console.log('Initial participantId:', (_c = this.addRes) === null || _c === void 0 ? void 0 : _c.participantId);
2214
2238
  }
2215
2239
  catch (e) {
@@ -2522,6 +2546,7 @@ class CallProgressComponent {
2522
2546
  .join(' ');
2523
2547
  this.callData = Object.assign(Object.assign({}, this.callData), { phone: phoneNumber, displayNum: phoneNumber, name: contactName || phoneNumber, img: (contact === null || contact === void 0 ? void 0 : contact.img) || 'assets/images/user.jpg' });
2524
2548
  this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
2549
+ this.currentCallList.push(this.call);
2525
2550
  this.cdr.detectChanges();
2526
2551
  // Get the conference ID from the current call or use the stored one
2527
2552
  const conferenceId = this.conferenceId;
@@ -2617,6 +2642,7 @@ class CallProgressComponent {
2617
2642
  return;
2618
2643
  console.log(this.call, 'this.call');
2619
2644
  console.log(this.heldCall, 'this.heldCall');
2645
+ console.log(this.currentCallList, 'this.currentCallList');
2620
2646
  yield this.onholdOrUnholdParticipant({
2621
2647
  participantId: (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.callInfo) === null || _b === void 0 ? void 0 : _b.participantId,
2622
2648
  conferenceId: this.conferenceId,
@@ -3137,7 +3163,7 @@ class DialboxComponent {
3137
3163
  console.log("WS Event Received:", incomingCallData);
3138
3164
  console.log("WS Event Received:", incomingCallData.data);
3139
3165
  this.twilioService.conferenceName = incomingCallData.conferenceName;
3140
- let participants = incomingCallData.participants.filter((item) => !item.isLeft);
3166
+ let participants = incomingCallData.participants.length > 0 ? incomingCallData.participants.filter((item) => !item.isLeft) : [];
3141
3167
  if (participants.length > 0) {
3142
3168
  // this.showIncomingCallPopup(incoming, data/
3143
3169
  this.isCallInProgress = true;