You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
733 B
25 lines
733 B
import CallKit |
|
|
|
class CallObserver: NSObject, CXCallObserverDelegate { |
|
|
|
let callObserver = CXCallObserver() |
|
|
|
override init() { |
|
super.init() |
|
callObserver.setDelegate(self, queue: nil) |
|
} |
|
|
|
func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) { |
|
if call.hasEnded { |
|
print("Call ended") |
|
} else if call.isOutgoing { |
|
print("Outgoing call") |
|
} else if call.isOnHold { |
|
print("Call on hold") |
|
} else if callObserver.calls.contains(where: { $0.isMuted }) { |
|
print("Call muted") |
|
} else { |
|
print("Call status changed") |
|
} |
|
} |
|
}
|
|
|