Fix for issue 1101
MODIFY
MatrixKit/Controllers/MXKCallViewController.m
MatrixKit/Controllers/MXKCallViewController.m
@@ -628,9 +628,11 @@ NSString *const kMXKCallViewControllerBackToAppNotification = @"kMXKCallViewCont
[audioPlayer stop];
}
+ NSString *soundName = [self soundNameForCallEnding];
+ if (soundName)
+ {
NSError *error = nil;
- NSURL *audioUrl;
- audioUrl = [self audioURLWithName:@"callend"];
+ NSURL *audioUrl = [self audioURLWithName:soundName];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioUrl error:&error];
if (error)
{
@@ -643,6 +645,7 @@ NSString *const kMXKCallViewControllerBackToAppNotification = @"kMXKCallViewCont
audioPlayer.numberOfLoops = 0;
[audioPlayer play];
+ }
// Except in case of call error, quit the screen right now
if (!errorAlert)
@@ -779,6 +782,20 @@ NSString *const kMXKCallViewControllerBackToAppNotification = @"kMXKCallViewCont
return isBuiltInReceiverUsed;
}
+- (NSString *)soundNameForCallEnding
+{
+ if (mxCall.endReason == MXCallEndReasonUnknown)
+ return nil;
+
+ if (mxCall.isEstablished)
+ return @"callend";
+
+ if (!mxCall.isEstablished && !mxCall.isIncoming && (mxCall.endReason == MXCallEndReasonHangupRemote || mxCall.endReason == MXCallEndReasonTimeout))
+ return @"busy";
+
+ return nil;
+}
+
#pragma mark - UI methods
- (void)updateLocalPreviewLayout

Fix for issue 1101