@vgroup/dialbox 0.7.8 → 0.7.9

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.
@@ -1898,6 +1898,8 @@ class CallProgressComponent {
1898
1898
  this.acceptedCallList = [];
1899
1899
  this.isHoldBtnDisable = false;
1900
1900
  this.C2ConfoList = {};
1901
+ this.lastActiveConferenceId = null;
1902
+ this.pendingAutoUnhold = false;
1901
1903
  this.isMinimised = false;
1902
1904
  this.showDisconnectModal = false;
1903
1905
  this.call = this.twilioService.call;
@@ -1989,7 +1991,7 @@ class CallProgressComponent {
1989
1991
  img: res?.direction == "incoming-call" ? res?.toImage : res?.fromImage || contact?.image || 'assets/images/user.jpg',
1990
1992
  isIncomingCall: res?.direction == "incoming-call",
1991
1993
  isHold: res?.isHold,
1992
- isConferenceHold: ourNumberInfo?.isHold || false,
1994
+ isConferenceHold: this.newIncomingCallsList?.length > 1 ? ourNumberInfo?.isHold : false,
1993
1995
  isMute: false,
1994
1996
  isConference: res?.isConference || this.isConference,
1995
1997
  isAcceptCall: res?.direction == "incoming-call" ? this.getStatus(res) : true,
@@ -2032,7 +2034,7 @@ class CallProgressComponent {
2032
2034
  img: res?.direction == "incoming-call" ? res?.toImage : res?.fromImage || contact?.image || 'assets/images/user.jpg',
2033
2035
  isIncomingCall: res?.direction == "incoming-call",
2034
2036
  isHold: res?.isHold,
2035
- isConferenceHold: ourNumberInfo?.isHold || false,
2037
+ isConferenceHold: this.newIncomingCallsList?.length > 1 ? ourNumberInfo?.isHold : false,
2036
2038
  isMute: res?.isMute,
2037
2039
  isConference: res.isConference ? res.isConference : this.isConference,
2038
2040
  isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true,
@@ -2053,7 +2055,7 @@ class CallProgressComponent {
2053
2055
  img: res.direction == "incoming-call" ? res?.toImage : res?.fromImage || contact?.image || 'assets/images/user.jpg',
2054
2056
  isIncomingCall: res.direction == "incoming-call",
2055
2057
  isHold: res?.isHold,
2056
- isConferenceHold: ourNumberInfo?.isHold || false,
2058
+ isConferenceHold: this.newIncomingCallsList?.length > 1 ? ourNumberInfo?.isHold : false,
2057
2059
  isMute: res?.isMute,
2058
2060
  isConference: res.isConference ? res.isConference : this.isConference,
2059
2061
  isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true,
@@ -2113,6 +2115,21 @@ class CallProgressComponent {
2113
2115
  return ((this.deviceNumberList.includes(participant?.from) && participant?.direction == 'outgoing-call' && participant?.client) || (this.deviceNumberList.includes(participant?.to) && participant?.direction == 'incoming-call' && participant?.client)) && !participant?.isLeft && !participant?.isHold;
2114
2116
  });
2115
2117
  });
2118
+ // Detect disconnect vs. hold transition exactly once per event.
2119
+ // Same participant filter as getCurrentCallInfo() (without !isHold) to stay consistent.
2120
+ if (this.currentConferenceCall && !currentCall[0]?.isHold) {
2121
+ this.lastActiveConferenceId = this.currentConferenceCall.conferenceId;
2122
+ this.pendingAutoUnhold = false;
2123
+ }
2124
+ else if (this.lastActiveConferenceId && !this.pendingAutoUnhold) {
2125
+ const lastConf = this.newIncomingCallsList.find((c) => c.conferenceId == this.lastActiveConferenceId);
2126
+ const ourParticipantInLastConf = lastConf?.participants?.find((p) => ((this.deviceNumberList.includes(p?.from) && p?.direction == 'outgoing-call' && p?.client) ||
2127
+ (this.deviceNumberList.includes(p?.to) && p?.direction == 'incoming-call' && p?.client)) && !p?.isLeft);
2128
+ // Conference gone OR our participant not held → the active call disconnected → queue auto-unhold
2129
+ if (!lastConf || !ourParticipantInLastConf?.isHold) {
2130
+ this.pendingAutoUnhold = true;
2131
+ }
2132
+ }
2116
2133
  if (this.currentConferenceCall?.participants.length == 2 && this.currentConferenceCall?.participants[0]?.id) {
2117
2134
  this.currentCall = { ...this.currentCallList.find((res) => !res?.isConferenceHold && ((res?.direction == 'outgoing-call' && res?.client && !this.deviceNumberList.includes(res?.from)) || (res?.direction == 'incoming-call' && res?.client && !this.deviceNumberList.includes(res?.to)) || !res?.client)) };
2118
2135
  this.currentCall['isAcceptCall'] = true;
@@ -2132,12 +2149,24 @@ class CallProgressComponent {
2132
2149
  this.currentCall['isAcceptCall'] = true;
2133
2150
  }
2134
2151
  }
2152
+ else if (!this.currentConferenceCall && this.currentCall && this.currentCallList?.length > 0) {
2153
+ this.currentCall = this.currentCallList.find((res) => res?.id == this.currentCall?.id);
2154
+ }
2135
2155
  if (!this.currentConferenceCall && !this.isNewAddedCall) {
2136
2156
  let currentConferenceCallInfo = this.getCurrentCallInfo();
2137
- if (!currentConferenceCallInfo?.id) {
2138
- let holdCallInfo = this.newIncomingCallsList[0].participants.find((callInfo) => ((this.deviceNumberList.includes(callInfo?.from) && callInfo?.client)
2139
- || (this.deviceNumberList.includes(callInfo?.to) && callInfo?.direction == 'incoming-call')) && !callInfo?.isLeft && callInfo?.isHold);
2140
- // this.isUnholdConferenceCall
2157
+ if (!currentConferenceCallInfo?.id && this.pendingAutoUnhold) {
2158
+ // Search ALL conferences except the one that just disconnected.
2159
+ // This prevents a single-conference hold (including brief isLeft race conditions)
2160
+ // from ever triggering an unhold — we only unhold a DIFFERENT held conference.
2161
+ let holdCallInfo = null;
2162
+ for (const conf of this.newIncomingCallsList) {
2163
+ if (conf.conferenceId == this.lastActiveConferenceId)
2164
+ continue;
2165
+ holdCallInfo = conf.participants.find((callInfo) => ((this.deviceNumberList.includes(callInfo?.from) && callInfo?.client)
2166
+ || (this.deviceNumberList.includes(callInfo?.to) && callInfo?.direction == 'incoming-call')) && !callInfo?.isLeft && callInfo?.isHold);
2167
+ if (holdCallInfo)
2168
+ break;
2169
+ }
2141
2170
  if (holdCallInfo?.id && !this.isUnholdConferenceCall) {
2142
2171
  let holdInfo = this.onholdOrUnholdParticipant({
2143
2172
  participantId: [holdCallInfo?.id],
@@ -2149,8 +2178,9 @@ class CallProgressComponent {
2149
2178
  console.error('holdInfo 387', holdInfo);
2150
2179
  }
2151
2180
  this.conferenceCallIDForParticipantList = holdCallInfo?.conferenceId;
2152
- // this.getAllParticipants(holdCallInfo?.conferenceId);
2153
2181
  this.isUnholdConferenceCall = false;
2182
+ this.pendingAutoUnhold = false;
2183
+ this.lastActiveConferenceId = null;
2154
2184
  }
2155
2185
  }
2156
2186
  }
@@ -2304,7 +2334,7 @@ class CallProgressComponent {
2304
2334
  catch (error) {
2305
2335
  console.error('Error in addClientParticipant:', error);
2306
2336
  }
2307
- }, 500);
2337
+ }, 1000);
2308
2338
  }
2309
2339
  catch (error) {
2310
2340
  console.error('Rejoin failed', error);