GROUP() Function

Hi,
I think I need to use the GROUP() function, in order to limit the calls going out a specific SIP Trunk. My question is I need to limit both in and out bound traffic on the trunk. I would like to limit it to 20 calls. Since my inbound and outbound calls hit different contexts in my dialplan, how do I keep the count going and monitoroing in/out traffic.

Rough example.

GLOBAL VARIABLES
MAXCALLS = 20

[OUTBOUND]
exten => _N.,1,Set(GROUP()=TRUNK1)
exten => _N.,n,(GROUPCOUNT=${GROUP_COUNT(${TRUNK1})})
exten => _N.,n,GotoIf($[${GROUPCOUNT} > ${MAXCALLS}]?104)
exten => _N.,n,Dial(SIP/VOIPCALLS/${EXTEN},r)
exten => _N.,104,BUSY()

[INBOUND]
exten => s,1,Set(GROUP()=TRUNK1)
exten => s,n,(GROUPCOUNT=${GROUP_COUNT(${TRUNK1})})
exten => s,n,GotoIf($[${GROUPCOUNT} > ${MAXCALLS}]?104)
exten => s,n,Dial(SIP/2000,r)
exten => s,104,BUSY()

I need the combined OUTBOUND and INBOUND calls not to exceed 20. I do not think my dialplan logic will work, any info will be great.

Thank you,
Chris