get unanswered calls

Post your questions and help other users.

Moderator: Martin

Post Reply
doc
Posts: 5
Joined: 02 Sep 2015 19:16

get unanswered calls

Post by doc » 17 Sep 2015 00:30

Hi,

the bigger plan is to to vibrate every 5 minutes if there are missed calls and not doing it otherwise.

the (not yet working) solution i came up with:

trigger: incoming call has status missed
command: content query --uri content://call_log/calls --where "new=0"
script: match=matches(stdout, ".*new=1.*")
if match==true:
vibrate
wait 5 minutes
go to command

stdout returns me the right thing but matching doesn't work.

any more elaborate ways to do what i'm trying to achieve?
what do i do wrong?
also did i get it right that when you have missed calls and you turn on the phone app (and see that there was a missed call) new=1 changes to new=0?

thanks

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: get unanswered calls

Post by Martin » 17 Sep 2015 19:37

Hi,

Why do you query for "new=0" but then check for new=1 in the output?
The command probably writes multiple lines, you'd have to turn on DOTALL mode so that the . also matches new line characters. The regex would become "(?s).*new=1.*".

Opening the phone app might be sufficient to clear the new flag. Newer versions of Android (4+) also support a new column is_read.
From the docs:
Whether this item has been read or otherwise consumed by the user.
Unlike the NEW field, which requires the user to have acknowledged the existence of the entry, this implies the user has interacted with the entry.
You could also use condition Notification on Statusbar displayed to check if the missed calls notification is still showing. Alternatively you could use action Init Variables Call Log with query criteria Newest missed call and then check if variable call_new contains true (condition Expression: call_new).

Regards,
Martin

doc
Posts: 5
Joined: 02 Sep 2015 19:16

Re: get unanswered calls

Post by doc » 17 Sep 2015 20:28

Martin wrote: Why do you query for "new=0" but then check for new=1 in the output?
because i tried to get "true" returned for new=0 which didn't work either. i wanted to change my post to what i was actually trying to achieve and forgot to change the first value. so this was a typo.

adding (?s) works. will also try all the other stuff. sounds better to me. thanks.

Post Reply