Controlled group line

Hello, I have to develope a controlled line with a fixed amount of minutes for a group of users.
I can identify the gruop of the user using a prefix and I have a common counter that I have to decrement for every user that is consuming minutes.
When the counter is zero, every current session must be finished and the next calls for this group must be rejected.
Can anyone tell me if is it posible to implement this feature using Asterisk?
I don’t know for example if i can decrement the counter in atomic way because perhaps many users of the same group could collide.
Thank’s.