mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
fix calls
This commit is contained in:
parent
dca88588d4
commit
44354f4f5e
7 changed files with 19 additions and 25 deletions
|
|
@ -354,8 +354,7 @@ import AVFoundation
|
|||
Log.directLog(BCTBX_LOG_ERROR, text: "Failed to terminate call failed because \(error)")
|
||||
}
|
||||
if (UIApplication.shared.applicationState == .background) {
|
||||
CoreManager.instance().stopIterateTimer()
|
||||
lc!.stop()
|
||||
CoreManager.instance().stopLinphoneCore()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,4 +56,11 @@ import linphonesw
|
|||
timer.invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func stopLinphoneCore() {
|
||||
if (lc?.callsNb == 0) {
|
||||
stopIterateTimer()
|
||||
lc?.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,13 +58,8 @@
|
|||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
LOGI(@"%@", NSStringFromSelector(_cmd));
|
||||
[LinphoneManager.instance enterBackgroundMode];
|
||||
LinphoneCall *call = linphone_core_get_current_call(LC);
|
||||
|
||||
if (!call) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[LinphoneManager.instance stopLinphoneCore];
|
||||
});
|
||||
}
|
||||
|
||||
[CoreManager.instance stopLinphoneCore];
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (void)launchLinphoneCore;
|
||||
- (void)destroyLinphoneCore;
|
||||
- (void)startLinphoneCore;
|
||||
- (void)stopLinphoneCore;
|
||||
- (BOOL)resignActive;
|
||||
- (void)becomeActive;
|
||||
- (BOOL)enterBackgroundMode;
|
||||
|
|
|
|||
|
|
@ -1274,11 +1274,6 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
|
|||
[CoreManager.instance startIterateTimer];
|
||||
}
|
||||
|
||||
- (void)stopLinphoneCore {
|
||||
[CoreManager.instance stopIterateTimer];
|
||||
linphone_core_stop([LinphoneManager getLc]);
|
||||
}
|
||||
|
||||
- (void)createLinphoneCore {
|
||||
[self migrationAllPre];
|
||||
if (theLinphoneCore != nil) {
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
case LinphoneCallReleased:
|
||||
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[LinphoneManager.instance stopLinphoneCore];
|
||||
[CoreManager.instance stopLinphoneCore];
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -89,6 +89,14 @@ class ProviderDelegate: NSObject {
|
|||
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: report new incoming call with call-id: [\(String(describing: callId))] and UUID: [\(uuid.description)]")
|
||||
provider.reportNewIncomingCall(with: uuid, update: update) { error in
|
||||
if error == nil {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 60) {// in 30 second
|
||||
if (CallManager.instance().lc?.callsNb == 0 && !CallManager.instance().providerDelegate.callInfos.isEmpty ) {
|
||||
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: end call which does not exist.")
|
||||
for suuid in CallManager.instance().providerDelegate.uuids.values {
|
||||
CallManager.instance().providerDelegate.endCallForError(uuid: suuid, endedAt: .init(), endedReason: .declinedElsewhere)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.directLog(BCTBX_LOG_ERROR, text: "CallKit: cannot complete incoming call with call-id: [\(String(describing: callId))] and UUID: [\(uuid.description)] from [\(handle)] caused by [\(error!.localizedDescription)]")
|
||||
if (call == nil) {
|
||||
|
|
@ -104,15 +112,6 @@ class ProviderDelegate: NSObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 30) {// in 30 second
|
||||
if (CallManager.instance().lc?.callsNb == 0 && !CallManager.instance().providerDelegate.callInfos.isEmpty ) {
|
||||
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: end call which does not exist.")
|
||||
for suuid in CallManager.instance().providerDelegate.uuids.values {
|
||||
CallManager.instance().providerDelegate.endCallForError(uuid: suuid, endedAt: .init(), endedReason: .declinedElsewhere)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateCall(uuid: UUID, handle: String, hasVideo: Bool = false) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue