 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.

    }

    @objc public static func hasActiveCallForUUID(_ callUUID: String) -> Bool {
        let activeCallForUUID = callController.callObserver.calls.first {
            $0.uuid == UUID(uuidString: callUUID)
        }
        guard activeCallForUUID != nil else { return false }
        return true
    }

    @objc public static func reportNewIncomingCall(
            UUID: UUID,
            handle: String?,
            displayName: String?,
            hasVideo: Bool,
            completion: @escaping (Error?) -> Void) {
        guard enabled else { return }

        let callUpdate = makeCXUpdate(handle: handle,

            provider.setDelegate(emitter, queue: nil)
        }
    }
    
    private static let defaultCallController: CXCallController = {
        return CXCallController()
    }()
    
    private static var defaultProvider: CXProvider = {
        let configuration = CXProviderConfiguration(localizedName: "")
        return CXProvider(configuration: configuration)
    }()

    private static let emitter: JMCallKitEmitter = {
