Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove callback option UI of CallKit after ending the call

Tags:

ios

swift

callkit

In my app i'm using CallKit for incoming call. There is no outgoing call feature in the app. Everything is fine but when the receiver or dailer ends the call it shows the CallKit UI with call back option. I don't want to show callback option, how can I do it?

My code for ending the call

func end(call: SpeakerboxCall) {

    let endCallAction = CXEndCallAction(call: call.uuid)
    let transaction = CXTransaction()
    transaction.addAction(endCallAction)

    requestTransaction(transaction, action: "endCall")

}

private func requestTransaction(_ transaction: CXTransaction, action:
    String = "") {

    callController.request(transaction) { error in
        if let error = error {
            print("Error requesting transaction: \(error)")
        } else {
            print("Requested transaction \(action) successfully")
        }
    }
}
like image 506
Kalikanth040494 Avatar asked Jan 10 '18 10:01

Kalikanth040494


1 Answers

I have solved it. I was force quitting the CallKit where the transaction is not correctly completing.

 AppDelegate.shared.providerDelegate?.provider.reportCall(with: call.uuid, endedAt: nil, reason: CXCallEndedReason.remoteEnded)

We need to set endedAt to nil and reason to remoteEnded

like image 138
Kalikanth040494 Avatar answered Oct 04 '22 22:10

Kalikanth040494