Concorrent call limiting on iax2 and sip trunks

I have a master asterisk pbx system 1.4.25 ubuntu 8.04 which call routes a bunch of sub systems and I need to limit the amount of calls each sub system can make at one time so that one of them doesn’t use up all the sip trunks that we have. Most if not all the sub systems are 1.4.25 asterisk with ubuntu

How would I go about doing concurrent call limiting based on trunks ?

I’ve tried the following config , but I don’t know how it works exactly

maxcallnumbers = 5

[thisperson]
allow=ulaw
type=friend
host=a-dns-name
trunk=yes
secret=mysecretsecret
context=incoming_thisperson
deny=0.0.0.0/0.0.0.0
permit=an-ip-number/255.255.255.255
maxcallnumbers=5

Specify ‘call-limit=100’ (or whatever value makes sense) for the SIP peer. You may also need to set ‘limitonpeers=yes’ in the general section of sip.conf. I believe you will need to go a different route for IAX since I don’t believe it has those options like sip.conf.

Use the GROUP() and GROUP_COUNT() dialplan functions to limit calls to end points (or groups of end points).