How to make number not reachable (similar to call blocker)?
Asked Answered
M

3

6

There are lot of call blocking application for mobile, like NQ Call Blocker. But in these applications, if we add a number to blacklist, the caller will hear "Busy Tone". Also the caller can hear "Ringing Tone" for a fraction of second. Which means, it'd look like we are rejecting the call intentionally.

Now, what I'm trying is, to develop an call blocking application, which can send "Not Reachable Tone", instead of "Busy Tone" ... ??

For example, call your mobile from another number, when it's ringing, try to change your mode to "Airplane Mode". You'll hear "Not Reachable Tone". [Possible in some android device, long press the power button, and activate "Airplane mode", when your mobile is ringing.]

Municipality answered 29/6, 2013 at 19:44 Comment(0)
L
4

You could try to implement a PhoneStateListener and when you receive a call you compare it to you array of numbers, if it is forbidden you switch to airplaine mode. Something like this:

case TelephonyManager.CALL_STATE_RINGING: // incoming call
{
    for (int i = 0; i < forbiddenNumber.size; i++) {
        if (incomingNumber.equals(forbiddenNumber[i])) {
            // read the airplane mode setting
            boolean isEnabled = Settings.System.getInt(
                    getContentResolver(),
                    Settings.System.AIRPLANE_MODE_ON, 0) == 1;

            // toggle airplane mode
            Settings.System.putInt(getContentResolver(),
                    Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0
                            : 1);

            // Post an intent to reload
            Intent intent = new Intent(
                    Intent.ACTION_AIRPLANE_MODE_CHANGED);
            intent.putExtra("state", !isEnabled);
            sendBroadcast(intent);

        }
    }

Don't forget the permission to WRITE_SETTINGS

Lotti answered 9/9, 2013 at 14:55 Comment(0)
G
5

The "Not Reachable" signal is not sent by your phone. Instead, it is sent by your carrier.

When your number is not reachable, it literally means the cell tower can't reach you. So when someone calls you, the tower tries to find you, and if it can't it send the "Not Reachable" signal down the line. You can't fake one and send it from your device instead.

Gist answered 3/9, 2013 at 14:52 Comment(0)
L
4

You could try to implement a PhoneStateListener and when you receive a call you compare it to you array of numbers, if it is forbidden you switch to airplaine mode. Something like this:

case TelephonyManager.CALL_STATE_RINGING: // incoming call
{
    for (int i = 0; i < forbiddenNumber.size; i++) {
        if (incomingNumber.equals(forbiddenNumber[i])) {
            // read the airplane mode setting
            boolean isEnabled = Settings.System.getInt(
                    getContentResolver(),
                    Settings.System.AIRPLANE_MODE_ON, 0) == 1;

            // toggle airplane mode
            Settings.System.putInt(getContentResolver(),
                    Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0
                            : 1);

            // Post an intent to reload
            Intent intent = new Intent(
                    Intent.ACTION_AIRPLANE_MODE_CHANGED);
            intent.putExtra("state", !isEnabled);
            sendBroadcast(intent);

        }
    }

Don't forget the permission to WRITE_SETTINGS

Lotti answered 9/9, 2013 at 14:55 Comment(0)
C
3

Since you can't do this, as Raghav points out, your next likely line of thought will be to fake those carrier DTMF control tones, e.g. network busy, phone number disconnected, etc.

You will then soon discover that your app can't do that either... it can't "fake" DTMF tones up the line - neither before the call is answered (because you are not the phone company), nor after it is answered, which many consider to be an oversight by google-android. Many posts here about both.

Yes, of course we can manually key in DTMF's (or we couldn't call extensions, punch in account numbers, etc.) it's just that an APP can't do that automagically ... much to the annoyance of many a PBX developer. Sorry, this is unfortunate for all of us...

Centi answered 4/9, 2013 at 22:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.