Om2008.8: execute script on incoming call

Michael 'Mickey' Lauer mickey at openmoko.org
Thu Aug 28 01:10:25 CEST 2008


If it doesn't need to be 2008.8, then you might want to give the frameworkd a 
try, which has been written for exactly these things. There, it would be as 
simple as (python example, but works with all kinds of languages of course):

import dbus, dbus.mainloop, gobject

actions = { \
  "+491001":"/usr/bin/foo1",
  "+491002":"/usr/bin/foo2",
  "+491003":"/usr/bin/foo3" }

def onCallStatus( index, status, properties ):
    if status == "incoming":
        try:
             action = actions[properties["number"]]
        except KeyError:
             pass
        else:
              subprocess.Popen( action, shell=True )

dbus.mainloop.glib.DBusGMainLoop( set_as_default=True )
mainloop = gobject.MainLoop()
bus = dbus.SystemBus()
   bus.add_signal_receiver( 
onCallStatus, "CallStatus", "org.freesmartphone.GSM.Call", "org.freesmartphone.ogsmd", "/org/freesmartphone/GSM/Device" )
mainloop.run()

-- 
:M:




More information about the community mailing list