Scam calls spoofing your own area code and prefix? Here's how to block them.

3 min read Original article ↗

T-mobile's relatively new Scam Block features have been a godsend for me in eliminating a lot of scam telemarketing calls. And I think other mobile carriers are now offering similar features. One situation they don't handle though is when scammers spoof caller ID from random numbers in your own area code and prefix. Lately I'd been getting 5+ of those a day.

Here's how I solved that problem. This is an Apple / iPhone ecosystem solution, but I'd imagine something similar is possible if you're an Android user.

1) I wrote a few lines of python to generate a list of all 9,999 numbers in my NPA-NXX who are not me. This outputs a CSV which can be imported into the MacOS Contacts application. The script splits the numbers over 20 contact records (500 numbers each) to keep Contacts from choking on the import.


contactname = "Ignore"
mynpanxx = "415-555-"
mysuffix = 1212


headers = "First Name"
for i in range(0, 500):
  headers += ",Phone : Other"
print headers


line = contactname
for i in range(0, 10000):
  
  if i <> mysuffix:
    line += "," + mynpanxx + str("%04d" % i)
  if i % 500 == 499:
    print line
    line = contactname

If you have other legit numbers you need to exclude, you can modify the script, or just manually edit the CSV afterward.

2) Open the MacOS Contacts application and import the CSV (File -> Import). Check the box to ignore the first / header row. Contacts will take a while to process the import but it should finish < 1 minute.

3) You should see the 20 new contact records listed in Contacts, and you can click on one to confirm there are 500 "Other" phone number entries for that contact. Now sync Contacts to your phone via normal iTunes sync.

4) On your iPhone, block all 20 of those contacts (Settings -> Phone -> Call Blocking and Identification -> Block Contact). Alternately, you could assign them all a silent ringtone, no vibe. That allows you to avoid being interrupted, but still see the missed call notifications later.

UPDATE 8/9/2017: For those not versed in python, here's a link to a pre-built CSV. Open it in Excel or Gsheets, do a global find & replace on "415-555" with your own area code and prefix. Then find and remove your own number -- make sure you actually remove that cell so all the trailing cells in that row shift to the left. Save and then follow step #2 and onward above.