modem: Catch exception: call removed while waiting to become active
This can happen while in a test we use:
wait(ms_mo.call_is_active, mo_cid)
And then answer fails for whatever reason, after a timeout ofono will
remove the call object:
/sierra_2: DBG: 'org.ofono.VoiceCallManager'.CallRemoved() -> /sierra_2/voicecall01
As a result, during next call o call_is_active() will try to get the
call object, but it doesn't exist anymore and an exception will be
created in method call_state during call to systembus_get().
Change-Id: I02b7e76425754372756493761819f18f1e3106c1
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 2f742ea..59fcc76 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -708,9 +708,14 @@
return self.call_state(call_id) == 'active'
def call_state(self, call_id):
- call_dbus_obj = systembus_get(call_id)
- props = call_dbus_obj.GetProperties()
- state = props.get('State')
+ try:
+ call_dbus_obj = systembus_get(call_id)
+ props = call_dbus_obj.GetProperties()
+ state = props.get('State')
+ except Exception as e:
+ self.log('asking call state for non existent call')
+ log.log_exn()
+ state = 'disconnected'
self.dbg('call state: %s' % state)
return state