Upgrade ofono to 1.2
[profile/ivi/ofono.git] / test / answer-calls
1 #!/usr/bin/python
2
3 import dbus
4
5 bus = dbus.SystemBus()
6
7 manager = dbus.Interface(bus.get_object('org.ofono', '/'),
8                                                 'org.ofono.Manager')
9
10 modems = manager.GetModems()
11
12 for path, properties in modems:
13         print "[ %s ]" % (path)
14
15         if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
16                 continue
17
18         mgr = dbus.Interface(bus.get_object('org.ofono', path),
19                                         'org.ofono.VoiceCallManager')
20
21         calls = mgr.GetCalls()
22
23         for path, properties in calls:
24                 state = properties["State"]
25                 print "[ %s ] %s" % (path, state)
26
27                 if state != "incoming":
28                         continue
29
30                 call = dbus.Interface(bus.get_object('org.ofono', path),
31                                                 'org.ofono.VoiceCall')
32
33                 call.Answer()