Om2008.8: execute script on incoming call

shawnzier at gmail.com shawnzier at gmail.com
Tue Sep 2 02:47:55 CEST 2008


On Thu, Aug 28, 2008 at 01:18:29AM +0200, Michael 'Mickey' Lauer wrote:
> def onCallStatus( index, status, properties ):
>     if status == "incoming":
>         try:
>              action = actions[properties["number"]]
>         except KeyError:
>              pass
>         else:
>               obj = bus.get_object( "org.freesmartphone.ogsmd", "/org/freesmartphone/Device/GSM" ) 
> 	      callInterface = dbus.Interface( obj, "org.freesmartphone.GSM.Call" )
>               callInterface.Release( index )
>               subprocess.Popen( action, shell=True )
> 

I think the 

action = actions[properties["number"]]

line is wrong. Should it be

action = action[properties["peer"]]

Here is the dbus signal when I call the Neo. Phone number has been scrubbed.

 [SIGNAL]    org.freesmartphone.GSM.Call.CallStatus    from :1.5 /org/freesmartphone/GSM/Device
 (dbus.Int32(1), dbus.String(u'incoming'), dbus.Dictionary({dbus.String(u'status'): dbus.String(u'incoming', variant_level=1), dbus.String(u'peer'): dbus.String(u'XXXXXXXXXXX', variant_level=1), dbus.String(u'direction'): dbus.String(u'incoming', variant_level=1), dbus.String(u'line'): dbus.Int32(0, variant_level=1)}, signature=dbus.Signature('sv')))


I changed it to my suggestion and it didn't get the exception. Now I am getting an exception on 

subprocess.Popen( action, shell=True )

ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 214, in maybe_handle_message
      self._handler(*args, **kwargs)
  File "oncallscript.py", line 17, in onCallStatus
      subprocess.Popen( action, shell=True )
      NameError: global name 'subprocess' is not defined

I found something about the python-subprocess package on the wiki. Do I need this? It says it's not available in official repos. Would it be safe to use ScaredyCats repo?

http://wiki.openmoko.org/wiki/Python

Thanks for any more help you can give me.




More information about the community mailing list