0

I have implemented the Twilio in my app and have made it so that web to web calls can be made and also web to phone calls. The only thing is that if I call Voice.call() with my user's phone number, it'll call him but the call will not open my activity on his device. The phone call UI will be the default decide's UI for incoming calls. If I, on the other hand, use the user's defined identity on his device, it'll go nicely via my activity. Any ideas on how I can make the web to phone call using a phone number and redirect the call via my activity?

I have been unable to find any documentation in this regard.

Cheers!

AndreiBogdan
  • 10,858
  • 13
  • 58
  • 106
  • I'm no Android developer I'm afraid. but I believe you want to look into `BroadcastReceiver`s if you want to intercept incoming phone calls direct to a user's number. [This tutorial might get you started](http://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html#exercise-register-a-receiver-for-incoming-phone-calls). I'm not sure how to redirect to your own activity though, [this post might help with that](https://android-developers.googleblog.com/2013/05/handling-phone-call-requests-right-way.html). – philnash Aug 23 '18 at 00:37
  • If you could put that as an answer, that there is not built-in solution (in the SDK) and that I need to handle it myself, so I can accept the answer please ? – AndreiBogdan Aug 23 '18 at 04:26

1 Answers1

1

Twilio developer evangelist here.

It's not the job of the Twilio SDK to intercept phone calls made directly to the device. However, since Android is flexible enough to replace the default phone application, you can do this yourself.

I am not an Android developer however, but a quick search around lead me to this tutorial on using a BroadcastReceiver to run your own code when an incoming phone call occurs. This StackOverflow answer might help you get started too.

Hope that helps.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Sad part is that I need to do this for iOS as well, and iOS doesn't let me play around with intercepting phone calls...sigh – AndreiBogdan Aug 23 '18 at 04:35
  • It does not at all I'm afraid. Perhaps you can look into hooking your users up with a Twilio number that will always translate into a call to their identity via the app? – philnash Aug 23 '18 at 04:36
  • My only wish for the phone to phone call was when the app is offline. I was hoping to let the user make a direct call to a proxy and then redirect it to the other user (either web or phone) but I don't believe that can be done. – AndreiBogdan Aug 23 '18 at 04:40
  • 1
    All of that can be done, the only issue is intercepting that call on iOS and answering it in your own app. And there's nothing I can do to help that I'm afraid. – philnash Aug 23 '18 at 04:42