@vgroup/dialbox 0.6.35 → 0.6.36

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.
@@ -1854,7 +1854,7 @@ class CallProgressComponent {
1854
1854
  }
1855
1855
  this.newIncomingCallsList.forEach((callInfo, i) => {
1856
1856
  this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
1857
- let ourNumberInfo = this.newIncomingCallsList[i].participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.client) || (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call')) && !resData?.isLeft);
1857
+ let ourNumberInfo = this.newIncomingCallsList[i].participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.direction == 'outgoing-call') || (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call')) && !resData?.isLeft);
1858
1858
  this.isMute = !ourNumberInfo?.isHold ? ourNumberInfo?.isMute : this.isMute;
1859
1859
  if (ourNumberInfo?.id) {
1860
1860
  this.newIncomingCallsList[i].participants.forEach(async (res) => {
@@ -1982,16 +1982,11 @@ class CallProgressComponent {
1982
1982
  return ((this.deviceNumberList.includes(participant?.from) && participant?.direction == 'outgoing-call') || (this.deviceNumberList.includes(participant?.to) && participant?.direction == 'incoming-call')) && !participant?.isLeft && !participant?.isHold;
1983
1983
  });
1984
1984
  });
1985
- // this.newIncomingCallsList.find((item: any) => {
1986
- // currentCall = item?.participants?.filter((participant: any) => {
1987
- // return ((this.deviceNumberList.includes(participant?.from) && participant?.direction == 'outgoing-call') || (this.deviceNumberList.includes(participant?.to) && participant?.direction == 'incoming-call')) && !participant?.isLeft && !participant?.isHold
1988
- // })
1989
- // });
1990
1985
  if (this.currentConferenceCall?.participants?.length == 2 && this.currentConferenceCall?.participants[0]?.id) {
1991
- this.currentCall = this.currentCallList[0];
1986
+ this.currentCall = this.currentCallList.find((res) => !res?.isConferenceHold);
1992
1987
  }
1993
1988
  else if (this.currentConferenceCall?.participants?.length > 2 && this.currentConferenceCall?.participants[1]?.isConference) {
1994
- this.currentCall = this.currentCallList[1];
1989
+ this.currentCall = this.currentCallList.find((res) => !res?.isConferenceHold);
1995
1990
  this.isConference = true;
1996
1991
  }
1997
1992
  if (!this.currentConferenceCall && !this.isNewAddedCall) {
@@ -2083,7 +2078,7 @@ class CallProgressComponent {
2083
2078
  }
2084
2079
  }
2085
2080
  this.cdr.detectChanges();
2086
- let incomingData = this.currentCallList.find((res) => res?.isIncomingCall && !res?.isAcceptCall && !res?.isLeft);
2081
+ let incomingData = this.currentCallList.find((res) => res?.isIncomingCall && (!res?.isAcceptCall && res?.callStatus != 'participant-join') && !res?.isLeft);
2087
2082
  if (incomingData?.id && !this.isRinging && this.deviceNumberList.includes(incomingData?.to)) {
2088
2083
  this.isRinging = this.incomeingCallSocketService.play();
2089
2084
  }
@@ -2137,7 +2132,7 @@ class CallProgressComponent {
2137
2132
  this.call = await this.device.connect({
2138
2133
  params: {
2139
2134
  From: rejoinParticipentInfo.from,
2140
- To: rejoinParticipentInfo.from,
2135
+ To: rejoinParticipentInfo.to,
2141
2136
  Env: environment.abb,
2142
2137
  Token: tokenData.token.id,
2143
2138
  Ext: rejoinParticipentInfo.extNum,
@@ -2146,19 +2141,27 @@ class CallProgressComponent {
2146
2141
  rtcConstraints: { audio: { deviceId: 'default' } },
2147
2142
  });
2148
2143
  this.twilioService.call = this.call;
2149
- let addClientParticipantRes = this.addClientParticipant({
2150
- from: rejoinParticipentInfo.from,
2151
- route: "OUTGOING",
2152
- participantNumber: rejoinParticipentInfo?.from,
2153
- conferenceId: rejoinParticipentInfo?.conferenceId,
2154
- userId: this.userId || localStorage.getItem('userId'),
2155
- proxy: '',
2156
- countrycode: '',
2157
- deviceId: this.deviceId,
2158
- clientSid: this.call?.parameters['CallSid']
2159
- });
2160
- console.log('host rejoin addClientParticipantRes', addClientParticipantRes);
2161
- this.setupEventListeners();
2144
+ console.log('this.call', this.call);
2145
+ setTimeout(async () => {
2146
+ try {
2147
+ let addClientParticipantRes = this.addClientParticipant({
2148
+ from: rejoinParticipentInfo.from,
2149
+ route: "OUTGOING",
2150
+ participantNumber: rejoinParticipentInfo?.to,
2151
+ conferenceId: rejoinParticipentInfo?.conferenceId,
2152
+ userId: this.userId || localStorage.getItem('userId'),
2153
+ proxy: '',
2154
+ countrycode: '',
2155
+ deviceId: this.deviceId,
2156
+ clientSid: this.call?.parameters['CallSid']
2157
+ });
2158
+ console.log('host rejoin addClientParticipantRes', addClientParticipantRes);
2159
+ this.setupEventListeners();
2160
+ }
2161
+ catch (error) {
2162
+ console.error('Error in addClientParticipant:', error);
2163
+ }
2164
+ }, 500);
2162
2165
  console.log('Rejoined successfully');
2163
2166
  }
2164
2167
  catch (error) {
@@ -2167,7 +2170,7 @@ class CallProgressComponent {
2167
2170
  }
2168
2171
  getStatus(res) {
2169
2172
  if (res.direction == "incoming-call") {
2170
- return this.incomeingCallSocketService.isCurrentIncomingCallList.includes(res.id);
2173
+ return res?.callStatus == "participant-join" ? true : this.incomeingCallSocketService.isCurrentIncomingCallList.includes(res.id);
2171
2174
  }
2172
2175
  else {
2173
2176
  if (res.status == 'answered' && res.direction == "incoming-call") {
@@ -2652,16 +2655,16 @@ class CallProgressComponent {
2652
2655
  console.log('Adding participant:', contact);
2653
2656
  console.log('this.call', this.call);
2654
2657
  const phoneNumber = isUnsavedNumber ? contact : contact?.numbersList?.[0]?.number || contact?.phone;
2655
- let alreadyInCall = this.currentCallList.find((res) => res.to == phoneNumber || res.from == phoneNumber);
2658
+ let alreadyInCall = this.currentCallList.find((res) => (res.to == phoneNumber && res?.direction == 'incoming-call') || (res.from == phoneNumber && res?.direction == 'outgoing-call') && !res?.isLeft);
2656
2659
  if (alreadyInCall) {
2657
2660
  swal('Error', `Already ${phoneNumber} number in this call.`);
2658
2661
  return false;
2659
2662
  }
2660
- const currentCall = this.currentCallList.find((c) => c?.phone === phoneNumber);
2661
- if (!phoneNumber || currentCall) {
2662
- console.error('No phone number found for contact');
2663
- return;
2664
- }
2663
+ // const currentCall = this.currentCallList.find((c: any) => c?.phone === phoneNumber);
2664
+ // if (!phoneNumber || currentCall) {
2665
+ // console.error('No phone number found for contact');
2666
+ // return;
2667
+ // }
2665
2668
  try {
2666
2669
  if (this.isConference) {
2667
2670
  let data = await this.addParticipantToCall({
@@ -2761,7 +2764,7 @@ class CallProgressComponent {
2761
2764
  if (isInvalid) {
2762
2765
  return false;
2763
2766
  }
2764
- let alreadyInCall = this.currentCallList.find((res) => res.to == number || res.from == number);
2767
+ let alreadyInCall = this.currentCallList.find((res) => ((res.to == number && res?.direction == 'incoming-call') || (res.from == number && res?.direction == 'outgoing-call')) && !res?.isLeft);
2765
2768
  if (alreadyInCall) {
2766
2769
  swal('Error', `Already ${number} number in this call.`);
2767
2770
  return false;
@@ -4244,7 +4247,7 @@ class DialboxComponent {
4244
4247
  // Reset dialed number
4245
4248
  this.dialedNumber = '';
4246
4249
  this.sanitizedNum = '';
4247
- // this.twilioService.device.disconnectAll()
4250
+ this.twilioService.device.disconnectAll();
4248
4251
  // Emit end call event
4249
4252
  this.endCallEvent.emit();
4250
4253
  console.log('Call ended successfully');