1

I want to end a phone call by callkit api. But I get this information "com.apple.CallKit.error.requesttransaction error 4". I don't know why and what happen. By the way, the phone call is real call, not a VOIP call.

CallKit CXError.h CXErrorCodeRequestTransactionErrorUnknownCallUUID 4

Prepare, enable voip for com.apple.CallKit.error.requesttransaction error 1 & create global variable CXCallController *callController enter image description here

First, I use CXCallObserver get call UUID

- (void)callObserver:(CXCallObserver *)callObserver callChanged: (CXCall *)call {
}

Followed, I use some api to end the phone and I put it in callObserver

    NSUUID *callUUID = call.UUID;
    CXEndCallAction *endaction = [[CXEndCallAction alloc] initWithCallUUID:callUUID];
    CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endaction];

    [self.callController requestTransaction:transaction completion:^(NSError * _Nullable error) {
        if (error) {
            NSLog(@"EndCallAction transaction request failed: %@", [error localizedDescription]);
        } else {
            NSLog(@"EndCallAction transaction request successful");
        }
    }];

Finally, I get this. PS: The UUID is not empty. enter image description here

I have referenced How to end a call in CallKit. But no use. I have no idea. Please help or try to give some ideas how to achieve this. Thanks!

3 Answers 3

1

You can only use CallKit to manage VoIP calls that were established by your app. You cannot manage cellular calls or VoIP calls from other apps.

4
  • Could you give me some hint for Ending real phone call? @Paulw11 Aug 22, 2018 at 10:04
  • You can’t do it programmatically. The user must do it by tapping the “end call” button.
    – Paulw11
    Aug 22, 2018 at 10:04
  • Ok, I get it. Thanks so much. Aug 22, 2018 at 10:05
  • You can do it by sending CXEndCallAction to Callkit, inturn it will give call ended detail in CXCallObserverDelegate Sep 12, 2018 at 13:24
0

Apple Documentation seems to suggest that its possible to put a Telephony call on Hold https://developer.apple.com/documentation/callkit/cxcall but that doesn't seem to work for me. If it is supposed to work, it should work for Ending a call as well.

I tried the above too and even though the CallObserver gives the call UUID from the calls list, it is showing the above error.

But then wonder how this would work if you have a VOIP app and you were on an existing Telephony Call, and you want to hold/end the Telephony Call and answer the incoming call (of your VOIP app).

1
  • once you accept voip call established by your app, callkit will Hold other call automatically Aug 6, 2020 at 18:04
0

you have to just call below function by passing uuid

func performEndCallAction(uuid: UUID) {

    let endCallAction = CXEndCallAction(call: uuid)
    let transaction = CXTransaction(action: endCallAction)

    callKitCallController.request(transaction) { error in
        if let error = error {
            NSLog("EndCallAction transaction request failed: \(error.localizedDescription).")
        } else {
            NSLog("EndCallAction transaction request successful")
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.