[asterisk-users] [FIXED] Re: call-limit on a per destination basis
Klaus Darilion
klaus.mailinglists at pernau.at
Fri Feb 27 09:54:26 CST 2009
Just a tip: throw extensions.conf away and use extensions.ael - much
more easy:
_0262XXXXXX => {
Set(GROUP()=Reunion);
if( ${GROUP_COUNT(Reunion)} > 24) {
NoOp(Total channels congested, retuning NOCAV);
Congestion();
} else {
NoOp(This channel is member of group: ${GROUP()});
NoOp(Number of channels is ${GROUP_COUNT(Reunion)});
Set(SPYGROUP=1003);
Dial(IAX2/dedibox-etang-sale/${EXTEN});
Congestion();
}
Further, I would use a macro:
macro checkMaxCallsMakro(groupid,limit) {
if ( ${GROUP_COUNT(${groupid})} >= ${limit} ) {
NoOp(ERROR: Limit ${hardlimit} reached for ${groupid}!);
Hangup(34); //Cause No. 34: no circuit/channel av. (SIP 503)
}
Set(GROUP()=${groupid});
}
context foobar {
_0262XXXXXX => {
&checkMaxCallsMakro(Reunion,24)
Set(SPYGROUP=1003);
Dial(IAX2/dedibox-etang-sale/${EXTEN});
Congestion();
}
}
regards
klaus
Jean-Michel Hiver schrieb:
> The correct syntax for GotoIf is:
>
> exten => _0262XXXXXX,n,GotoIf($[${GROUP_COUNT(Reunion)}>24]?500)
>
> Otherwise it seems to evaluate the string "number > 24" which is always
> true.
>
> Duh...
>
> Thx
> JM
>
> --
> Jean-Michel Hiver - Synapse co-founder & CTO
> GSM +262 692 828 070
More information about the asterisk-users
mailing list