cybex-dev / twilio_voice

Flutter Twilio Voice Plugin
https://twilio-voice-web.web.app/
MIT License
39 stars 80 forks source link

App example request for income and outgoing calls #194

Closed Muhammadjaved7209 closed 10 months ago

Muhammadjaved7209 commented 10 months ago

i have used your web example and it is working fine on web ... but it is not working when i run on the mobile phone i.e app it is requested to provide and example of android app as you provided the example of web

Erchil66 commented 10 months ago

Have you followed the needs and permissions for android?

Also for registering token is should indicate which platform with client id.

Specially in android , It has a lot of permission to allow used native incoming call.

Muhammadjaved7209 commented 10 months ago

i have added these permissions

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission android:name="android.permission.CALL_PHONE" />

my case is that we have created an erp in laravel. i want to recieve call from that side. when i run my flutter project on web i do recieve call. but when the same code is run on mobile app it does not work, even that event listners does not work .

i just used the example provided in github repo

Muhammadjaved7209 commented 10 months ago

i have added these permissions my case is that we have created an erp in laravel. i want to recieve call from that side. when i run my flutter project on web i do recieve call. but when the same code is run on mobile app it does not work, even that event listners does not work .

i just used the example provided in github repo

cybex-dev commented 10 months ago

Hi @Muhammadjaved7209

Hmm, I have considered providing a sample Android & iOS app to the relevant appstores but don't have any plans to do so short-term.

i have used your web example and it is working fine on web ... but it is not working when i run on the mobile phone i.e app it is requested to provide and example of android app as you provided the example of web

Muhammadjaved7209 commented 10 months ago

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

cybex-dev commented 10 months ago

i have added these permissions my case is that we have created an erp in laravel. i want to recieve call from that side. when i run my flutter project on web i do recieve call. but when the same code is run on mobile app it does not work, even that event listners does not work . i just used the example provided in github repo

With regards to the example app, some light customization would be required to setup tokens, ids, and recipient information based on your needs, see this for more info.

Could you please clarify, how you are access the twilio voice example application. Is this via the browser on Android (be it an installed or web page) or is this a native Android app?

cybex-dev commented 10 months ago

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

Muhammadjaved7209 commented 10 months ago

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

cybex-dev commented 10 months ago

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

I see, there are several permissions you need to grant prior to being able to receive calls. This includes:

and finally,

You can review these permission in Android Setup with a more detailed discussion in Notes - Android.

These permissions are all visible on the mobile app, see here for code reference.

Muhammadjaved7209 commented 10 months ago

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

I see, there are several permissions you need to grant prior to being able to receive calls. This includes:

  • android.permission.FOREGROUND_SERVICE
  • android.permission.RECORD_AUDIO
  • android.permission.READ_PHONE_STATE
  • android.permission.READ_PHONE_NUMBERS
  • android.permission.CALL_PHONE

and finally,

  • Active the calling account, see this for more info.

You can review these permission in Android Setup with a more detailed discussion in Notes - Android.

These permissions are all visible on the mobile app, see here for code reference.

Thank you for being so coporative.. i have already added these permissions and also enable calling account.

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

I see, there are several permissions you need to grant prior to being able to receive calls. This includes:

  • android.permission.FOREGROUND_SERVICE
  • android.permission.RECORD_AUDIO
  • android.permission.READ_PHONE_STATE
  • android.permission.READ_PHONE_NUMBERS
  • android.permission.CALL_PHONE

and finally,

  • Active the calling account, see this for more info.

You can review these permission in Android Setup with a more detailed discussion in Notes - Android.

These permissions are all visible on the mobile app, see here for code reference.

i have added all these permission and also enable calling account

cybex-dev commented 10 months ago

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

I see, there are several permissions you need to grant prior to being able to receive calls. This includes:

  • android.permission.FOREGROUND_SERVICE
  • android.permission.RECORD_AUDIO
  • android.permission.READ_PHONE_STATE
  • android.permission.READ_PHONE_NUMBERS
  • android.permission.CALL_PHONE

and finally,

  • Active the calling account, see this for more info.

You can review these permission in Android Setup with a more detailed discussion in Notes - Android. These permissions are all visible on the mobile app, see here for code reference.

Thank you for being so coporative.. i have already added these permissions and also enable calling account.

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

I see, there are several permissions you need to grant prior to being able to receive calls. This includes:

  • android.permission.FOREGROUND_SERVICE
  • android.permission.RECORD_AUDIO
  • android.permission.READ_PHONE_STATE
  • android.permission.READ_PHONE_NUMBERS
  • android.permission.CALL_PHONE

and finally,

  • Active the calling account, see this for more info.

You can review these permission in Android Setup with a more detailed discussion in Notes - Android. These permissions are all visible on the mobile app, see here for code reference.

i have added all these permission and also enable calling account

Hmm, my next best guess is Redmi doesn't like Calling Accounts or something inbetween.

Could you grab the stack trace from when the call is expected to come through and post it here - might hint at what's causing the problem.

Muhammadjaved7209 commented 10 months ago

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

I see, there are several permissions you need to grant prior to being able to receive calls. This includes:

  • android.permission.FOREGROUND_SERVICE
  • android.permission.RECORD_AUDIO
  • android.permission.READ_PHONE_STATE
  • android.permission.READ_PHONE_NUMBERS
  • android.permission.CALL_PHONE

and finally,

  • Active the calling account, see this for more info.

You can review these permission in Android Setup with a more detailed discussion in Notes - Android. These permissions are all visible on the mobile app, see here for code reference.

Thank you for being so coporative.. i have already added these permissions and also enable calling account.

hi @cybex-dev glad to see your response.. could you please tell me the possible reason why your given example is not working for android

I'd require more information from your side, how are you running (native or web or web pwa), OS version, etc.

i just downloaded the zip code and run your example project. i provide the identity and accessToken (provided by my backend developer - laravel). i run your example project on flutter web . After registering for calls it printed on the console "device ready fot voip call " . but i did not see any message like this on my android 12 redme phone. When i try to place call it navigate to the native call log of my device.

I see, there are several permissions you need to grant prior to being able to receive calls. This includes:

  • android.permission.FOREGROUND_SERVICE
  • android.permission.RECORD_AUDIO
  • android.permission.READ_PHONE_STATE
  • android.permission.READ_PHONE_NUMBERS
  • android.permission.CALL_PHONE

and finally,

  • Active the calling account, see this for more info.

You can review these permission in Android Setup with a more detailed discussion in Notes - Android. These permissions are all visible on the mobile app, see here for code reference.

i have added all these permission and also enable calling account

Hmm, my next best guess is Redmi doesn't like Calling Accounts or something inbetween.

Could you grab the stack trace from when the call is expected to come through and post it here - might hint at what's causing the problem.

ok i will try on some other devices with some more solutions... thank you for beign coporative

cybex-dev commented 10 months ago

@Muhammadjaved7209

I tested this on:

Could we use Emulators as a reference point?

Muhammadjaved7209 commented 10 months ago

IMG_20231109_172051 IMG_20231109_173121 @cybex-dev please take a look what is missing to recieve call

cybex-dev commented 10 months ago

IMG_20231109_172051 IMG_20231109_173121 @cybex-dev please take a look what is missing to recieve call

Assuming this is a stock standard twilio_voice_example app:

Muhammadjaved7209 commented 10 months ago

@cybex-dev

OS version android 11 API version 30

--- > before i provider id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN D/TwilioVoicePlugin(18212): logEvent: LOG|Registering client alicesId:Alice D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(18212): checkReadPhoneNumbersPermission I/flutter (18212): Registering client alicesId:Alice I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingReadPhoneNumbersPermission I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|registerPhoneAccount D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): registerPhoneAccount I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): yahophoneregustrd D/TwilioVoicePlugin(18212): logEvent: LOG|isPhoneAccountEnabled D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): isPhoneAccountEnabled I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): checkReadPhoneStatePermission I/flutter (18212): requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): logEvent: LOG|requestingCallPhonePermission D/TwilioVoicePlugin(18212): checkCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log

--- > after i provided id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN D/TwilioVoicePlugin(18212): logEvent: LOG|Registering client alicesId:Alice D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(18212): checkReadPhoneNumbersPermission I/flutter (18212): Registering client alicesId:Alice I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingReadPhoneNumbersPermission I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|registerPhoneAccount D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): registerPhoneAccount I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): yahophoneregustrd D/TwilioVoicePlugin(18212): logEvent: LOG|isPhoneAccountEnabled D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): isPhoneAccountEnabled I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): checkReadPhoneStatePermission I/flutter (18212): requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): logEvent: LOG|requestingCallPhonePermission D/TwilioVoicePlugin(18212): checkCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log .

cybex-dev commented 10 months ago

@Muhammadjaved7209 this is the flutter log

I need the adb log.

Muhammadjaved7209 commented 10 months ago

@Muhammadjaved7209 this is the flutter log

I need the adb log.

sorry to say i dont know what is adb log

cybex-dev commented 10 months ago

@Muhammadjaved7209 this is the flutter log I need the adb log.

sorry to say i dont know what is adb log

Please click on the link I added in "adb log". This is Android system's log. Flutter log comes from print() where Android's log is stdout, stderr merge.

Erchil66 commented 10 months ago

Am sharing my some of code on how i can make sure am receiving calls on android and logs am doing.

I hope this helps @Muhammadjaved7209

On my Android manifest i do have this permissions

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native call UI 

Then as my twilio side am using getx for the mean time as an easy example

class TwilioController extends GetxController{

   final isOnCallNow = false.obs;

   // Request permission for audio and phone calling account to access native ui when answering calls 
   requestAllowPhoneContact()async{
    await Permission.phone.request();
    if((await Permission.phone.status.isGranted)){
       if (Platform.isAndroid) {
      await TwilioVoice.instance
          .requestReadPhoneNumbersPermission(); // Gives Android permissions to read Phone Accounts
      await TwilioVoice.instance.registerPhoneAccount();
      bool knowIt = await TwilioVoice.instance.isPhoneAccountEnabled();
      if (knowIt == true) {
        log("ENABLE isPhoneAccountEnabled");
      } else {
        await TwilioVoice.instance.openPhoneAccountSettings();
      }
    }
      await TwilioVoice.instance
          .requestCallPhonePermission(); // Gives Android permissions to place calls
      await TwilioVoice.instance
          .requestReadPhoneStatePermission(); // Gives Android permissions to read Phone State
    }

   }

  // Register token
 registerToken()async{
       await TwilioVoice.instance
            .setTokens(accessToken: accessToken,
             deviceToken: 
             Platform.isIOS ? "":
             tokenPlatform,
             )
            .then((value){
               // Log result when registering token to know if it successful if not maybe the token is the problem
                log("${Platform.isIOS ? "IOS" : "Android "} Access Token Registered $value",name:"Registe Token Log")
            });
 }

 checkActiveCall({CallEvent? event}) async {
    final isOnCall = await TwilioVoice.instance.call.isOnCall();
    // Log some results
    log("Twilio Controller checkActiveCall $isOnCall",
        name: "Twilio Action Event Lob");
    final activeCall = TwilioVoice.instance.call.activeCall;
    if (event != CallEvent.log &&
        activeCall!.callDirection == CallDirection.incoming) {
      switch (event) {
        case CallEvent.answer:
          isOnCallNow.value = true;
          update();
          break;
        case CallEvent.connected:
          isOnCallNow.value = true;
          update();
          break;
        case CallEvent.declined:
          isOnCallNow.value = false;
          update();
          break;
        case CallEvent.callEnded:
          isOnCallNow.value = false;
          Get.back();
          update();
          break;
        default:
      }
    }
  }

  waitForCall() {
    TwilioVoice.instance.callEventsListener.listen((event) async {
      if (event != CallEvent.log) {
        checkActiveCall(event: event);
      }
      switch (event) {
        case CallEvent.incoming:
        // Do something
          break;
        case CallEvent.answer:
         // Do something
          break;
        case CallEvent.ringing:
          // Do something
          break;
        case CallEvent.declined:
        // Do something
          break;
        case CallEvent.connected:
        // Do something
          break;
        case CallEvent.callEnded:
        // Do something
          break;
        case CallEvent.missedCall:
        // Do something
          break;
        case CallEvent.returningCall:
        // Do something
          break;
        case CallEvent.speakerOn:
        // Do something
          break;
        case CallEvent.speakerOff:
        // Do something
          break;
        case CallEvent.log:
          // Do something
          break;
        default:
          break;
      }
    });
  }
}

then call waitCall() to initState or onInit

either wait maybe we can find something to this.

I hope this helps to find some problem

Note should also consider allowing the TwilioVoice.instance.requestReadPhoneStatePermission();

6mhjFWZ

cybex-dev commented 10 months ago
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native 

According to Android docs, MANAGE_OWN_CALLS permission isn't necessary for system-managed calls.

I'll be adding this nontheless for Android 13 and lower devices as it seems to be required for atleast Android 13.

Muhammadjaved7209 commented 10 months ago
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native 

According to Android docs, MANAGE_OWN_CALLS permission isn't necessary for system-managed calls.

I'll be adding this nontheless for Android 13 and lower devices as it seems to be required for atleast Android 13.

@cybex-dev how much time i have to wait for your app example ???

Muhammadjaved7209 commented 10 months ago

Am sharing my some of code on how i can make sure am receiving calls on android and logs am doing.

I hope this helps @Muhammadjaved7209

On my Android manifest i do have this permissions

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native call UI 

Then as my twilio side am using getx for the mean time as an easy example

class TwilioController extends GetxController{

   final isOnCallNow = false.obs;

   // Request permission for audio and phone calling account to access native ui when answering calls 
   requestAllowPhoneContact()async{
    await Permission.phone.request();
    if((await Permission.phone.status.isGranted)){
       if (Platform.isAndroid) {
      await TwilioVoice.instance
          .requestReadPhoneNumbersPermission(); // Gives Android permissions to read Phone Accounts
      await TwilioVoice.instance.registerPhoneAccount();
      bool knowIt = await TwilioVoice.instance.isPhoneAccountEnabled();
      if (knowIt == true) {
        log("ENABLE isPhoneAccountEnabled");
      } else {
        await TwilioVoice.instance.openPhoneAccountSettings();
      }
    }
      await TwilioVoice.instance
          .requestCallPhonePermission(); // Gives Android permissions to place calls
      await TwilioVoice.instance
          .requestReadPhoneStatePermission(); // Gives Android permissions to read Phone State
    }

   }

  // Register token
 registerToken()async{
       await TwilioVoice.instance
            .setTokens(accessToken: accessToken,
             deviceToken: 
             Platform.isIOS ? "":
             tokenPlatform,
             )
            .then((value){
               // Log result when registering token to know if it successful if not maybe the token is the problem
                log("${Platform.isIOS ? "IOS" : "Android "} Access Token Registered $value",name:"Registe Token Log")
            });
 }

 checkActiveCall({CallEvent? event}) async {
    final isOnCall = await TwilioVoice.instance.call.isOnCall();
    // Log some results
    log("Twilio Controller checkActiveCall $isOnCall",
        name: "Twilio Action Event Lob");
    final activeCall = TwilioVoice.instance.call.activeCall;
    if (event != CallEvent.log &&
        activeCall!.callDirection == CallDirection.incoming) {
      switch (event) {
        case CallEvent.answer:
          isOnCallNow.value = true;
          update();
          break;
        case CallEvent.connected:
          isOnCallNow.value = true;
          update();
          break;
        case CallEvent.declined:
          isOnCallNow.value = false;
          update();
          break;
        case CallEvent.callEnded:
          isOnCallNow.value = false;
          Get.back();
          update();
          break;
        default:
      }
    }
  }

  waitForCall() {
    TwilioVoice.instance.callEventsListener.listen((event) async {
      if (event != CallEvent.log) {
        checkActiveCall(event: event);
      }
      switch (event) {
        case CallEvent.incoming:
        // Do something
          break;
        case CallEvent.answer:
         // Do something
          break;
        case CallEvent.ringing:
          // Do something
          break;
        case CallEvent.declined:
        // Do something
          break;
        case CallEvent.connected:
        // Do something
          break;
        case CallEvent.callEnded:
        // Do something
          break;
        case CallEvent.missedCall:
        // Do something
          break;
        case CallEvent.returningCall:
        // Do something
          break;
        case CallEvent.speakerOn:
        // Do something
          break;
        case CallEvent.speakerOff:
        // Do something
          break;
        case CallEvent.log:
          // Do something
          break;
        default:
          break;
      }
    });
  }
}

then call waitCall() to initState or onInit

either wait maybe we can find something to this.

I hope this helps to find some problem

Note should also consider allowing the TwilioVoice.instance.requestReadPhoneStatePermission();

6mhjFWZ 6mhjFWZ

thank you for help... i have tried everything but all in vain

Erchil66 commented 10 months ago
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native 

According to Android docs, MANAGE_OWN_CALLS permission isn't necessary for system-managed calls.

I'll be adding this nontheless for Android 13 and lower devices as it seems to be required for atleast Android 13.

Well in my case on the error log it showing that it require the app to have that permission, And yes it Android 13 and above. Havent tried on lower ones.

Muhammadjaved7209 commented 10 months ago
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native 

According to Android docs, MANAGE_OWN_CALLS permission isn't necessary for system-managed calls. I'll be adding this nontheless for Android 13 and lower devices as it seems to be required for atleast Android 13.

Well in my case on the error log it showing that it require the app to have that permission, And yes it Android 13 and above. Havent tried on lower ones.

@Erchil66 how can i contact you on any other platform other than git

Erchil66 commented 10 months ago

We can talk it here btw hahaha, It’s better we involve @cybex-dev on the conversation also

Muhammadjaved7209 commented 10 months ago

We can talk it here btw hahaha, It’s better we involve @cybex-dev on the conversation also

here i cant show my whole app code haha

Muhammadjaved7209 commented 10 months ago

We can talk it here btw hahaha, It’s better we involve @cybex-dev on the conversation also

and you know am also using getx in my project

Erchil66 commented 10 months ago

@cybex-dev

OS version android 11 API version 30

--- > before i provider id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN D/TwilioVoicePlugin(18212): logEvent: LOG|Registering client alicesId:Alice D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(18212): checkReadPhoneNumbersPermission I/flutter (18212): Registering client alicesId:Alice I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingReadPhoneNumbersPermission I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|registerPhoneAccount D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): registerPhoneAccount I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): yahophoneregustrd D/TwilioVoicePlugin(18212): logEvent: LOG|isPhoneAccountEnabled D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): isPhoneAccountEnabled I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): checkReadPhoneStatePermission I/flutter (18212): requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): logEvent: LOG|requestingCallPhonePermission D/TwilioVoicePlugin(18212): checkCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log

--- > after i provided id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN D/TwilioVoicePlugin(18212): logEvent: LOG|Registering client alicesId:Alice D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(18212): checkReadPhoneNumbersPermission I/flutter (18212): Registering client alicesId:Alice I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingReadPhoneNumbersPermission I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|registerPhoneAccount D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): registerPhoneAccount I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): yahophoneregustrd D/TwilioVoicePlugin(18212): logEvent: LOG|isPhoneAccountEnabled D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): isPhoneAccountEnabled I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): checkReadPhoneStatePermission I/flutter (18212): requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): logEvent: LOG|requestingCallPhonePermission D/TwilioVoicePlugin(18212): checkCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log .

Ive backread to this but i havent seen a FCM registered successfully on this log, Did you check the token on this? On your logs?

cybex-dev commented 10 months ago
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native 

According to Android docs, MANAGE_OWN_CALLS permission isn't necessary for system-managed calls. I'll be adding this nontheless for Android 13 and lower devices as it seems to be required for atleast Android 13.

@cybex-dev how much time i have to wait for your app example ???

I do not intend to provide a native Android & iOS example app any time soon. With regards to your issue, please see my earlier comment, without which progress we cannot progress further to resolve your issue.

Ref: https://github.com/cybex-dev/twilio_voice/issues/194#issuecomment-1803825316

TL;DR - I need your ADB log.

Muhammadjaved7209 commented 10 months ago
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/> // This help actually to use the native 

According to Android docs, MANAGE_OWN_CALLS permission isn't necessary for system-managed calls. I'll be adding this nontheless for Android 13 and lower devices as it seems to be required for atleast Android 13.

@cybex-dev how much time i have to wait for your app example ???

I do not intend to provide a native Android & iOS example app any time soon. With regards to your issue, please see my earlier comment, without which progress we cannot progress further to resolve your issue.

Ref: #194 (comment)

TL;DR - I need your ADB log.

when connected real device and see adb logs. adb logs were too long

Muhammadjaved7209 commented 10 months ago

@cybex-dev OS version android 11 API version 30 --- > before i provider id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN D/TwilioVoicePlugin(18212): logEvent: LOG|Registering client alicesId:Alice D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(18212): checkReadPhoneNumbersPermission I/flutter (18212): Registering client alicesId:Alice I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingReadPhoneNumbersPermission I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|registerPhoneAccount D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): registerPhoneAccount I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): yahophoneregustrd D/TwilioVoicePlugin(18212): logEvent: LOG|isPhoneAccountEnabled D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): isPhoneAccountEnabled I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): checkReadPhoneStatePermission I/flutter (18212): requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): logEvent: LOG|requestingCallPhonePermission D/TwilioVoicePlugin(18212): checkCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log --- > after i provided id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN D/TwilioVoicePlugin(18212): logEvent: LOG|Registering client alicesId:Alice D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(18212): checkReadPhoneNumbersPermission I/flutter (18212): Registering client alicesId:Alice I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingReadPhoneNumbersPermission I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|registerPhoneAccount D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): registerPhoneAccount I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): yahophoneregustrd D/TwilioVoicePlugin(18212): logEvent: LOG|isPhoneAccountEnabled D/TwilioVoiceConnectionService(18212): getPhoneAccountHandle: Get PhoneAccountHandle with name: twilio_voice_example, componentName: ComponentInfo{com.twilio.twilio_voice_example/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (18212): isPhoneAccountEnabled I/flutter (18212): voip-onCallStateChanged CallEvent.log D/TwilioVoicePlugin(18212): logEvent: LOG|requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): checkReadPhoneStatePermission I/flutter (18212): requestingReadPhoneStatePermission D/TwilioVoicePlugin(18212): logEvent: LOG|requestingCallPhonePermission D/TwilioVoicePlugin(18212): checkCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log I/flutter (18212): requestingCallPhonePermission I/flutter (18212): voip-onCallStateChanged CallEvent.log .

Ive backread to this but i havent seen a FCM registered successfully on this log, Did you check the token on this? On your logs?

W/ple.twillio_ap(14057): Long monitor contention with owner WebSocketConnectReadThread-161 (14849) at void com.android.org.conscrypt.ConscryptEngineSocket.startHandshake()(ConscryptEngineSocket.java:219) waiters=0 in void com.android.org.conscrypt.ConscryptEngineSocket.startHandshake() for 285ms I/flutter (14057): Connection: CONNECTED I/flutter (14057): onSubscriptionSucceeded: twilio-43 data: {} I/flutter (14057): Me: null D/TwilioVoicePlugin(14057): onRequestPermissionsResult: 24 D/DecorView: onWindowFocusChanged hasWindowFocus true D/TwilioVoicePlugin(14057): logEvent: LOG|requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(14057): checkReadPhoneNumbersPermission I/flutter (14057): requestingReadPhoneNumbersPermission I/flutter (14057): CallEvent.log I/flutter (14057): requestingReadPhoneNumbersPermission D/TwilioVoicePlugin(14057): logEvent: LOG|registerPhoneAccount I/flutter (14057): registerPhoneAccount I/flutter (14057): CallEvent.log I/flutter (14057): registerPhoneAccount D/TwilioVoiceConnectionService(14057): getPhoneAccountHandle: Get PhoneAccountHandle with name: twillio_app, componentName: ComponentInfo{com.example.twillio_app/com.twilio.twilio_voice.service.TVConnectionService} D/TwilioVoicePlugin(14057): logEvent: LOG|isPhoneAccountEnabled I/flutter (14057): isPhoneAccountEnabled D/TwilioVoiceConnectionService(14057): getPhoneAccountHandle: Get PhoneAccountHandle with name: twillio_app, componentName: ComponentInfo{com.example.twillio_app/com.twilio.twilio_voice.service.TVConnectionService} I/flutter (14057): CallEvent.log I/flutter (14057): isPhoneAccountEnabled D/TwilioVoicePlugin(14057): Successfully registered FCM filltPLFStWo_boCKUix4o:APA91bGEe-ntmE8Pb4MBY80AXYZzV7LYP4jFjPHUFUtvjg_q9CHF8JsUy7zgXYR1tyr5kjDROfiVKyeKHsPEWmp0MDi5gPWtChuN4bc15bc6m5xgcJF448kyRT5eTXwCythbROclL87r D/TwilioVoicePlugin(14057): logEvent: LOG|changePhoneAccount I/flutter (14057): changePhoneAccount I/flutter (14057): CallEvent.log I/flutter (14057): changePhoneAccount

cybex-dev commented 10 months ago

--- > after i provided id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN

Did you see my comment: https://github.com/cybex-dev/twilio_voice/issues/194#issuecomment-1802399665?

I referred to this line to configure your application with token & Id, etc.

Muhammadjaved7209 commented 10 months ago

--- > after i provided id and token : I/TwilioVoicePlugin(18212): Removing event sink I/TwilioVoicePlugin(18212): Setting event sink I/flutter (18212): voip-service registration I/flutter (18212): voip-registering with environment variables I/flutter (18212): Failed to register with environment variables, please provide ID and TOKEN

Did you see my comment: #194 (comment)?

I referred to this line to configure your application with token & Id, etc.

yes i provide id and token... this is my func for registration " void register() async { String? deviceToken = LocalStorageMethods.instance.getDeviceToken(); String? callAccessToken = LocalStorageMethods.instance.getIdentityTokenForCallAccess();

String? identity = await LocalStorageMethods.instance.getIdentity();

final result = await TwilioVoice.instance.setTokens(
    accessToken: callAccessToken ?? "", deviceToken: deviceToken,);
await TwilioVoice.instance.registerClient(identity, "abc");

if (result ?? false) {
  twilioInit.value = true;
} else {
  debugPrint("somne thing went wrong while registring...");
}

}"

Erchil66 commented 10 months ago

I think better to give adb.log or logcat from android studio. To follow up the reason why since it have pront debug from native which is errors showing.

Here’snmy whatsapp +63 9303772046

Muhammadjaved7209 commented 10 months ago

I think better to give adb.log or logcat from android studio. To folow up the reason why since it have pront debug from native which is errors showing.

ok am providing

Muhammadjaved7209 commented 10 months ago

I think better to give adb.log or logcat from android studio. To folow up the reason why since it have pront debug from native which is errors showing.

ok am providing

IMG_20231109_222725 is it what i have to show you??

Erchil66 commented 10 months ago

I think better to give adb.log or logcat from android studio. To folow up the reason why since it have pront debug from native which is errors showing.

ok am providing

IMG_20231109_222725 is it what i have to show you??

add me on whatsapp ao i can guid you where to find it,

Edit yes thats the one

Find the latest error there when trying to receive call

Muhammadjaved7209 commented 10 months ago

I think better to give adb.log or logcat from android studio. To folow up the reason why since it have pront debug from native which is errors showing.

ok am providing

IMG_20231109_222725 is it what i have to show you??

add me on whatsapp ao i can guid you where to find it

sure... +923073594209 my whatsapp

Erchil66 commented 10 months ago

@Muhammadjaved7209 am pasting here the link https://www.twilio.com/docs/notify/configure-android-push-notifications

Thats the thing lacking from your acess token The push credential from fcm

@cybex-dev as i though the acess token was lacking some info.

I think is should known as solve.

cybex-dev commented 10 months ago

@Muhammadjaved7209 @Erchil66 can I mark this issue as resolved?

cybex-dev commented 10 months ago

198

cybex-dev commented 10 months ago

https://github.com/cybex-dev/twilio_voice/releases/tag/0.1.3

cybex-dev commented 10 months ago

Closing for now.

mohsinnaqvi606 commented 9 months ago

@Muhammadjaved7209 @cybex-dev @Erchil66

Hi, I am facing the same issue. Example App works fine on the web. but on Android (Infinix Note 7) only outgoing calls are working.

Incoming calls are not working even got the log FCM is successfully registered.

Unable to identify issue. Anybody can help me figure out this issue