Search code examples
react-nativeaws-lambdaaws-pinpoint

React Native trigger user phone call incoming on action in app


I have a question that I have solved in what may be a hacky way, and maybe there is a better way to handle it. I have an app in React Native, and keep in mind I am using Expo right now. That you type in a phone number and a message and with a aws lambda function and pinpoint it will send a robo call to that number with that message. This is just a demo right now, it's not meant to work like this in production, and it is not nefarious. The idea of the app rests on this working tho. So it does work, but I was wondering if there was a way to have react native just trigger the phone ringer with a fake number. Or even pass a message to it without using the lambda. If I can't trigger the native ringer, is there a way to build a custom ring interface that could show up even when the screen is locked or the app is closed. So a delay on after the call is initated.

What is suggested as the best way to do this. Are there ways to connect to the microphone and and the speaker with react native, pass a recording and have an interface to do so.

So the three options are

A) stick with the lambda and have it be a real phone call, and have it work no matter if app is open or phone is locked.

B) Have the app trigger a notification to the phone on a timer that pops up a full screen ui that looks like a phone call that you can answer and here a message, whether the app is closed or phone is locked

C) have the app trigger a real phone call ringer on a timer that has a message in it.

Thanks for reading this, and let me know what is possible, and then I will go down the rabbit hole of trying to implement it.


Solution

  • I believe the feature you are looking for (in iOS) is CallKit( https://developer.apple.com/documentation/callkit?language=objc), and ConnectionService in Android. This is used in apps like Whatsapp, Messenger, ... .This feature is not ready-made bundled inside expo so you have to use bare workflow with native code integration (one nice library is this https://github.com/react-native-webrtc/react-native-callkeep).

    If you still want to stay in expo, then I believe option A is the most viable option.

    For option B, what I would imagine is sending a notification to the app, then user open it and the app opens with the call UI (which is also okay)

    Option C is basically not possible with a "real" phone call.