@vgroup/dialbox 0.4.60 → 0.4.62

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.
@@ -1817,7 +1817,7 @@ class CallProgressComponent {
1817
1817
  if (changes['callData']) {
1818
1818
  if (changes['callData'].currentValue?.isIncomingCall) {
1819
1819
  this.incomingCallDiv = true;
1820
- this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
1820
+ // this.call['callInfo'] = JSON.parse(JSON.stringify(this.callData));
1821
1821
  this.cdr.detectChanges();
1822
1822
  }
1823
1823
  else if (changes['callData'].currentValue?.displayNum || changes['callData'].currentValue?.from) {
@@ -1841,105 +1841,76 @@ class CallProgressComponent {
1841
1841
  }
1842
1842
  }
1843
1843
  if (changes['newIncomingCallsList']) {
1844
- try {
1845
- if (this.newIncomingCallsList.length) {
1846
- // Check if there's an active ongoing call
1847
- this.conferenceId = this.newIncomingCallsList[0].conferenceId;
1848
- this.newIncomingCallsList.forEach(async (res) => {
1849
- if (this.currentCallList.length > 0) {
1850
- let index = this.currentCallList.findIndex((item) => item.id == res.id);
1851
- if (index == -1 && !res.isLeft) {
1852
- this.currentCallList.push({
1853
- ...res,
1854
- img: 'assets/images/user.jpg',
1855
- isIncomingCall: res.direction == "incoming-call",
1856
- isHold: res.isHold,
1857
- isMute: false,
1858
- isConference: res.isConference,
1859
- isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true,
1860
- dial: true,
1861
- phone: res.direction == "incoming-call" ? res?.from : res?.to,
1862
- participantId: res.id,
1863
- name: res.name || res?.fromName || res?.toName,
1864
- time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()),
1865
- });
1866
- if (this.showContactsPanel) {
1867
- this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1868
- this.applyFilter();
1869
- }
1844
+ // try {
1845
+ if (this.newIncomingCallsList?.length) {
1846
+ // Check if there's an active ongoing call
1847
+ this.conferenceId = this.newIncomingCallsList[0].conferenceId;
1848
+ this.newIncomingCallsList.forEach(async (res) => {
1849
+ if (this.currentCallList.length > 0) {
1850
+ let index = this.currentCallList.findIndex((item) => item.id == res.id);
1851
+ if (index == -1 && !res.isLeft) {
1852
+ this.currentCallList.push({
1853
+ ...res,
1854
+ img: 'assets/images/user.jpg',
1855
+ isIncomingCall: res.direction == "incoming-call",
1856
+ isHold: res.isHold,
1857
+ isMute: false,
1858
+ isConference: res.isConference,
1859
+ isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true,
1860
+ dial: true,
1861
+ phone: res.direction == "incoming-call" ? res?.from : res?.to,
1862
+ participantId: res.id,
1863
+ name: res.name || res?.fromName || res?.toName,
1864
+ time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()),
1865
+ });
1866
+ if (this.showContactsPanel) {
1867
+ this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1868
+ this.applyFilter();
1870
1869
  }
1871
- else if (index != -1 && res.isLeft) {
1872
- if (this.currentCallList[index]?.id == this.currentCall?.id) {
1873
- this.currentCallList.splice(index, 1);
1874
- this.currentCall = this.currentCallList.length > 0 ? this.currentCallList[0] : {};
1875
- if (this.currentCall?.isHold && !this.currentCall?.isConference) {
1870
+ }
1871
+ else if (index != -1 && res.isLeft) {
1872
+ if (this.currentCallList[index]?.id == this.currentCall?.id) {
1873
+ this.currentCallList.splice(index, 1);
1874
+ this.currentCall = this.currentCallList.length > 0 ? this.currentCallList[0] : {};
1875
+ if (this.currentCall?.isHold && !this.currentCall?.isConference) {
1876
+ await this.onholdOrUnholdParticipant({
1877
+ participantId: [this.currentCall?.participantId],
1878
+ conferenceId: this.conferenceId,
1879
+ hold: false,
1880
+ conference: this.currentCall?.isConference
1881
+ });
1882
+ // this.currentCallList[0].isHold = false;
1883
+ }
1884
+ else if (this.currentCall?.isHold && this.currentCall?.isConference) {
1885
+ let conferenceCalllist = this.currentCallList.filter((item) => item.isConference);
1886
+ if (conferenceCalllist.length > 0) {
1876
1887
  await this.onholdOrUnholdParticipant({
1877
- participantId: [this.currentCall?.participantId],
1888
+ participantId: conferenceCalllist.map((item) => item.participantId),
1878
1889
  conferenceId: this.conferenceId,
1879
1890
  hold: false,
1880
1891
  conference: this.currentCall?.isConference
1881
1892
  });
1882
- // this.currentCallList[0].isHold = false;
1893
+ // this.currentCallList.forEach((item: any) => {
1894
+ // if (item.isConference) {
1895
+ // item.isHold = false;
1896
+ // } else {
1897
+ // item.isHold = true;
1898
+ // }
1899
+ // })
1900
+ this.isConferenceCallHold = false;
1883
1901
  }
1884
- else if (this.currentCall?.isHold && this.currentCall?.isConference) {
1885
- let conferenceCalllist = this.currentCallList.filter((item) => item.isConference);
1886
- if (conferenceCalllist.length > 0) {
1887
- await this.onholdOrUnholdParticipant({
1888
- participantId: conferenceCalllist.map((item) => item.participantId),
1889
- conferenceId: this.conferenceId,
1890
- hold: false,
1891
- conference: this.currentCall?.isConference
1892
- });
1893
- // this.currentCallList.forEach((item: any) => {
1894
- // if (item.isConference) {
1895
- // item.isHold = false;
1896
- // } else {
1897
- // item.isHold = true;
1898
- // }
1899
- // })
1900
- this.isConferenceCallHold = false;
1901
- }
1902
- }
1903
- }
1904
- else {
1905
- this.currentCallList.splice(index, 1);
1906
- }
1907
- if (this.showContactsPanel) {
1908
- this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1909
- this.applyFilter();
1910
1902
  }
1911
1903
  }
1912
- else if (index != -1) {
1913
- this.currentCallList[index] = {
1914
- ...res,
1915
- img: 'assets/images/user.jpg',
1916
- isIncomingCall: res.direction == "incoming-call",
1917
- isHold: res.isHold,
1918
- isMute: false,
1919
- isConference: res.isConference,
1920
- isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true,
1921
- dial: true,
1922
- phone: res.direction == "incoming-call" ? res?.from : res?.to,
1923
- participantId: res.id,
1924
- name: res.name || res?.fromName || res?.toName,
1925
- time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()),
1926
- };
1904
+ else {
1905
+ this.currentCallList.splice(index, 1);
1927
1906
  }
1928
- if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1929
- setTimeout(() => {
1930
- if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1931
- this.onholdOrUnholdParticipant({
1932
- participantId: [this.currentCallList[0].participantId],
1933
- conferenceId: this.conferenceId,
1934
- hold: false,
1935
- conference: this.currentCallList[0].isConference
1936
- });
1937
- }
1938
- }, 1000);
1907
+ if (this.showContactsPanel) {
1908
+ this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1909
+ this.applyFilter();
1939
1910
  }
1940
1911
  }
1941
- else {
1942
- this.currentCallList.push({
1912
+ else if (index != -1) {
1913
+ this.currentCallList[index] = {
1943
1914
  ...res,
1944
1915
  img: 'assets/images/user.jpg',
1945
1916
  isIncomingCall: res.direction == "incoming-call",
@@ -1952,68 +1923,90 @@ class CallProgressComponent {
1952
1923
  participantId: res.id,
1953
1924
  name: res.name || res?.fromName || res?.toName,
1954
1925
  time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()),
1955
- });
1956
- this.timer = '00:00';
1957
- this.startTimer();
1926
+ };
1958
1927
  }
1959
- });
1960
- let currentCall = this.currentCallList.find((item) => item.isAcceptCall && !item.isHold);
1961
- if (currentCall?.id) {
1962
- this.currentCall = currentCall;
1963
- }
1964
- if (this.selectedUserInfo?.participantId) {
1965
- let selectedUser = this.currentCallList.find((item) => item.id == this.selectedUserInfo.participantId);
1966
- if (selectedUser) {
1967
- selectedUser.IsUserInfoShow = true;
1968
- this.selectedUserInfo = selectedUser;
1969
- this.checkTextHeight();
1970
- }
1971
- else {
1972
- let incomingCall = this.currentCallList.find((item) => item?.businessNumber);
1973
- if (incomingCall?.participantId) {
1974
- this.selectedUserInfo = incomingCall;
1975
- if (this.isClickExpand) {
1976
- this.checkTextHeight();
1928
+ if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1929
+ setTimeout(() => {
1930
+ if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1931
+ this.onholdOrUnholdParticipant({
1932
+ participantId: [this.currentCallList[0].participantId],
1933
+ conferenceId: this.conferenceId,
1934
+ hold: false,
1935
+ conference: this.currentCallList[0].isConference
1936
+ });
1977
1937
  }
1978
- }
1979
- else {
1980
- this.selectedUserInfo = {};
1981
- this.isClickExpand = false;
1982
- }
1938
+ }, 1000);
1983
1939
  }
1984
1940
  }
1985
1941
  else {
1986
- let resIndex = this.currentCallList.findIndex((item) => !!item?.businessNumber);
1987
- if (resIndex > -1) {
1988
- this.isClickExpand = true;
1989
- this.currentCallList[resIndex].IsUserInfoShow = true;
1990
- this.selectedUserInfo = this.currentCallList[resIndex];
1991
- this.checkTextHeight();
1992
- }
1942
+ this.currentCallList.push({
1943
+ ...res,
1944
+ img: 'assets/images/user.jpg',
1945
+ isIncomingCall: res.direction == "incoming-call",
1946
+ isHold: res.isHold,
1947
+ isMute: false,
1948
+ isConference: res.isConference,
1949
+ isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true,
1950
+ dial: true,
1951
+ phone: res.direction == "incoming-call" ? res?.from : res?.to,
1952
+ participantId: res.id,
1953
+ name: res.name || res?.fromName || res?.toName,
1954
+ time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()),
1955
+ });
1956
+ this.timer = '00:00';
1957
+ this.startTimer();
1993
1958
  }
1994
- this.cdr.detectChanges();
1995
- console.log('currentCallList', this.currentCallList);
1959
+ });
1960
+ let currentCall = this.currentCallList.find((item) => item.isAcceptCall && !item.isHold);
1961
+ if (currentCall?.id) {
1962
+ this.currentCall = currentCall;
1996
1963
  }
1997
- else if (!this.newIncomingCallsList.length) {
1998
- this.isConcurrentIncoming = false;
1999
- this.incomingCallDiv = false;
2000
- this.cdr.detectChanges();
2001
- this.currentCallList = [];
2002
- this.currentCall = {};
2003
- this.isCallInProgress = false;
2004
- this.isConferenceCallHold = false;
2005
- this.stopTimer();
2006
- if (this.call) {
2007
- this.call.disconnect();
1964
+ if (this.selectedUserInfo?.participantId) {
1965
+ let selectedUser = this.currentCallList.find((item) => item.id == this.selectedUserInfo.participantId);
1966
+ if (selectedUser) {
1967
+ selectedUser.IsUserInfoShow = true;
1968
+ this.selectedUserInfo = selectedUser;
1969
+ this.checkTextHeight();
2008
1970
  }
2009
- if (this.twilioService.device) {
2010
- this.twilioService.device.disconnectAll();
1971
+ else {
1972
+ let incomingCall = this.currentCallList.find((item) => item?.businessNumber);
1973
+ if (incomingCall?.participantId) {
1974
+ this.selectedUserInfo = incomingCall;
1975
+ if (this.isClickExpand) {
1976
+ this.checkTextHeight();
1977
+ }
1978
+ }
1979
+ else {
1980
+ this.selectedUserInfo = {};
1981
+ this.isClickExpand = false;
1982
+ }
2011
1983
  }
2012
1984
  }
1985
+ else {
1986
+ let resIndex = this.currentCallList.findIndex((item) => !!item?.businessNumber);
1987
+ if (resIndex > -1) {
1988
+ this.isClickExpand = true;
1989
+ this.currentCallList[resIndex].IsUserInfoShow = true;
1990
+ this.selectedUserInfo = this.currentCallList[resIndex];
1991
+ this.checkTextHeight();
1992
+ }
1993
+ }
1994
+ this.cdr.detectChanges();
1995
+ console.log('currentCallList', this.currentCallList);
2013
1996
  }
2014
- catch (e) {
2015
- console.log(e);
1997
+ else if (!this.newIncomingCallsList?.length) {
1998
+ this.isConcurrentIncoming = false;
1999
+ this.incomingCallDiv = false;
2000
+ this.cdr.detectChanges();
2001
+ this.currentCallList = [];
2002
+ this.currentCall = {};
2003
+ this.isCallInProgress = false;
2004
+ this.isConferenceCallHold = false;
2005
+ this.stopTimer();
2016
2006
  }
2007
+ // } catch (e) {
2008
+ // console.log(e);
2009
+ // }
2017
2010
  }
2018
2011
  }
2019
2012
  getStatus(res) {
@@ -2394,13 +2387,13 @@ class CallProgressComponent {
2394
2387
  // }
2395
2388
  }
2396
2389
  async toggleMute(isConference) {
2397
- await this.onMuteParticipant({
2398
- participantId: [this.currentCall?.participantId],
2399
- conferenceId: this.conferenceId,
2400
- mute: !this.isMute,
2401
- });
2390
+ // await this.onMuteParticipant({
2391
+ // participantId: [this.currentCall?.participantId],
2392
+ // conferenceId: this.conferenceId,
2393
+ // mute: !this.isMute,
2394
+ // })
2402
2395
  this.isMute = !this.isMute;
2403
- // this.call?.mute(this.isMute);
2396
+ this.call?.mute(this.isMute);
2404
2397
  // if (isConference) {
2405
2398
  this.currentCall.isMute = this.isMute;
2406
2399
  // } else {