Skip to content

Commit

Permalink
[Calling sounds] Fix issue where ringing sound keeps playing on the d…
Browse files Browse the repository at this point in the history
…isconnecting screen (#3889)

* stop ringing when disconnecting

* Change files

* Duplicate change files for beta release

* update helper to be for whether to play ringing or not
  • Loading branch information
dmceachernmsft authored Dec 15, 2023
1 parent cf8225f commit 2d63849
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "prerelease",
"area": "fix",
"workstream": "Calling Sounds",
"comment": "Stop the ringing sound from playing when the call disconnects before the callee answers",
"packageName": "@azure/communication-react",
"email": "94866715+dmceachernmsft@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "prerelease",
"area": "fix",
"workstream": "Calling Sounds",
"comment": "Stop the ringing sound from playing when the call disconnects before the callee answers",
"packageName": "@azure/communication-react",
"email": "94866715+dmceachernmsft@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@ export class CallingSoundSubscriber {

private onCallStateChanged = (): void => {
this.call.on('stateChanged', () => {
if (isPSTNCall(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {
if (shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {
this.soundsLoaded.callRingingSound.loop = true;
this.playSound(this.soundsLoaded.callRingingSound);
}
if (
(this.call.state === 'Connected' || this.call.state === 'Disconnected') &&
this.soundsLoaded?.callRingingSound
) {
if (!shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {
this.soundsLoaded.callRingingSound.loop = false;
this.soundsLoaded.callRingingSound.pause();
}
Expand Down Expand Up @@ -100,7 +97,7 @@ export class CallingSoundSubscriber {
* Helper function to allow the calling sound subscriber to determine when to play the ringing
* sound when making an outbound call.
*/
const isPSTNCall = (call: CallCommon, callee?: CommunicationIdentifier[]): boolean => {
const shouldPlayRinging = (call: CallCommon, callee?: CommunicationIdentifier[]): boolean => {
/* @conditional-compile-remove(calling-sounds) */
if (
callee &&
Expand Down

0 comments on commit 2d63849

Please sign in to comment.