@vgroup/dialbox 0.3.78 → 0.3.79

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.
@@ -1801,8 +1801,76 @@ class CallProgressComponent {
1801
1801
  try {
1802
1802
  if (this.newIncomingCallsList.length) {
1803
1803
  // Check if there's an active ongoing call
1804
- this.newIncomingCallsList.forEach((res) => {
1805
- if (this.currentCallList.findIndex((item) => item.id == res.id) == -1) {
1804
+ this.newIncomingCallsList.forEach(async (res) => {
1805
+ if (this.currentCallList.length > 0) {
1806
+ let index = this.currentCallList.findIndex((item) => item.id == res.id);
1807
+ if (index == -1 && !res.isLeft) {
1808
+ this.currentCallList.push({
1809
+ ...res,
1810
+ img: 'assets/images/user.jpg',
1811
+ isIncomingCall: res.direction == "incoming-call",
1812
+ isHold: res.isHold,
1813
+ isMute: false,
1814
+ isConference: res.isConference,
1815
+ isAcceptCall: this.getStatus(res),
1816
+ dial: true,
1817
+ phone: res.direction == "incoming-call" ? res?.from : res?.to,
1818
+ participantId: res.id,
1819
+ name: res.name,
1820
+ });
1821
+ }
1822
+ else if (index != -1 && res.isLeft) {
1823
+ if (this.currentCallList[index].id == this.currentCall.id) {
1824
+ this.currentCallList.splice(index, 1);
1825
+ this.currentCall = this.currentCallList.length > 0 ? this.currentCallList[0] : {};
1826
+ if (this.currentCall?.isHold && !this.currentCall?.isConference) {
1827
+ await this.onholdOrUnholdParticipant({
1828
+ participantId: [this.currentCall?.participantId],
1829
+ conferenceId: this.conferenceId,
1830
+ hold: false
1831
+ });
1832
+ this.currentCallList[0].isHold = false;
1833
+ }
1834
+ else if (this.currentCall?.isHold && this.currentCall?.isConference) {
1835
+ let conferenceCalllist = this.currentCallList.filter((item) => item.isConference);
1836
+ if (conferenceCalllist.length > 0) {
1837
+ await this.onholdOrUnholdParticipant({
1838
+ participantId: conferenceCalllist.map((item) => item.participantId),
1839
+ conferenceId: this.conferenceId,
1840
+ hold: false
1841
+ });
1842
+ this.currentCallList.forEach((item) => {
1843
+ if (item.isConference) {
1844
+ item.isHold = false;
1845
+ }
1846
+ else {
1847
+ item.isHold = true;
1848
+ }
1849
+ });
1850
+ }
1851
+ }
1852
+ }
1853
+ else {
1854
+ this.currentCallList.splice(index, 1);
1855
+ }
1856
+ }
1857
+ else {
1858
+ this.currentCallList[index] = {
1859
+ ...res,
1860
+ img: 'assets/images/user.jpg',
1861
+ isIncomingCall: res.direction == "incoming-call",
1862
+ isHold: res.isHold,
1863
+ isMute: false,
1864
+ isConference: res.isConference,
1865
+ isAcceptCall: this.getStatus(res),
1866
+ dial: true,
1867
+ phone: res.direction == "incoming-call" ? res?.from : res?.to,
1868
+ participantId: res.id,
1869
+ name: res.name,
1870
+ };
1871
+ }
1872
+ }
1873
+ else {
1806
1874
  this.currentCallList.push({
1807
1875
  ...res,
1808
1876
  img: 'assets/images/user.jpg',
@@ -1838,7 +1906,7 @@ class CallProgressComponent {
1838
1906
  }
1839
1907
  getStatus(res) {
1840
1908
  if (res.direction == "incoming-call") {
1841
- if (res.status == "participant-join" || res.status == "participant-hold" || res.status == "participant-mute") {
1909
+ if (res.status == "answered" || res.status == "participant-hold" || res.status == "participant-mute" || res.status == "participant-join") {
1842
1910
  return true;
1843
1911
  }
1844
1912
  else {
@@ -1846,7 +1914,7 @@ class CallProgressComponent {
1846
1914
  }
1847
1915
  }
1848
1916
  else if (res.direction == "outgoing-call") {
1849
- if (res.status == "participant-join" || res.status == "participant-hold" || res.status == "participant-mute") {
1917
+ if (res.status == "answered" || res.status == "participant-hold" || res.status == "participant-mute" || res.status == "participant-join") {
1850
1918
  return true;
1851
1919
  }
1852
1920
  else {