How To Block Unwanted Callers On The N900

There is no call blocking application for the N900 yet, but that hasn’t stopped Vinu Thomas from coming up with a hack that lets you do just that. He clearly mentions that this is a stop gap arrangement until until steps up to create a real application with this functionality. What I’d like is an SMS blocking app as well, as SMS spam has really increased over the last one year or so.

How To Block Unwanted Callers On The N900

Anyway, if you are being plagued by unwanted callers and have had enough, here’s how to get rid of them.

  • The first thing you need is root access. So go ahead and download rootsh from the application manager or use this link.
  • Now download this script. Inside the zip is a file callblock.py. Once you open it in notepad or whatever you like, it will look like the picture below.

    How To Block Unwanted Callers On The N900

  • Now edit the ‘Blocklist’ in the script and put in the numbers you want to block. You can add as many number as you like, just make sure that you enclose the numbers within the quote and separate each with a comma. Also, do not have a trailing comma after the last number.
  • Save and transfer this file (callblock.py) to the MyDocs folder on the N900.
  • Open terminal on the device and enter the root mode by entering:

root

  • Next start the call block hack by entering:

python /home/user/MyDocs/callblock.py &

That’s it. All your unwanted calls are now blocked. You will need to run this script everytime you restart your device as there is no auto start functionality yet. Edit the block list in the callblock.py file anytime you want to change the blacklisted numbers. In case you have any doubts, hit Vinu’s My Nokia World to ask him.

15 thoughts on “How To Block Unwanted Callers On The N900”

  1. Prometoys,

    If you care to click the link which explains how to enable extras-devel, you will notice the following in the first para itself.

    “Extras-Devel is the place where applications reside when they are in the alpha mode and definitely not ready for the average consumer.”

  2. Prometoys ,

    You are not forced to enable extras-devel. If you want to use your N900 only as a phone then stick to the initial catalogs. If you want to see the full potential of the device you have to enable outher catalogs and play with aplications. As Vaibhav Sharma said: this applications are not for the average consumer.

  3. Just a bit of a follow up. Since you’re using python you might as well use a set for the blocklist instead of explicitly iterating through a list.

    Anyway, this also very very hackishly adds custom ring tones to your script. I tried updating the configuration with profiled calls, but it doesn’t take effect fast enough. And that also would mean decompressing the ring tones when the call comes in. However, changing a symlinked cached tone seems to do the trick. To use this, you will also need to prepare the cached wavs, see the second script for a sloppy fix for that.

    #! /usr/bin/python

    import gobject, dbus
    import time
    import os
    from dbus.mainloop.glib import DBusGMainLoop

    def handle_call(obj_path, callernumber):
    global blocklist
    print “call from “+callernumber
    if callernumber in special_ringtones:
    print ‘Special ring tone for: %s’ %callernumber
    bus = dbus.SessionBus()
    profiled = bus.get_object(‘com.nokia.profiled’, ‘/com/nokia/profiled’)
    proxy = dbus.Interface(profiled, ‘com.nokia.profiled’)
    old_ring = os.path.basename(proxy.get_value(‘general’,’ringing.alert.tone’))
    os.system(“ln -sf /home/user/.local/share/sounds/”+special_ringtones[callernumber]+”.wav.keep”+
    ” /home/user/.local/share/sounds/”+old_ring+”.wav”)
    time.sleep(3)
    os.system(“ln -sf /home/user/.local/share/sounds/”+old_ring+”.wav.keep /home/user/.local/share/sounds/”+old_ring+”.wav”)
    elif callernumber in blocklist:
    print ‘I dont have to block %s’ %callernumber
    bus = dbus.SystemBus()
    callobject = bus.get_object(‘com.nokia.csd.Call’, ‘/com/nokia/csd/call/1’)
    smsiface = dbus.Interface(callobject, ‘com.nokia.csd.Call.Instance’)
    smsiface.Release()

    blocklist = set([“+918067337555″,”+918067348300″,”+918066167590”])
    special_ringtones = { “17185551212”: “Tinker.aac”,
    “18175551212”: “Temporal.aac” }

    DBusGMainLoop(set_as_default=True)
    bus = dbus.SystemBus()
    bus.add_signal_receiver(handle_call, path=’/com/nokia/csd/call’, dbus_interface=’com.nokia.csd.Call’, signal_name=’Coming’)
    gobject.MainLoop().run()

    ################# script to prepare audio files ###############

    #! /usr/bin/python

    import dbus
    import sys
    import os
    import time

    bus = dbus.SessionBus()
    profiled = bus.get_object(‘com.nokia.profiled’, ‘/com/nokia/profiled’)
    proxy = dbus.Interface(profiled, ‘com.nokia.profiled’)
    old = os.path.basename(proxy.get_value(‘general’,’ringing.alert.tone’))

    f = os.path.abspath(sys.argv[1])
    b = os.path.basename(sys.argv[1])
    if os.path.isfile(“/home/user/.local/share/sounds/”+b+”.wav.keep”):
    exit(0)

    if (os.path.isfile(‘/home/user/.local/share/sounds/’+old+’.wav’) and not
    os.path.islink(‘/home/user/.local/share/sounds/’+old+’.wav’)):
    os.rename(“/home/user/.local/share/sounds/”+old+”.wav”,
    “/home/user/.local/share/sounds/”+old+”.wav.keep”)
    os.symlink(“/home/user/.local/share/sounds/”+old+”.wav.keep”,
    “/home/user/.local/share/sounds/”+old+”.wav”)

    if (len(sys.argv) > 1):
    proxy.set_value(‘general’,’ringing.alert.tone’,f)
    time.sleep(2)
    if(os.path.isfile(“/home/user/.local/share/sounds/”+b+”.wav”)):
    os.link( “/home/user/.local/share/sounds/”+b+”.wav”,
    “/home/user/.local/share/sounds/”+b+”.wav.keep”)

    if(os.path.islink(“/home/user/.local/share/sounds/”+old+”.wav”)):
    os.unlink(“/home/user/.local/share/sounds/”+old+”.wav”)

    os.symlink(“/home/user/.local/share/sounds/”+b+”.wav.keep”,
    “/home/user/.local/share/sounds/”+old+”.wav”)
    proxy.set_value(‘general’,’ringing.alert.tone’,old)

  4. Hi,

    I’m writing a UI for your script, and I’d like to include your code in my package. But I didn’t found any licence around here, so, I’m I allowed to use your code? 🙂

    Greeting from Austria

    Srdjan

  5. Add:

    I’d also like to redistribute your code, so is GPL OK for you?

    Thanks!
    – –
    Srdjan

  6. Hello!

    I’m following the steps above, but x-terminal keeps telling me “not found”, any solution please?

    thank you.

  7. I got 2 problems, maybe some1 will be kind enough to respond and helps us out
    1. Where is actually situated MyDocs
    2. On qwerty keyboard isn`t any “&”, how can we get it?

    All the best

  8. I was completely pissed off, as i was receiving so many calls from some guy who was using different numbers every now and then, being a girl and i couldn’t figure out what to do about this, ie how to block the calls . Nokia N 900 doesn’t have such feature as auto rejection or blocking system so i had gone through all those python and rootsh memo software but i couldn’t do any of it.
    And all of frustration went in and i thought of just changing my number or changing my phone instrument to get some other that had black listing number option.
    but eventually i browsed and searched my phone the applications software in which i saw my contacts in purple color software that had some blocking option written in its description i downloaded it, then searched in its settings that had the option of Group: block calls from , i then selected the numbers i had saved in name of unwanted and then went back on settings main screen where on the left it mentions: monitor incoming calls for , clicking on that u select the : auto reject calls and save it..it would say shut down and restart your phone and i did the same.

    and trust me it really worked i checked as i put my another number on its block list and when i called it automatically rejected the call and my number came as busy, on the other hand my n 900 showed call rejected from this number …wow wow wow..
    am so happy now i was so sad and feeling helpless at the hands of such insane people who ruined my calm for so long unnecessarily.
    wanted to share this with everyone i know it really sucks getting calls from such people.

Comments are closed.