 import CallKit
 import Foundation
 
+public protocol CXProviderProtocol: class {
+    var configuration: CXProviderConfiguration { get set }
+    func setDelegate(_ delegate: CXProviderDelegate?, queue: DispatchQueue?)
+    func reportNewIncomingCall(with UUID: UUID, update: CXCallUpdate, completion: @escaping (Error?) -> Void)
+    func reportCall(with UUID: UUID, updated update: CXCallUpdate)
+    func reportCall(with UUID: UUID, endedAt dateEnded: Date?, reason endedReason: CXCallEndedReason)
+    func reportOutgoingCall(with UUID: UUID, startedConnectingAt dateStartedConnecting: Date?)
+    func reportOutgoingCall(with UUID: UUID, connectedAt dateConnected: Date?)
+    func invalidate()
+}
+
+public protocol CXCallControllerProtocol: class {
+    var calls: [CXCall] { get }
+    func request(_ transaction: CXTransaction, completion: @escaping (Error?) -> Swift.Void)
+}
+
+extension CXProvider: CXProviderProtocol {}
+extension CXCallController: CXCallControllerProtocol {
+    public var calls: [CXCall] {
+        return callObserver.calls
+    }
+}
+
 /// JitsiMeet CallKit proxy
 // NOTE: The methods this class exposes are meant to be called in the UI thread.
 // All delegate methods called by JMCallKitEmitter will be called in the UI thread.

    /// Defaults to enabled, set to false when you don't want to use CallKit.
    @objc public static var enabled: Bool = true {
        didSet {
            provider.invalidate()
            if enabled {
                guard isProviderConfigured() else  { return; }
                provider = CXProvider(configuration: providerConfiguration!)
                provider.setDelegate(emitter, queue: nil)
            } else {
                provider.setDelegate(nil, queue: nil)

            with UUID: UUID,
            startedConnectingAt dateStartedConnecting: Date?) {
        guard enabled else { return }
        provider.reportOutgoingCall(with: UUID,
                                    startedConnectingAt: dateStartedConnecting)
    }
