Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to end a call in CallKit

Tags:

ios

callkit

This is not a give-me-code question, this is a feasibility question. If I initiate a phone call using CallKit, is it also possible to programmatically end it?

like image 294
frenchie Avatar asked Nov 07 '16 21:11

frenchie


1 Answers

Close All Call (Swift4)

func endCall(call: UUID) {

    let endCallAction = CXEndCallAction(call: call)
    let transaction = CXTransaction(action: endCallAction)
    cxCallController.request(transaction) { error in
        if let error = error {
            print("EndCallAction transaction request failed: \(error.localizedDescription).")
            self.cxCallProvider.reportCall(with: call, endedAt: Date(), reason: .remoteEnded)
            return
        }

        print("EndCallAction transaction request successful")

    }

}
like image 151
Mohammad Razipour Avatar answered Oct 12 '22 12:10

Mohammad Razipour