How to intercept and parse incoming calls via an app - ios

How does Truecaller intercept incoming phonecalls on the iphone to display caller ID?
I didn't think this was possible from within the app?
Specifically, if I wanted to build this functionality, what protocols would I go about using?
http://www.truecaller.com/how-it-works

On an iPhone, without jailbreaking it:
- you cannot intercept a call in any way
- you cannot determine the phone number nor the caller ID identifying information regarding the call. Even if you could there
is no way to alter what is displayed on the call screen
- you cannot block the call
- your program can get a notification when a call is being made/terminated etc. But only if your app is executing in the
foreground at the time of the call or if the app is in the
background and has a relevant background mode (even then you can
only know there is a call in some circumstance, depending upon what
you're doing in the background and what state your in etc. Its too complex to describe the exact situation here briefly)

True Caller doesn't do that on iOS as it isn't supported with the native SDK. See their FAQ:
http://www.truecaller.com/support , specifically the "Why don't I receive live caller ID?" Section under "iPhone/Windows Phone". If you must though, try looking into a solution for jailbroken devices.

It's impossible to "intercept" calls. It is possible to handle the "background event call" when a iPhone get's a call. That said, Truecaller doesn't intercept calls. More info can be found on their website.

Related

iOS - Is it possible to make a phone call programmatically blocking any kind of outgoing phone call sound?

I'm trying to make an iOS app that can programmatically make a phone call silently, blocking any kind of outgoing phone call sound. (After the phone call is ready the app would then start recording the audio from the microphone.) Does anyone know if that's possible or have any idea about how that can be done?
Apple is really protective in such core features as calls. So we as a programmers have really narrow API to use. Basically, to make a call you have two options:
Open URL with format like tel://
Init call with instance of CXStartCallAction
Everything happens after is held by the system, so you don't have much of control over it. To be concrete, you have no control over call sounds.
You can have much more control, if you use VoIP or something similar.
Welcome Antonio!
Briefly, no you can not.
Let me explain further...
After the recipient answers the call, the system calls the provider
delegate’s provider(_:perform:) method. In your implementation of that
method, configure an AVAudioSession and call the fulfill() method on
the action object when finished.
You may have some doing to configure audio session but the system would block the microphone and from the API side you will not have access whatsoever.
I am deeply sorry for being so blunt, but what you're intending is simply no possible.

Pickup call automatically in ios

What exactly I need is that when an incoming call come and my app is in foreground than the call must be automatically received and loudspeaker must be activated.
I have seen many post in SO saying that to intercept the calls is not possible in iOS.
But what if I use any VoIP API and make calls from it to my app[app to app call] ?
can I receive the call automatically in that case or that time also the SDK won't allow me to do so as its the core part of iOS I am too much confused.
This is not possible with UIKit, and furthermore if you did use private Apis your app would not be approved.

Is it possible to have an iPhone app that replaces the default call manager with interface to receive and send calls

This might be obvious but is it possible to have an iPhone app that replaces the default call manager. I would like it to listen register with the low-level services to receive and make calls. I am not sure if apple exposes this libraries to apps. At minimum I would like the app to be able to receive.
No, this is not possible. Apple doesn't allow this. You might be able to accomplish this through a jailbroken device but there would be no documentation to assist you and you would need to discover private APIs.
As noted on this answer
If your application is active when a call event takes place, the
system dispatches the event to your handler immediately. However, call
events can also take place while your application is suspended. While
it is suspended, your application does not receive call events.

Detecting the call events in ios

I am new to ios. I was wondering if there is any way to detect the call events like incoming call, outgoing call even if my app is not in foreground. And if yes it is possible then can i read the details about that call like duration, whether it is missed, dialed or recieved. Thanks in advance.
Yes you can detect a Call. but only if your app is running in the foreground.
For this you can use the Core Telephony Framework.
If your app will fall in any of the background running categories (VOIP, AUDIO, Location tracking or accessory ) you might be able to use the
CTCallCenter in the background. But be aware that Apple will reject you app if you miss use the background running mode for something it was not meant for.
The CTCallCenter will allow you to detect any calls that are started or already in progress.
However you will not be able to detect any detail about the call, the CTCall identifying the call will only tell you this state. The callID of CTCall will just give you an unique identifier for the call but not the number being called.

IOS - How to block all incoming calls?

Can anyone suggest me is there a way to block all incoming calls for a while? or at least can I put my phone into silent pragmatically ? Please suggest
No. Simply you cannot do that. There is no public API is available to do that. Your app will be in sandbox mode. You cannot access them in anyway.
Now it can be done from iOS 10 and above using the CallKit framework upto a certain amount. The numbers we provide can be blocked. If you want to block all incoming calls, just use Airplane mode.
The CallKit framework provides programmatic access to VoIP functionality, as well as call blocking and identification.

Resources