details can be seen here: http://freepbx.org/forum/freepbx/users/maximum-channels-not-working-with-sip-trunk
The Asterisk GROUP_COUNT() function is not defaulting to the current default group as defined in the Set(GROUP()=OUT_${ARG1}) statement.
This is really an Asterisk Bug but this provides a fix that will work around it.
The following will force it to work and should be fine even when the Asterisk is fixed.
Index: extensions.conf
===================================================================
--- extensions.conf (revision 5137)
+++ extensions.conf (working copy)
@@ -675,7 +675,7 @@
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS})
exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
exten => s,n(skipoutcid),GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax)
-exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
+exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
exten => s,n(nomax),AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}) ; OUTNUM is the final dial number
exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)}) ; Custom trunks are prefixed with "AMP:"
@@ -767,7 +767,7 @@
exten => s,n,Macro(outbound-callerid,${ARG1})
exten => s,n,Set(GROUP()=OUT_${ARG1})
exten => s,n,GotoIf($["${OUTMAXCHANS_${ARG1}}foo" = "foo"]?nomax)
-exten => s,n,GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${ARG1}} ]?nochans)
+exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} > ${OUTMAXCHANS_${ARG1}} ]?nochans)
exten => s,n(nomax),Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK=${ARG1})
exten => s,n,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk