Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StartCallAction transaction request failed: com.apple.CallKit.error.requesttransaction error 2 #253

Open
agent515 opened this issue Nov 30, 2024 · 5 comments

Comments

@agent515
Copy link
Contributor

Issue Summary

When trying to call another Twilio registered Client from iOS device, this error pops up saying, StartCallAction transaction request failed: The operation couldn’t be completed. (com.apple.CallKit.error.requesttransaction error 2.). Calling used to work before (6-7 months back) so I don't know why is this failing now?

Here is a related SO answer.

Steps to Reproduce

  1. Call other Twilio registered Client from iOS device
  2. Notice the log when call fails
  Future<Either<AppError, void>> place(
    String from,
    String to,
  ) async {
    try {
      await requestMicAccess();

      bool? granted = await _instance.requestCallPhonePermission();

      if (granted != true)
        return Left(AppError(title: 'No call phone permission given.'));

      bool? result = await _instance.call.place(
        from: from,
        to: to,
      );
      if (result != null && result) {
        return Right(null);
      }
      return Left(AppError(title: 'Call placing failed.'));
    } catch (e, st) {
      print(e);
      Sentry.captureException(e, stackTrace: st);
      return Left(AppError(title: e.toString()));
    }
  }
flutter: ACTIVE CALL: VoipActiveCall(to: 4, from: 15, callDirection: CallDirection.outgoing, initiated: null, customParams: null)
[ERROR:flutter/shell/common/shell.cc(1055)] The 'twilio_voice/events' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
flutter: StartCallAction transaction request failed: The operation couldn’t be completed. (com.apple.CallKit.error.requesttransaction error 2.)
flutter: VOIP CALL EVENT: CallEvent.log

@Erchil66
Copy link

Erchil66 commented Dec 3, 2024

Have you checked on twilio logs?

  • On ios try to look the certificate or voip you made it might be expired.
  • On android needed to migrate v1 which using account service json which can be generate in gcp.

@agent515
Copy link
Contributor Author

agent515 commented Dec 9, 2024

Hey @Erchil66 .

Have you checked on twilio logs?

Which Twilio logs are you referring to? The call is never started so it never reaches TwiML app because I didn't see anything in the console logs of the Twilio Function registered a a callback. I just get The operation couldn’t be completed. (com.apple.CallKit.error.requesttransaction error 2.) from Twilio SDK.

On ios try to look the certificate or voip you made it might be expired.

Receiving this from Twilio SDK: Successfully registered for VoIP push notifications.. So I'm guessing there might not be any issue with the VoIP certificate.

On android needed to migrate v1 which using account service json which can be generate in gcp.

On Android the call is started and System Phone Screen is shown. The call never reaches iOS. Couldn't test between two Android devices though so not sure if it works.

@agent515
Copy link
Contributor Author

agent515 commented Dec 10, 2024

I updated VoIP certificate but the issue still persists.

@Erchil66
Copy link

@agent515 hi, also good day

I've been using the package almost 2 years now, I encountered this on my end for what i did was:

  • Follow the instructions to add asset for callKit_icon in xcode

  • On Xcode allow in Signing capabilities please check if have:

    • Push Notifications
    • Background Modes : (I have this but it's up to you to add the background fetch)
      • Audio,Airplay and Picture in Picture
      • Background fetch
      • Remote Notification
        -Voice over ip
  • And for the pod i have like this

    Add from here

    target.build_configurations.each do |config|
    config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '14.1' # or whatever version you're using
    end

  • Then most of all the complicated for me the certificate to create .p12 files the certificate key and private key to be added in twilio and most of all check the token if have the token and the APP_SID in the token generated.

  • Also try to check the twiml;s might be something there also.

Those things worked for me. Actually

And i hope this helps.

@agent515
Copy link
Contributor Author

agent515 commented Dec 11, 2024

Hey @Erchil66 , wish you a good day as well and thanks for all the help you've been doing!

So I just found the issue. I also had this package working for me for the past two years but just a few months back I added flutter_isolate to move some of the work off the main thread. And whenever you call flutterCompute with the callback, Twilio stops working properly even if it is not directly called or interacted with in that particular snippet. So I commented that part (invoking flutterCompute) out and calling started working again.

It seems that flutter_isolate package registers all the dependencies again for the new isolate. This issue might have been caused as a result of that. I am not 100% sure but I came to know about this because the app would throw a fatal error when trying to register twilio_voice again. I added workaround as below to circumvent the error but the SDK stopped working for me causing all these issues.

if !controller.hasPlugin("twilio_voice") {
            let registrar = controller.registrar(forPlugin: "twilio_voice")
            if let unwrappedRegistrar = registrar {
                let eventChannel = FlutterEventChannel(name: "twilio_voice/events", binaryMessenger: unwrappedRegistrar.messenger())
                eventChannel.setStreamHandler(self)
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants