@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.
@@ -1904,6 +1904,8 @@ class CallProgressComponent {
1904
1904
  this.acceptedCallList = [];
1905
1905
  this.isHoldBtnDisable = false;
1906
1906
  this.C2ConfoList = {};
1907
+ this.lastActiveConferenceId = null;
1908
+ this.pendingAutoUnhold = false;
1907
1909
  this.isMinimised = false;
1908
1910
  this.showDisconnectModal = false;
1909
1911
  this.call = this.twilioService.call;
@@ -1922,7 +1924,7 @@ class CallProgressComponent {
1922
1924
  this.deviceNumberList = this.callerIdList.map((res) => res.number);
1923
1925
  }
1924
1926
  ngOnChanges(changes) {
1925
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
1927
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
1926
1928
  if (this.userId) {
1927
1929
  this.extensionService.userId = this.userId;
1928
1930
  }
@@ -1963,7 +1965,7 @@ class CallProgressComponent {
1963
1965
  if (ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.id) {
1964
1966
  this.updatedParticipantList((_a = this.newIncomingCallsList[i]) === null || _a === void 0 ? void 0 : _a.participants);
1965
1967
  this.newIncomingCallsList[i].participants.forEach((res) => __awaiter(this, void 0, void 0, function* () {
1966
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
1968
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1967
1969
  if (res === null || res === void 0 ? void 0 : res.host) {
1968
1970
  this.hostnumber = res;
1969
1971
  }
@@ -1977,9 +1979,9 @@ class CallProgressComponent {
1977
1979
  if (((_e = this.currentCallList) === null || _e === void 0 ? void 0 : _e.length) > 0) {
1978
1980
  let index = this.currentCallList.findIndex((item) => (item === null || item === void 0 ? void 0 : item.id) == (res === null || res === void 0 ? void 0 : res.id));
1979
1981
  if (index == -1 && !res.isLeft && (res === null || res === void 0 ? void 0 : res.status) != 'no-answer' && (res === null || res === void 0 ? void 0 : res.status) != 'canceled') {
1980
- this.currentCallList.push(Object.assign(Object.assign({}, res), { fromName: this.getName(res === null || res === void 0 ? void 0 : res.from) || (res === null || res === void 0 ? void 0 : res.fromName), toName: this.getName(res === null || res === void 0 ? void 0 : res.to) || (res === null || res === void 0 ? void 0 : res.toName), img: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || 'assets/images/user.jpg', isIncomingCall: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call", isHold: res === null || res === void 0 ? void 0 : res.isHold, isConferenceHold: (ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold) || false, isMute: false, isConference: (res === null || res === void 0 ? void 0 : res.isConference) || this.isConference, isAcceptCall: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res === null || res === void 0 ? void 0 : res.id, conferenceSid: callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceSid, name: (res === null || res === void 0 ? void 0 : res.name) || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference((res === null || res === void 0 ? void 0 : res.joinedAt) || new Date().toUTCString()) }));
1982
+ this.currentCallList.push(Object.assign(Object.assign({}, res), { fromName: this.getName(res === null || res === void 0 ? void 0 : res.from) || (res === null || res === void 0 ? void 0 : res.fromName), toName: this.getName(res === null || res === void 0 ? void 0 : res.to) || (res === null || res === void 0 ? void 0 : res.toName), img: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || 'assets/images/user.jpg', isIncomingCall: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call", isHold: res === null || res === void 0 ? void 0 : res.isHold, isConferenceHold: ((_f = this.newIncomingCallsList) === null || _f === void 0 ? void 0 : _f.length) > 1 ? ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold : false, isMute: false, isConference: (res === null || res === void 0 ? void 0 : res.isConference) || this.isConference, isAcceptCall: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res === null || res === void 0 ? void 0 : res.id, conferenceSid: callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceSid, name: (res === null || res === void 0 ? void 0 : res.name) || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference((res === null || res === void 0 ? void 0 : res.joinedAt) || new Date().toUTCString()) }));
1981
1983
  if (this.showContactsPanel) {
1982
- this.conferenceCallIDForParticipantList = (_f = this.currentCall) === null || _f === void 0 ? void 0 : _f.conferenceId;
1984
+ this.conferenceCallIDForParticipantList = (_g = this.currentCall) === null || _g === void 0 ? void 0 : _g.conferenceId;
1983
1985
  // this.getAllParticipants(this.currentCall?.conferenceId);
1984
1986
  this.applyFilter();
1985
1987
  }
@@ -1989,25 +1991,25 @@ class CallProgressComponent {
1989
1991
  }
1990
1992
  else if (index != -1 && ((res === null || res === void 0 ? void 0 : res.isLeft) || (res === null || res === void 0 ? void 0 : res.status) == 'no-answer' || (res === null || res === void 0 ? void 0 : res.status) == 'canceled')) {
1991
1993
  this.isClickExpand = false;
1992
- if (((_g = this.currentCallList[index]) === null || _g === void 0 ? void 0 : _g.id) == ((_h = this.currentCall) === null || _h === void 0 ? void 0 : _h.id)) {
1994
+ if (((_h = this.currentCallList[index]) === null || _h === void 0 ? void 0 : _h.id) == ((_j = this.currentCall) === null || _j === void 0 ? void 0 : _j.id)) {
1993
1995
  this.currentCallList.splice(index, 1);
1994
1996
  }
1995
1997
  else {
1996
1998
  this.currentCallList.splice(index, 1);
1997
1999
  }
1998
2000
  if (this.showContactsPanel) {
1999
- this.conferenceCallIDForParticipantList = (_j = this.currentCall) === null || _j === void 0 ? void 0 : _j.conferenceId;
2001
+ this.conferenceCallIDForParticipantList = (_k = this.currentCall) === null || _k === void 0 ? void 0 : _k.conferenceId;
2000
2002
  // this.getAllParticipants(this.currentCall?.conferenceId)
2001
2003
  this.applyFilter();
2002
2004
  }
2003
- this.startTimer((_k = this.currentCall) === null || _k === void 0 ? void 0 : _k.joinedAt);
2005
+ this.startTimer((_l = this.currentCall) === null || _l === void 0 ? void 0 : _l.joinedAt);
2004
2006
  }
2005
2007
  else if (index != -1 && !(res === null || res === void 0 ? void 0 : res.isLeft)) {
2006
- this.currentCallList[index] = Object.assign(Object.assign({}, res), { fromName: this.getName(res === null || res === void 0 ? void 0 : res.from) || (res === null || res === void 0 ? void 0 : res.fromName), toName: this.getName(res === null || res === void 0 ? void 0 : res.to) || (res === null || res === void 0 ? void 0 : res.toName), img: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || 'assets/images/user.jpg', isIncomingCall: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call", isHold: res === null || res === void 0 ? void 0 : res.isHold, isConferenceHold: (ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold) || false, isMute: res === null || res === void 0 ? void 0 : res.isMute, isConference: res.isConference ? res.isConference : this.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res === null || res === void 0 ? void 0 : res.id, conferenceSid: callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceSid, name: (res === null || res === void 0 ? void 0 : res.name) || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference((res === null || res === void 0 ? void 0 : res.joinedAt) || new Date().toUTCString()) });
2008
+ this.currentCallList[index] = Object.assign(Object.assign({}, res), { fromName: this.getName(res === null || res === void 0 ? void 0 : res.from) || (res === null || res === void 0 ? void 0 : res.fromName), toName: this.getName(res === null || res === void 0 ? void 0 : res.to) || (res === null || res === void 0 ? void 0 : res.toName), img: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || 'assets/images/user.jpg', isIncomingCall: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call", isHold: res === null || res === void 0 ? void 0 : res.isHold, isConferenceHold: ((_m = this.newIncomingCallsList) === null || _m === void 0 ? void 0 : _m.length) > 1 ? ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold : false, isMute: res === null || res === void 0 ? void 0 : res.isMute, isConference: res.isConference ? res.isConference : this.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: (res === null || res === void 0 ? void 0 : res.direction) == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res === null || res === void 0 ? void 0 : res.id, conferenceSid: callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceSid, name: (res === null || res === void 0 ? void 0 : res.name) || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference((res === null || res === void 0 ? void 0 : res.joinedAt) || new Date().toUTCString()) });
2007
2009
  }
2008
2010
  }
2009
2011
  else if (!res.isLeft && (res === null || res === void 0 ? void 0 : res.status) != 'no-answer' && (res === null || res === void 0 ? void 0 : res.status) != 'canceled') {
2010
- this.currentCallList.push(Object.assign(Object.assign({}, res), { fromName: this.getName(res === null || res === void 0 ? void 0 : res.from) || (res === null || res === void 0 ? void 0 : res.fromName), toName: this.getName(res === null || res === void 0 ? void 0 : res.to) || (res === null || res === void 0 ? void 0 : res.toName), img: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res === null || res === void 0 ? void 0 : res.isHold, isConferenceHold: (ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold) || false, isMute: res === null || res === void 0 ? void 0 : res.isMute, isConference: res.isConference ? res.isConference : this.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, conferenceSid: callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceSid, name: (res === null || res === void 0 ? void 0 : res.name) || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference((res === null || res === void 0 ? void 0 : res.joinedAt) || new Date().toUTCString()) }));
2012
+ this.currentCallList.push(Object.assign(Object.assign({}, res), { fromName: this.getName(res === null || res === void 0 ? void 0 : res.from) || (res === null || res === void 0 ? void 0 : res.fromName), toName: this.getName(res === null || res === void 0 ? void 0 : res.to) || (res === null || res === void 0 ? void 0 : res.toName), img: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res === null || res === void 0 ? void 0 : res.isHold, isConferenceHold: ((_o = this.newIncomingCallsList) === null || _o === void 0 ? void 0 : _o.length) > 1 ? ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold : false, isMute: res === null || res === void 0 ? void 0 : res.isMute, isConference: res.isConference ? res.isConference : this.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, conferenceSid: callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceSid, name: (res === null || res === void 0 ? void 0 : res.name) || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference((res === null || res === void 0 ? void 0 : res.joinedAt) || new Date().toUTCString()) }));
2011
2013
  this.timer = '00:00';
2012
2014
  this.startTimer(res === null || res === void 0 ? void 0 : res.joinedAt);
2013
2015
  }
@@ -2058,7 +2060,22 @@ class CallProgressComponent {
2058
2060
  return ((this.deviceNumberList.includes(participant === null || participant === void 0 ? void 0 : participant.from) && (participant === null || participant === void 0 ? void 0 : participant.direction) == 'outgoing-call' && (participant === null || participant === void 0 ? void 0 : participant.client)) || (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.client))) && !(participant === null || participant === void 0 ? void 0 : participant.isLeft) && !(participant === null || participant === void 0 ? void 0 : participant.isHold);
2059
2061
  });
2060
2062
  });
2061
- if (((_p = this.currentConferenceCall) === null || _p === void 0 ? void 0 : _p.participants.length) == 2 && ((_r = (_q = this.currentConferenceCall) === null || _q === void 0 ? void 0 : _q.participants[0]) === null || _r === void 0 ? void 0 : _r.id)) {
2063
+ // Detect disconnect vs. hold transition exactly once per event.
2064
+ // Same participant filter as getCurrentCallInfo() (without !isHold) to stay consistent.
2065
+ if (this.currentConferenceCall && !((_p = currentCall[0]) === null || _p === void 0 ? void 0 : _p.isHold)) {
2066
+ this.lastActiveConferenceId = this.currentConferenceCall.conferenceId;
2067
+ this.pendingAutoUnhold = false;
2068
+ }
2069
+ else if (this.lastActiveConferenceId && !this.pendingAutoUnhold) {
2070
+ const lastConf = this.newIncomingCallsList.find((c) => c.conferenceId == this.lastActiveConferenceId);
2071
+ const ourParticipantInLastConf = (_q = lastConf === null || lastConf === void 0 ? void 0 : lastConf.participants) === null || _q === void 0 ? void 0 : _q.find((p) => ((this.deviceNumberList.includes(p === null || p === void 0 ? void 0 : p.from) && (p === null || p === void 0 ? void 0 : p.direction) == 'outgoing-call' && (p === null || p === void 0 ? void 0 : p.client)) ||
2072
+ (this.deviceNumberList.includes(p === null || p === void 0 ? void 0 : p.to) && (p === null || p === void 0 ? void 0 : p.direction) == 'incoming-call' && (p === null || p === void 0 ? void 0 : p.client))) && !(p === null || p === void 0 ? void 0 : p.isLeft));
2073
+ // Conference gone OR our participant not held → the active call disconnected → queue auto-unhold
2074
+ if (!lastConf || !(ourParticipantInLastConf === null || ourParticipantInLastConf === void 0 ? void 0 : ourParticipantInLastConf.isHold)) {
2075
+ this.pendingAutoUnhold = true;
2076
+ }
2077
+ }
2078
+ if (((_r = this.currentConferenceCall) === null || _r === void 0 ? void 0 : _r.participants.length) == 2 && ((_t = (_s = this.currentConferenceCall) === null || _s === void 0 ? void 0 : _s.participants[0]) === null || _t === void 0 ? void 0 : _t.id)) {
2062
2079
  this.currentCall = Object.assign({}, this.currentCallList.find((res) => !(res === null || res === void 0 ? void 0 : res.isConferenceHold) && (((res === null || res === void 0 ? void 0 : res.direction) == 'outgoing-call' && (res === null || res === void 0 ? void 0 : res.client) && !this.deviceNumberList.includes(res === null || res === void 0 ? void 0 : res.from)) || ((res === null || res === void 0 ? void 0 : res.direction) == 'incoming-call' && (res === null || res === void 0 ? void 0 : res.client) && !this.deviceNumberList.includes(res === null || res === void 0 ? void 0 : res.to)) || !(res === null || res === void 0 ? void 0 : res.client))));
2063
2080
  this.currentCall['isAcceptCall'] = true;
2064
2081
  if (this.currentCallList.length == 1) {
@@ -2066,23 +2083,35 @@ class CallProgressComponent {
2066
2083
  this.currentCall['isAcceptCall'] = true;
2067
2084
  }
2068
2085
  }
2069
- else if (((_t = (_s = this.currentConferenceCall) === null || _s === void 0 ? void 0 : _s.participants) === null || _t === void 0 ? void 0 : _t.length) > 2 && ((_v = (_u = this.currentConferenceCall) === null || _u === void 0 ? void 0 : _u.participants[1]) === null || _v === void 0 ? void 0 : _v.isConference)) {
2086
+ else if (((_v = (_u = this.currentConferenceCall) === null || _u === void 0 ? void 0 : _u.participants) === null || _v === void 0 ? void 0 : _v.length) > 2 && ((_x = (_w = this.currentConferenceCall) === null || _w === void 0 ? void 0 : _w.participants[1]) === null || _x === void 0 ? void 0 : _x.isConference)) {
2070
2087
  this.currentCall = this.currentCallList.find((res) => !(res === null || res === void 0 ? void 0 : res.isConferenceHold));
2071
2088
  this.isConference = true;
2072
2089
  }
2073
- else if (((_x = (_w = this.currentConferenceCall) === null || _w === void 0 ? void 0 : _w.participants) === null || _x === void 0 ? void 0 : _x.length) == 1 && ((_z = (_y = this.currentConferenceCall) === null || _y === void 0 ? void 0 : _y.participants[0]) === null || _z === void 0 ? void 0 : _z.id)) {
2090
+ else if (((_z = (_y = this.currentConferenceCall) === null || _y === void 0 ? void 0 : _y.participants) === null || _z === void 0 ? void 0 : _z.length) == 1 && ((_1 = (_0 = this.currentConferenceCall) === null || _0 === void 0 ? void 0 : _0.participants[0]) === null || _1 === void 0 ? void 0 : _1.id)) {
2074
2091
  this.currentCall = this.currentCallList.find((callInfo) => { var _a, _b; return (callInfo === null || callInfo === void 0 ? void 0 : callInfo.id) == ((_b = (_a = this.currentConferenceCall) === null || _a === void 0 ? void 0 : _a.participants[0]) === null || _b === void 0 ? void 0 : _b.id); });
2075
- if (((_0 = this.currentCall) === null || _0 === void 0 ? void 0 : _0.client) && ((_1 = this.currentCall) === null || _1 === void 0 ? void 0 : _1.direction) == 'outgoing-call' && this.deviceNumberList.includes((_2 = this.currentCall) === null || _2 === void 0 ? void 0 : _2.from)) {
2092
+ if (((_2 = this.currentCall) === null || _2 === void 0 ? void 0 : _2.client) && ((_3 = this.currentCall) === null || _3 === void 0 ? void 0 : _3.direction) == 'outgoing-call' && this.deviceNumberList.includes((_4 = this.currentCall) === null || _4 === void 0 ? void 0 : _4.from)) {
2076
2093
  this.currentCall['client'] = false;
2077
2094
  this.currentCall['isAcceptCall'] = true;
2078
2095
  }
2079
2096
  }
2097
+ else if (!this.currentConferenceCall && this.currentCall && ((_5 = this.currentCallList) === null || _5 === void 0 ? void 0 : _5.length) > 0) {
2098
+ this.currentCall = this.currentCallList.find((res) => { var _a; return (res === null || res === void 0 ? void 0 : res.id) == ((_a = this.currentCall) === null || _a === void 0 ? void 0 : _a.id); });
2099
+ }
2080
2100
  if (!this.currentConferenceCall && !this.isNewAddedCall) {
2081
2101
  let currentConferenceCallInfo = this.getCurrentCallInfo();
2082
- if (!(currentConferenceCallInfo === null || currentConferenceCallInfo === void 0 ? void 0 : currentConferenceCallInfo.id)) {
2083
- let holdCallInfo = this.newIncomingCallsList[0].participants.find((callInfo) => ((this.deviceNumberList.includes(callInfo === null || callInfo === void 0 ? void 0 : callInfo.from) && (callInfo === null || callInfo === void 0 ? void 0 : callInfo.client))
2084
- || (this.deviceNumberList.includes(callInfo === null || callInfo === void 0 ? void 0 : callInfo.to) && (callInfo === null || callInfo === void 0 ? void 0 : callInfo.direction) == 'incoming-call')) && !(callInfo === null || callInfo === void 0 ? void 0 : callInfo.isLeft) && (callInfo === null || callInfo === void 0 ? void 0 : callInfo.isHold));
2085
- // this.isUnholdConferenceCall
2102
+ if (!(currentConferenceCallInfo === null || currentConferenceCallInfo === void 0 ? void 0 : currentConferenceCallInfo.id) && this.pendingAutoUnhold) {
2103
+ // Search ALL conferences except the one that just disconnected.
2104
+ // This prevents a single-conference hold (including brief isLeft race conditions)
2105
+ // from ever triggering an unhold — we only unhold a DIFFERENT held conference.
2106
+ let holdCallInfo = null;
2107
+ for (const conf of this.newIncomingCallsList) {
2108
+ if (conf.conferenceId == this.lastActiveConferenceId)
2109
+ continue;
2110
+ holdCallInfo = conf.participants.find((callInfo) => ((this.deviceNumberList.includes(callInfo === null || callInfo === void 0 ? void 0 : callInfo.from) && (callInfo === null || callInfo === void 0 ? void 0 : callInfo.client))
2111
+ || (this.deviceNumberList.includes(callInfo === null || callInfo === void 0 ? void 0 : callInfo.to) && (callInfo === null || callInfo === void 0 ? void 0 : callInfo.direction) == 'incoming-call')) && !(callInfo === null || callInfo === void 0 ? void 0 : callInfo.isLeft) && (callInfo === null || callInfo === void 0 ? void 0 : callInfo.isHold));
2112
+ if (holdCallInfo)
2113
+ break;
2114
+ }
2086
2115
  if ((holdCallInfo === null || holdCallInfo === void 0 ? void 0 : holdCallInfo.id) && !this.isUnholdConferenceCall) {
2087
2116
  let holdInfo = this.onholdOrUnholdParticipant({
2088
2117
  participantId: [holdCallInfo === null || holdCallInfo === void 0 ? void 0 : holdCallInfo.id],
@@ -2094,12 +2123,13 @@ class CallProgressComponent {
2094
2123
  console.error('holdInfo 387', holdInfo);
2095
2124
  }
2096
2125
  this.conferenceCallIDForParticipantList = holdCallInfo === null || holdCallInfo === void 0 ? void 0 : holdCallInfo.conferenceId;
2097
- // this.getAllParticipants(holdCallInfo?.conferenceId);
2098
2126
  this.isUnholdConferenceCall = false;
2127
+ this.pendingAutoUnhold = false;
2128
+ this.lastActiveConferenceId = null;
2099
2129
  }
2100
2130
  }
2101
2131
  }
2102
- if ((_3 = this.selectedUserInfo) === null || _3 === void 0 ? void 0 : _3.participantId) {
2132
+ if ((_6 = this.selectedUserInfo) === null || _6 === void 0 ? void 0 : _6.participantId) {
2103
2133
  let selectedUser = this.currentCallList.find((item) => { var _a; return (item === null || item === void 0 ? void 0 : item.id) == ((_a = this.selectedUserInfo) === null || _a === void 0 ? void 0 : _a.participantId); });
2104
2134
  if (selectedUser) {
2105
2135
  selectedUser.IsUserInfoShow = true;
@@ -2156,7 +2186,7 @@ class CallProgressComponent {
2156
2186
  this.conferenceCallList = uniqueList.map((item, index) => (Object.assign(Object.assign({}, item), { conferenceName: `Conference ${index + 1}` })));
2157
2187
  this.conferenceCallNullCount = 0;
2158
2188
  }
2159
- else if (!((_4 = this.newIncomingCallsList) === null || _4 === void 0 ? void 0 : _4.length)) {
2189
+ else if (!((_7 = this.newIncomingCallsList) === null || _7 === void 0 ? void 0 : _7.length)) {
2160
2190
  if (this.conferenceCallNullCount > 5) {
2161
2191
  console.log('411');
2162
2192
  this.isRinging = false;
@@ -2182,12 +2212,12 @@ class CallProgressComponent {
2182
2212
  }
2183
2213
  ;
2184
2214
  }
2185
- if (((_5 = changes['callAction']) === null || _5 === void 0 ? void 0 : _5.currentValue) && ((_6 = this.callAction) === null || _6 === void 0 ? void 0 : _6.type) == 'reJoin') {
2215
+ if (((_8 = changes['callAction']) === null || _8 === void 0 ? void 0 : _8.currentValue) && ((_9 = this.callAction) === null || _9 === void 0 ? void 0 : _9.type) == 'reJoin') {
2186
2216
  this.deviceNumberList = this.callerIdList.map((res) => res.number);
2187
2217
  this.rejoinHost(this.callAction);
2188
2218
  }
2189
- if ((_7 = changes['newCallConference']) === null || _7 === void 0 ? void 0 : _7.currentValue) {
2190
- this.CallToUnsavedNumber((_8 = this.newCallConference) === null || _8 === void 0 ? void 0 : _8.number, true);
2219
+ if ((_10 = changes['newCallConference']) === null || _10 === void 0 ? void 0 : _10.currentValue) {
2220
+ this.CallToUnsavedNumber((_11 = this.newCallConference) === null || _11 === void 0 ? void 0 : _11.number, true);
2191
2221
  }
2192
2222
  }
2193
2223
  rejoinHost(callInfo) {
@@ -2249,7 +2279,7 @@ class CallProgressComponent {
2249
2279
  catch (error) {
2250
2280
  console.error('Error in addClientParticipant:', error);
2251
2281
  }
2252
- }), 500);
2282
+ }), 1000);
2253
2283
  }
2254
2284
  catch (error) {
2255
2285
  console.error('Rejoin failed', error);