Dialplan: count and kill dahdi calls

Hi all,

I’m new to this forum, so please excuse if I write this into the wrong board. Ok, now to my question:
I need to count all pri calls and check, if it’s possible to make another one. When all channels are in use, I’d like to kill a random call and make place for the new one. This should be used for emergency calls.

I know that the call counting could be realised by GROUP() and GROUP_COUNT(). But I don’t want to set the group for each channel manually in the dialplan, is there a way to count those calls without setting the group or to set the group globally for all dahdi channels?

and the other thing:
Is there a way to kill a call via a dialplan function? (I didn’t find anything appropriate up to now)

Thanks for every answer