Tasker: Conditionally End Calls for Contact Group Dear Android Enthusiasts:

Just got myself an Android for work and started fiddling with Tasker.
The goal consists of two parts, the first part is to send calls from a specific Contact Group ('Work') during certain times. Second, I want to let them through if they are persistent, i.e. call me X times within Y minutes.

The first part was a breeze to create. But the second part is a lot more complicated as I need to keep track of every caller and the amount of calls within Y time separately.

Currently the 'Profile' looks like this:

Event: Phone Ringing
Caller: CG:Work
Task: Test

This is what task 'Test' looks like:
1. End Call, if %TIME &lt; 6.15 &amp; %TIME &gt; 19.30

This works to block calls from the contact group 'Work' within the given timeframe.

Any suggestions on how to implement part 2? I was thinking of pushing the caller to a keyed array every time it gets blocked where the %CNAME is the key and an integer is the value. Also add an action to check against the array every time I am called from the CG before I end the call to see if I have been called before. Finally, I would need to 'pop' every key from the array that hasn't been updated for Y minutes.
Part 2 should be easy depending on the way you't want to log the calls. I would recommend using the writing a csv file then you can use the call in related variables to keep track of who call and when the call started but you'll need to create a timer for the duration of the call. You can find these variables by searching the webpage I've linked for Call Name. Don't use the variables that start with CO they are for outgoing calls.

The timer would be triggered when you pick up and end the call. You could then subtract the beginning time from the end time to get the duration. You don't need to write these time in the log in order to get the duration but you might want to at least log the start time to give you a better frame of reference.