Added some condtions to prevent script from breaking if list of missed calls is empty.
This commit is contained in:
parent
6652def351
commit
b7fdd6e0e6
|
@ -70,13 +70,20 @@ def get_last_call():
|
||||||
except:
|
except:
|
||||||
print("Couldn't connect to Box")
|
print("Couldn't connect to Box")
|
||||||
missed_calls = fc.get_missed_calls(False,1,1)
|
missed_calls = fc.get_missed_calls(False,1,1)
|
||||||
|
|
||||||
|
if len(missed_calls) > 0:
|
||||||
return missed_calls[0]
|
return missed_calls[0]
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def lastcall2matrix(tam,tam_no):
|
def lastcall2matrix(tam,tam_no):
|
||||||
# Call Watch to Matrix
|
# Call Watch to Matrix
|
||||||
if env_call_watch and not at_least_one_new_message:
|
if env_call_watch and not at_least_one_new_message:
|
||||||
c = get_last_call()
|
c = get_last_call()
|
||||||
|
if c:
|
||||||
c_msg = "{} - {} ({})".format(c.Date, c.Caller, c.Name)
|
c_msg = "{} - {} ({})".format(c.Date, c.Caller, c.Name)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
# ... and send message and file to Matrix Room
|
# ... and send message and file to Matrix Room
|
||||||
## if Number of a TAM and the last call match
|
## if Number of a TAM and the last call match
|
||||||
|
|
Loading…
Reference in New Issue