@vgroup/dialbox 0.4.91 → 0.4.93

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.
@@ -1780,6 +1780,8 @@ class CallProgressComponent {
1780
1780
  this.searchText = '';
1781
1781
  this.filteredList = [];
1782
1782
  this.showButton = false;
1783
+ this.isRinging = false;
1784
+ this.incomingAudio = new Audio('assets/silent-sound.mp3');
1783
1785
  this.micOn = false;
1784
1786
  this.isMinimised = false;
1785
1787
  console.log('Call Progress Component');
@@ -1789,6 +1791,7 @@ class CallProgressComponent {
1789
1791
  console.log('Call Progress Component ngOnInit');
1790
1792
  // Subscribe to incoming calls from TwilioService
1791
1793
  try {
1794
+ this.incomingAudio['loop'] = false;
1792
1795
  this.twilioService.currentCall.subscribe((incoming) => {
1793
1796
  if (!incoming) {
1794
1797
  return;
@@ -1993,10 +1996,14 @@ class CallProgressComponent {
1993
1996
  }
1994
1997
  }
1995
1998
  this.cdr.detectChanges();
1996
- if (this.currentCallList && this.currentCallList[0].isIncomingCall && this.currentCallList[0].isAcceptCall) {
1997
- let incomingAudio = new Audio('assets/sample-file-4.mp3');
1998
- incomingAudio.loop = false;
1999
- incomingAudio.play();
1999
+ let incomingData = this.currentCallList.find((res) => res.isIncomingCall && !res.isAcceptCall);
2000
+ if (incomingData?.id) {
2001
+ this.isRinging = true;
2002
+ this.incomingAudio.play();
2003
+ }
2004
+ else if (!incomingData?.id) {
2005
+ this.isRinging = false;
2006
+ this.incomingAudio.pause();
2000
2007
  }
2001
2008
  console.log('currentCallList', this.currentCallList);
2002
2009
  }