How to block Specific outgoing calls
<p>I want to block a specific phone number that is in my database</p>

<p>I do a comparison between the number the user dialed, and the number in memory. If they are equal, I block the call.</p>

<p>My code:</p>

<pre><code>public void onReceive(Context context, Intent intent) {

    PlaceDataSQL placeDataSQL =new PlaceDataSQL(context);
    ArrayList&lt;String&gt; getUsersPhoneNumbers= placeDataSQL.getUsersPhoneNumbers(); 
    //TODO
    //===========
    //here I need to check the number

    Bundle b = intent.getExtras();
    String incommingNumber = b.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
    //String outGoingNumber = b.getString(TelephonyManager.);
    Boolean find=false;
    try {

        for(int i=0;i&lt;getUsersPhoneNumbers.size();i++)
        {
            if(incommingNumber.equals(getUsersPhoneNumbers.get(i)))
            {
                find=true;
                break;
            }
        }

    } catch (Exception e) {
        incommingNumber="";
    }


// ========================================
//here the problem
//=========================================
    String phonenumber=b.getString(Intent.EXTRA_PHONE_NUMBER);
    try {

        for(int i=0;i&lt;getUsersPhoneNumbers.size();i++)
        {
            if(phonenumber.equals(getUsersPhoneNumbers.get(i)))
            {
                find=true;
                break;
            }
        }
        if (!find)
            return;
    }catch (Exception e) {
        phonenumber="";
    }

    if (!find)
        return;


    /* examine the state of the phone that caused this receiver to fire off */
    String phone_state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
    if (phone_state.equals(TelephonyManager.EXTRA_STATE_RINGING)) 
    {

        logMe("Phone Ringing: the phone is ringing, scheduling creation call answer screen activity");
        Intent i = new Intent(context, CallAnswerIntentService.class);
        i.putExtra("delay", 100L);
        i.putExtra("number", incommingNumber);
        context.startService(i);
        logMe("Phone Ringing: started, time to go back to listening");


    }

    if (phone_state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))
    {

        Intent i = new Intent(context,InCallScreenGuardService.class);
        i.putExtra("delay", 100L);
        i.putExtra("number", phonenumber);
        logMe("Phone Offhook: starting screen guard service");
        context.startService(i);

    }

    if (phone_state.equals(TelephonyManager.EXTRA_STATE_IDLE))
    {
        Intent i = new Intent(context,InCallScreenGuardService.class);
        logMe("Phone Idle: stopping screen guard service");
        context.stopService(i);

    }

    return;
}
</code></pre>

<p>The problem:</p>

<p>I can get incoming numbers but I can't get outgoing numbers?</p>
