Om2008.8: execute script on incoming call

shawnzier at gmail.com shawnzier at gmail.com
Mon Sep 1 23:18:02 CEST 2008


On Thu, Aug 28, 2008 at 01:18:29AM +0200, Michael 'Mickey' Lauer wrote:
> Am Donnerstag 28 August 2008 01:10:25 schrieb Michael 'Mickey' Lauer:
> > def onCallStatus( index, status, properties ):
> >     if status == "incoming":
> >         try:
> >              action = actions[properties["number"]]
> >         except KeyError:
> >              pass
> >         else:
> >               subprocess.Popen( action, shell=True )
> 
> Bummer, forgot to hangup here... use that:
> 
> 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 )
> 
Should the else statement be at the same indent as the if? I am really new to programming in general and this is the first python script I've tried to work with, so forgive me if I'm ignorant to something. I've tried it both ways. If I try it with the else at the same indent as the if, nothing happens until I hangup from the phone I'm calling from, when I get an exception from dbus. If I try it the way you have here, nothing happens at all. I tried putting some print statements in after the 

obj = bus.get_object( "org.freesmartphone.ogsmd", "/org/freesmartphone/Device/GSM" ) 

and it never gets to that print statement when the else statement is at the indent level in your snippet.

The exception I get when I put the else statement at the same level as the if statement is (This only happens when I manually hang up from either the calling end or the receiving (neo) end:

ROR: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
      callInterface.Release( index )
File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 68, in __call__
      return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 140, in __call__
      **keywords)
File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 607, in call_blocking
      message, timeout)
      DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "Release" with signature "i" on interface "org.freesmartphone.GSM.Call" doesn't exist

I am using vanilla FSO milestone 2 with no updates. If anybody has any ideas, please let me know. 





More information about the community mailing list