diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift index 63a644872..46a7897a9 100644 --- a/Signal/src/call/CallService.swift +++ b/Signal/src/call/CallService.swift @@ -462,7 +462,7 @@ protocol CallServiceObserver: class { let callerName = self.contactsManager.displayName(forPhoneIdentifier: thread.contactIdentifier()) - switch(untrustedIdentity!.verificationState) { + switch untrustedIdentity!.verificationState { case .verified: Logger.error("\(TAG) shouldn't have missed a call due to untrusted identity if the identity is verified") assertionFailure("shouldn't have missed a call due to untrusted identity if the identity is verified") @@ -492,6 +492,16 @@ protocol CallServiceObserver: class { handleLocalBusyCall(newCall, thread: thread) + if self.call?.remotePhoneNumber == newCall.remotePhoneNumber { + // If we're receiving a new call offer from the user we think we have a call with, terminate + // our current call to get back to a known good state. If they call back, we'll be ready. + // + // TODO: Auto-accept this incoming call if our current call was either a) outgoing or + // b) ever connected. There will be a bit of complexity around making sure that two + // parties that call each other at the same time end up connected. + terminateCall() + } + return }