6 import dbus.mainloop.glib
8 def property_changed(property, value):
9 print "CallForwarding property %s changed to %s" % (property, value)
11 def print_properties(cf):
12 properties = cf.GetProperties()
15 if len(properties[p].__str__()) > 0:
20 print "%s call forwarding rule: %s" % (p, value)
22 if __name__ == "__main__":
23 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
25 bus = dbus.SystemBus()
27 manager = dbus.Interface(bus.get_object('org.ofono', '/'),
30 modems = manager.GetModems()
32 cf = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
33 'org.ofono.CallForwarding')
35 cf.connect_to_signal("PropertyChanged", property_changed)
37 ss = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
38 'org.ofono.SupplementaryServices')
44 # Busy To +155542, for Voice
45 print "Setting Busy Voice rule to +155542"
46 print ss.Initiate("*67*+155542*11#")
49 # Not Reachable to +155543, Voice
50 print "Setting Voice Not Reachable rule to +155543"
51 print ss.Initiate("**62*+155543*11#")
53 # Not Reachable to +155544, Voice service
54 print "Setting Voice No Reply rule to +155544, timeout=30"
55 print ss.Initiate("**61*+155544*11*30#")
57 # Unconditional to +155547, Voice
58 print "Setting Unconditional for Voice to +155545"
59 print ss.Initiate("*21*+155545*10#")
63 print "Query all voice forwardings"
64 print ss.Initiate("*#002**11#")
66 print "Query no reply voice forwardings"
67 print ss.Initiate("*#61**11#")
69 # Deactivate everything
70 print "Deactivating everything"
71 print ss.Initiate("##002#")
74 mainloop = gobject.MainLoop()