diff --git a/Classes/CallManager.swift b/Classes/CallManager.swift index 51f92d735..d1f1b4fae 100644 --- a/Classes/CallManager.swift +++ b/Classes/CallManager.swift @@ -392,6 +392,15 @@ import AVFoundation class CoreManagerDelegate: CoreDelegate { static var speaker_already_enabled : Bool = false + func getProxyConfigByIncomingCall(call:Call, lc:Core) ->ProxyConfig? { + let addr = call.toAddress + let proxylist = lc.proxyConfigList + if let index = proxylist.firstIndex(where: { $0.identityAddress?.asStringUriOnly() == addr?.asStringUriOnly() }) { + return proxylist[index] + } + return nil + } + override func onCallStateChanged(lc: Core, call: Call, cstate: Call.State, message: String) { let addr = call.remoteAddress; let address = FastAddressBook.displayName(for: addr?.getCobject) ?? "Unknow" @@ -423,8 +432,11 @@ class CoreManagerDelegate: CoreDelegate { // The call is already answered. CallManager.instance().acceptCall(call: call, hasVideo: video) } - } else if (!(CallManager.instance().alreadyRegisteredForNotification && UIApplication.shared.isRegisteredForRemoteNotifications)) { - CallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: video, callId: callId!) + } else { + let cfg = getProxyConfigByIncomingCall(call: call, lc: lc) + if (!((cfg?.isPushNotificationAllowed ?? true) && CallManager.instance().alreadyRegisteredForNotification && UIApplication.shared.isRegisteredForRemoteNotifications)) { + CallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: video, callId: callId!) + } } } else if (UIApplication.shared.applicationState != .active) { // not support callkit , use notif