Channels limit

HOW TO SET CHANNELS LIMIT FOR EVERY SINGLE ACCOUNT IN ASTERISK.

THIS MEANS I WANT TO LIMIT THE NUMBER OF CONCURRENT CALLS THAT A USER CAN MAKE FROM ASTERISK.

IS IT POSSIBLE IN ASTERISK .

YES!
core show function GROUP

Could be something like this, this is just an example

[salida-local]
exten => _9NXXXXXX,1,Verbose(2,Llamada saliente local)
same,n,Set(GROUP(salida)=miproveedorsip )
same,n,Set(CONTEO=${GROUP_COUNT(miproveedorsip@salida)})
same,n,NoOp(Existen ${CONTEO} llamadas salientes activas en miproveedorsip)
same,n,GotoIf($[${CONTEO} > 5]?denegar:marcar)
same,n(denegar),Verbose(2,Limite de llamadas alcanzado en miproveedorsip)
same,n,Hangup( )
same,n(marcar),Verbose(2,Realizando llamada saliente en miproveedorsip)
same,n,Dial(SIP/ miproveedorsip/${EXTEN:1})

I use this to control parts of my asterisk system. However I am finding that if channels do not hangup correctly or they are staying as if they are active when really they are not active channels. So it causes problems.

I started a new post on this viewtopic.php?f=1&t=89663

Any ideas from anyone would be much appreciated.