#! /usr/bin/pythonimport osimport gobject, dbusfrom dbus.mainloop.glib import DBusGMainLoop blocklistFile = '/home/user/MyDocs/BlockedCallers.txt' def handle_call(obj_path, callernumber): global blocklist if callernumber in blocklist: print 'I 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 = []if os.path.exists(blocklistFile): try: blFile = open(blocklistFile,'rb') blocklist = [num.strip() for num in blFile.readlines()] blFile.close() except Exception: print "Blocklist missing, should be at " + blocklistFile 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()
blocklist = ["+918067337555","+918067348300","+918066167590"]
blocklist = [""]