@vgroup/dialbox 0.6.35 → 0.6.37

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.
@@ -1847,7 +1847,7 @@ class CallProgressComponent {
1847
1847
  }
1848
1848
  this.newIncomingCallsList.forEach((callInfo, i) => {
1849
1849
  this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
1850
- let ourNumberInfo = this.newIncomingCallsList[i].participants.find((resData) => ((this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.from) && (resData === null || resData === void 0 ? void 0 : resData.client)) || (this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.to) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'incoming-call')) && !(resData === null || resData === void 0 ? void 0 : resData.isLeft));
1850
+ let ourNumberInfo = this.newIncomingCallsList[i].participants.find((resData) => ((this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.from) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'outgoing-call') || (this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.to) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'incoming-call')) && !(resData === null || resData === void 0 ? void 0 : resData.isLeft));
1851
1851
  this.isMute = !(ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold) ? ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isMute : this.isMute;
1852
1852
  if (ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.id) {
1853
1853
  this.newIncomingCallsList[i].participants.forEach((res) => __awaiter(this, void 0, void 0, function* () {
@@ -1932,16 +1932,11 @@ class CallProgressComponent {
1932
1932
  return ((this.deviceNumberList.includes(participant === null || participant === void 0 ? void 0 : participant.from) && (participant === null || participant === void 0 ? void 0 : participant.direction) == 'outgoing-call') || (this.deviceNumberList.includes(participant === null || participant === void 0 ? void 0 : participant.to) && (participant === null || participant === void 0 ? void 0 : participant.direction) == 'incoming-call')) && !(participant === null || participant === void 0 ? void 0 : participant.isLeft) && !(participant === null || participant === void 0 ? void 0 : participant.isHold);
1933
1933
  });
1934
1934
  });
1935
- // this.newIncomingCallsList.find((item: any) => {
1936
- // currentCall = item?.participants?.filter((participant: any) => {
1937
- // return ((this.deviceNumberList.includes(participant?.from) && participant?.direction == 'outgoing-call') || (this.deviceNumberList.includes(participant?.to) && participant?.direction == 'incoming-call')) && !participant?.isLeft && !participant?.isHold
1938
- // })
1939
- // });
1940
1935
  if (((_q = (_p = this.currentConferenceCall) === null || _p === void 0 ? void 0 : _p.participants) === null || _q === void 0 ? void 0 : _q.length) == 2 && ((_s = (_r = this.currentConferenceCall) === null || _r === void 0 ? void 0 : _r.participants[0]) === null || _s === void 0 ? void 0 : _s.id)) {
1941
- this.currentCall = this.currentCallList[0];
1936
+ this.currentCall = this.currentCallList.find((res) => !(res === null || res === void 0 ? void 0 : res.isConferenceHold));
1942
1937
  }
1943
1938
  else if (((_u = (_t = this.currentConferenceCall) === null || _t === void 0 ? void 0 : _t.participants) === null || _u === void 0 ? void 0 : _u.length) > 2 && ((_w = (_v = this.currentConferenceCall) === null || _v === void 0 ? void 0 : _v.participants[1]) === null || _w === void 0 ? void 0 : _w.isConference)) {
1944
- this.currentCall = this.currentCallList[1];
1939
+ this.currentCall = this.currentCallList.find((res) => !(res === null || res === void 0 ? void 0 : res.isConferenceHold));
1945
1940
  this.isConference = true;
1946
1941
  }
1947
1942
  if (!this.currentConferenceCall && !this.isNewAddedCall) {
@@ -2033,7 +2028,7 @@ class CallProgressComponent {
2033
2028
  }
2034
2029
  }
2035
2030
  this.cdr.detectChanges();
2036
- let incomingData = this.currentCallList.find((res) => (res === null || res === void 0 ? void 0 : res.isIncomingCall) && !(res === null || res === void 0 ? void 0 : res.isAcceptCall) && !(res === null || res === void 0 ? void 0 : res.isLeft));
2031
+ let incomingData = this.currentCallList.find((res) => (res === null || res === void 0 ? void 0 : res.isIncomingCall) && (!(res === null || res === void 0 ? void 0 : res.isAcceptCall) && (res === null || res === void 0 ? void 0 : res.callStatus) != 'participant-join') && !(res === null || res === void 0 ? void 0 : res.isLeft));
2037
2032
  if ((incomingData === null || incomingData === void 0 ? void 0 : incomingData.id) && !this.isRinging && this.deviceNumberList.includes(incomingData === null || incomingData === void 0 ? void 0 : incomingData.to)) {
2038
2033
  this.isRinging = this.incomeingCallSocketService.play();
2039
2034
  }
@@ -2073,7 +2068,6 @@ class CallProgressComponent {
2073
2068
  }
2074
2069
  }
2075
2070
  rejoinHost(callInfo) {
2076
- var _a;
2077
2071
  return __awaiter(this, void 0, void 0, function* () {
2078
2072
  try {
2079
2073
  const rejoinParticipentInfo = callInfo === null || callInfo === void 0 ? void 0 : callInfo.participants.find((resData) => (this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.from) && (resData === null || resData === void 0 ? void 0 : resData.client)));
@@ -2089,7 +2083,7 @@ class CallProgressComponent {
2089
2083
  this.call = yield this.device.connect({
2090
2084
  params: {
2091
2085
  From: rejoinParticipentInfo.from,
2092
- To: rejoinParticipentInfo.from,
2086
+ To: rejoinParticipentInfo.to,
2093
2087
  Env: environment.abb,
2094
2088
  Token: tokenData.token.id,
2095
2089
  Ext: rejoinParticipentInfo.extNum,
@@ -2098,19 +2092,28 @@ class CallProgressComponent {
2098
2092
  rtcConstraints: { audio: { deviceId: 'default' } },
2099
2093
  });
2100
2094
  this.twilioService.call = this.call;
2101
- let addClientParticipantRes = this.addClientParticipant({
2102
- from: rejoinParticipentInfo.from,
2103
- route: "OUTGOING",
2104
- participantNumber: rejoinParticipentInfo === null || rejoinParticipentInfo === void 0 ? void 0 : rejoinParticipentInfo.from,
2105
- conferenceId: rejoinParticipentInfo === null || rejoinParticipentInfo === void 0 ? void 0 : rejoinParticipentInfo.conferenceId,
2106
- userId: this.userId || localStorage.getItem('userId'),
2107
- proxy: '',
2108
- countrycode: '',
2109
- deviceId: this.deviceId,
2110
- clientSid: (_a = this.call) === null || _a === void 0 ? void 0 : _a.parameters['CallSid']
2111
- });
2112
- console.log('host rejoin addClientParticipantRes', addClientParticipantRes);
2113
- this.setupEventListeners();
2095
+ console.log('this.call', this.call);
2096
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
2097
+ var _a;
2098
+ try {
2099
+ let addClientParticipantRes = this.addClientParticipant({
2100
+ from: rejoinParticipentInfo.from,
2101
+ route: "OUTGOING",
2102
+ participantNumber: rejoinParticipentInfo === null || rejoinParticipentInfo === void 0 ? void 0 : rejoinParticipentInfo.to,
2103
+ conferenceId: rejoinParticipentInfo === null || rejoinParticipentInfo === void 0 ? void 0 : rejoinParticipentInfo.conferenceId,
2104
+ userId: this.userId || localStorage.getItem('userId'),
2105
+ proxy: '',
2106
+ countrycode: '',
2107
+ deviceId: this.deviceId,
2108
+ clientSid: (_a = this.call) === null || _a === void 0 ? void 0 : _a.parameters['CallSid']
2109
+ });
2110
+ console.log('host rejoin addClientParticipantRes', addClientParticipantRes);
2111
+ this.setupEventListeners();
2112
+ }
2113
+ catch (error) {
2114
+ console.error('Error in addClientParticipant:', error);
2115
+ }
2116
+ }), 500);
2114
2117
  console.log('Rejoined successfully');
2115
2118
  }
2116
2119
  catch (error) {
@@ -2120,7 +2123,7 @@ class CallProgressComponent {
2120
2123
  }
2121
2124
  getStatus(res) {
2122
2125
  if (res.direction == "incoming-call") {
2123
- return this.incomeingCallSocketService.isCurrentIncomingCallList.includes(res.id);
2126
+ return (res === null || res === void 0 ? void 0 : res.callStatus) == "participant-join" ? true : this.incomeingCallSocketService.isCurrentIncomingCallList.includes(res.id);
2124
2127
  }
2125
2128
  else {
2126
2129
  if (res.status == 'answered' && res.direction == "incoming-call") {
@@ -2651,16 +2654,16 @@ class CallProgressComponent {
2651
2654
  console.log('Adding participant:', contact);
2652
2655
  console.log('this.call', this.call);
2653
2656
  const phoneNumber = isUnsavedNumber ? contact : ((_b = (_a = contact === null || contact === void 0 ? void 0 : contact.numbersList) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.number) || (contact === null || contact === void 0 ? void 0 : contact.phone);
2654
- let alreadyInCall = this.currentCallList.find((res) => res.to == phoneNumber || res.from == phoneNumber);
2657
+ let alreadyInCall = this.currentCallList.find((res) => (res.to == phoneNumber && (res === null || res === void 0 ? void 0 : res.direction) == 'incoming-call') || (res.from == phoneNumber && (res === null || res === void 0 ? void 0 : res.direction) == 'outgoing-call') && !(res === null || res === void 0 ? void 0 : res.isLeft));
2655
2658
  if (alreadyInCall) {
2656
2659
  swal('Error', `Already ${phoneNumber} number in this call.`);
2657
2660
  return false;
2658
2661
  }
2659
- const currentCall = this.currentCallList.find((c) => (c === null || c === void 0 ? void 0 : c.phone) === phoneNumber);
2660
- if (!phoneNumber || currentCall) {
2661
- console.error('No phone number found for contact');
2662
- return;
2663
- }
2662
+ // const currentCall = this.currentCallList.find((c: any) => c?.phone === phoneNumber);
2663
+ // if (!phoneNumber || currentCall) {
2664
+ // console.error('No phone number found for contact');
2665
+ // return;
2666
+ // }
2664
2667
  try {
2665
2668
  if (this.isConference) {
2666
2669
  let data = yield this.addParticipantToCall({
@@ -2762,7 +2765,7 @@ class CallProgressComponent {
2762
2765
  if (isInvalid) {
2763
2766
  return false;
2764
2767
  }
2765
- let alreadyInCall = this.currentCallList.find((res) => res.to == number || res.from == number);
2768
+ let alreadyInCall = this.currentCallList.find((res) => ((res.to == number && (res === null || res === void 0 ? void 0 : res.direction) == 'incoming-call') || (res.from == number && (res === null || res === void 0 ? void 0 : res.direction) == 'outgoing-call')) && !(res === null || res === void 0 ? void 0 : res.isLeft));
2766
2769
  if (alreadyInCall) {
2767
2770
  swal('Error', `Already ${number} number in this call.`);
2768
2771
  return false;
@@ -4273,7 +4276,7 @@ class DialboxComponent {
4273
4276
  // Reset dialed number
4274
4277
  this.dialedNumber = '';
4275
4278
  this.sanitizedNum = '';
4276
- // this.twilioService.device.disconnectAll()
4279
+ this.twilioService.device.disconnectAll();
4277
4280
  // Emit end call event
4278
4281
  this.endCallEvent.emit();
4279
4282
  console.log('Call ended successfully');