Skip to content

displayIncomingCall ignored due to no ConnectionService or no phone account #621

@Sheharyar566

Description

@Sheharyar566

Bug report

I've setup the call keep as mentioned in the documentation with selfManaged: true on android , and am looking at the debug logs (also mentioned in the documentation), but I'm getting the following error in the debug logs
displayIncomingCall ignored due to no ConnectionService or no phone account

  • I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • iOS

Description

I'm calling the stuff in a file called call.screen.tsx which calls the listeners as:

  useEffect(() => {
    const initCallKeep = async () => {
      try {
        const options: IOptions = {
          ios: {
            appName: 'My app name',
          },
          android: {
            alertTitle: 'Permissions required',
            alertDescription: 'This application needs to access your phone accounts',
            cancelButton: 'Cancel',
            okButton: 'ok',
            imageName: 'phone_account_icon',
            additionalPermissions: [],
            selfManaged: true,
            // Required to get audio in background when using Android 11
            foregroundService: {
              channelId: 'com.company.my',
              channelName: 'Foreground service for my app',
              notificationTitle: 'My app is running on background',
              notificationIcon: 'Path to the resource icon of the notification',
            },
          },
        };

        RNCallKeep.setAvailable(true);
        await RNCallKeep.setup(options);
      } catch (e) {
        console.error('Error occured while initializing callkeep: ', e);
        showError(e);
      }
    };

    initCallKeep();
  }, []);

  const actionHandler = (action: string) => {
    console.log('Called handler for action: ', action);
  };

  useEffect(() => {
    Api.on(ApiEvent.IncomingCall, onIncomingCall);
    Api.on(ApiEvent.CallUpdate, onCallUpdated);

    RNCallKeep.addEventListener('showIncomingCallUi', showCallUI);
    RNCallKeep.addEventListener('didReceiveStartCallAction', () => actionHandler('didReceiveStartCallAction'));
    RNCallKeep.addEventListener('answerCall', () => actionHandler('answerCall'));
    RNCallKeep.addEventListener('endCall', () => actionHandler('endCall'));
    RNCallKeep.addEventListener('didDisplayIncomingCall', () => actionHandler('didDisplayIncomingCall'));
    RNCallKeep.addEventListener('didPerformSetMutedCallAction', () => actionHandler('didPerformSetMutedCallAction'));
    RNCallKeep.addEventListener('didPerformDTMFAction', () => actionHandler('didPerformDTMFAction'));

    return () => {
      Api.off(ApiEvent.IncomingCall, onIncomingCall);
      Api.off(ApiEvent.CallUpdate, onCallUpdated);

      RNCallKeep.removeEventListener('showIncomingCallUi');
      RNCallKeep.removeEventListener('didReceiveStartCallAction');
      RNCallKeep.removeEventListener('answerCall');
      RNCallKeep.removeEventListener('endCall');
      RNCallKeep.removeEventListener('didDisplayIncomingCall');
      RNCallKeep.removeEventListener('didPerformSetMutedCallAction');
      RNCallKeep.removeEventListener('didPerformDTMFAction');
    };
  }, []);

  const onIncomingCall = useCallback(
    async (data: ICall) => {
      try {
        if (isCalling) {
          throw 'Call Event Duplication: A call was already in progress while another incoming call event was received';
        }

        setBookingID(data.bookingId);
        setCallID(data.id);
        RNCallKeep.displayIncomingCall(data.id, 'Driver');
      } catch (e) {
        console.error('Failed to start the call: ', e);
        throw e;
      }
    },
    [isCalling],
  );

  const showCallUI = () => {
    setIsCalling(true);
    setStatus(CallStatus.Incoming);
    CallService.playRingTone();
  };

Steps to Reproduce

Versions

- Callkeep: ^4.3.3
- React Native: 0.69.5
- iOS: NA
- Android: 10
- Phone model: Xiaomi Redmi 8

Logs

11-02 16:40:09.765 24283 26727 D RNCallKeep: [VoiceConnectionService] setAvailable: true
11-02 16:40:09.765 24283 26727 D RNCallKeep: [VoiceConnectionService] setInitialized: true
11-02 16:40:09.770 24283 26727 D RNCallKeep: [RNCallKeepModule] setup
11-02 16:40:09.770 24283 26727 D RNCallKeep: [VoiceConnectionService] setAvailable: false
11-02 16:40:09.770 24283 26727 D RNCallKeep: [VoiceConnectionService] setInitialized: true
11-02 16:40:09.770 24283 26727 D RNCallKeep: [RNCallKeepModule] setSettings: { NativeMap: {"alertTitle":"Permissions required","foregroundService":{"channelId":"com.company.my","channelName":"Foreground service for my app","notificationTitle":"My app is running on background","notificationIcon":"Path to the resource icon of the notification"},"alertDescription":"This application needs to access your phone accounts","cancelButton":"Cancel","imageName":"phone_account_icon","okButton":"ok","selfManaged":true,"additionalPermissions":[]} }
11-02 16:40:09.772 24283 26727 D RNCallKeep: [RNCallKeepModule] API Version supports self managed, and is enabled in setup
11-02 16:40:09.772 24283 26727 D RNCallKeep: [RNCallKeepModule] setup, adding RECORD_AUDIO in permissions in self managed
11-02 16:40:09.772 24283 26727 D RNCallKeep: [RNCallKeepModule] registerPhoneAccount
11-02 16:40:09.840 24283 26727 D RNCallKeep: [RNCallKeepModule] registerEvents
11-02 16:40:09.840 24283 26727 D RNCallKeep: [RNCallKeepModule] startObserving, event count: 0
11-02 16:40:09.840 24283 26727 D RNCallKeep: [RNCallKeepModule] startObserving, event count: 0
11-02 16:40:09.840 24283 26727 D RNCallKeep: [VoiceConnectionService] setAvailable: true
11-02 16:40:09.840 24283 26727 D RNCallKeep: [VoiceConnectionService] setInitialized: true
11-02 16:40:43.990 24283 26727 W RNCallKeep: [RNCallKeepModule] displayIncomingCall ignored due to no ConnectionService or no phone account

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions