Feed Sip trunk for call files

Hi all
i’m creating from scratch a little gui for outbound dialer starting from a csv with telephone numbers…
I have a Sip trunk with 10 channels…
I’m creating a call file for each number and parking them on temporary directory.
I wish i could count Sip channels in use or ringing and feed asterisk spooling directory with call files with the exactly number trunk could manage…
So i’ll have to make several bash scripts…is there a better way to do so?

Use the GROUP and GROUP_COUNT functions to limit the number of calls out your trunk

https://wiki.asterisk.org/wiki/display/AST/Function_GROUP

https://wiki.asterisk.org/wiki/display/AST/Function_GROUP_COUNT

Set MaxRetries and RetryTime in your call files so that the calls will retry until they succeed

http://kb.digium.com/articles/FAQ/How-to-use-an-Asterisk-callfile.