Skip to content

Commit 2d63849

Browse files
[Calling sounds] Fix issue where ringing sound keeps playing on the disconnecting 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
1 parent cf8225f commit 2d63849

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "fix",
4+
"workstream": "Calling Sounds",
5+
"comment": "Stop the ringing sound from playing when the call disconnects before the callee answers",
6+
"packageName": "@azure/communication-react",
7+
"email": "94866715+dmceachernmsft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "fix",
4+
"workstream": "Calling Sounds",
5+
"comment": "Stop the ringing sound from playing when the call disconnects before the callee answers",
6+
"packageName": "@azure/communication-react",
7+
"email": "94866715+dmceachernmsft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

packages/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ export class CallingSoundSubscriber {
3434

3535
private onCallStateChanged = (): void => {
3636
this.call.on('stateChanged', () => {
37-
if (isPSTNCall(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {
37+
if (shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {
3838
this.soundsLoaded.callRingingSound.loop = true;
3939
this.playSound(this.soundsLoaded.callRingingSound);
4040
}
41-
if (
42-
(this.call.state === 'Connected' || this.call.state === 'Disconnected') &&
43-
this.soundsLoaded?.callRingingSound
44-
) {
41+
if (!shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {
4542
this.soundsLoaded.callRingingSound.loop = false;
4643
this.soundsLoaded.callRingingSound.pause();
4744
}
@@ -100,7 +97,7 @@ export class CallingSoundSubscriber {
10097
* Helper function to allow the calling sound subscriber to determine when to play the ringing
10198
* sound when making an outbound call.
10299
*/
103-
const isPSTNCall = (call: CallCommon, callee?: CommunicationIdentifier[]): boolean => {
100+
const shouldPlayRinging = (call: CallCommon, callee?: CommunicationIdentifier[]): boolean => {
104101
/* @conditional-compile-remove(calling-sounds) */
105102
if (
106103
callee &&

0 commit comments

Comments
 (0)