How to set a limit for incoming calls

Hello, I would like to ask for some hints on how to set a limit for incoming calls for each user? I am using Asterisk 10.5.1 and I want to disable waiting calls. All users are members of queues. Sometimes a user wants to transfer a call to someone else. Our softphones don’t have a function to return busy signal when a user is holding a conversation. They can only ignore and report an unanswered call - this is not what we want. Is there any way to limit incoming calls to one, and not limit outgoing calls (for attended transfer for example)?

It can be done using GROUP/GROUP_COUNT functions

Sample code for incoming call’s dialplan (AEL syntax):
if( “${GROUP_COUNT(GroupName@Category)}” >= “${Limit}” )
goto Hangup;
Set(GROUP(Category)=GroupName);

Thank you for advice, but I have still problem with members of queue. They can receive a call from the queue and from another sip user in the same time. Call from the another user is adding channel to group but call from queue don’t.

So far I got this:

exten => 5111,1,GotoIf($[ ${GROUP_COUNT(${EXTEN}@incoming)} > 0 ]?busy) same => n,Set(GROUP(incoming)=${EXTEN}) same => n,Dial(SIP/test1) same => n(busy),Busy()