/usr/share/ofono/scripts/test-call-forwarding is in ofono-scripts 1.21-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | #!/usr/bin/python3
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
print("CallForwarding property %s changed to %s" % (property, value))
def print_properties(cf):
properties = cf.GetProperties()
for p in properties:
if len(properties[p].__str__()) > 0:
print("%s call forwarding rule is: %s" % (p, properties[p]))
else:
print("%s call forwarding rule disabled" % (p))
if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
modems = manager.GetModems()
cf = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
'org.ofono.CallForwarding')
cf.connect_to_signal("PropertyChanged", property_changed)
print_properties(cf)
try:
cf.SetProperty("FoobarNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("VoiceNotReachableTimeout", dbus.UInt16(19))
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("DataNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("FaxNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("SmsNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("VoiceNoReply", "")
except dbus.DBusException as e:
print("Unable to erase voice no reply rule - Bad")
try:
cf.SetProperty("VoiceNoReply", "+134444")
except dbus.DBusException as e:
print("Unable to register voice no reply rule - Bad")
try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(30))
except dbus.DBusException as e:
print("Unable to set voice no reply timeout - Bad")
properties = cf.GetProperties()
print(properties["VoiceNoReply"])
print(properties["VoiceNoReplyTimeout"])
try:
cf.SetProperty("VoiceUnconditional", "+155555")
except dbus.DBusException as e:
print("Unable to set Voice Unconditional - Bad")
properties = cf.GetProperties()
print(properties["VoiceUnconditional"])
try:
cf.DisableAll("foobar")
except dbus.DBusException as e:
print("Unable to delete invalids - Good")
try:
cf.DisableAll("conditional")
except dbus.DBusException as e:
print("Unable to delete all conditional - Bad")
properties = cf.GetProperties()
print(properties["VoiceNoReply"])
print(properties["VoiceNoReplyTimeout"])
try:
cf.DisableAll("all")
except dbus.DBusException as e:
print("Unable to delete all conditional - Bad")
print(properties["VoiceUnconditional"])
mainloop = GLib.MainLoop()
mainloop.run()
|