Jean-Michel Hiver
2009-Feb-26 10:59 UTC
[asterisk-users] call-limit on a per destination basis
Hello,
I use asterisk to to IAX2 trunking between London POP & Reunion Island pop.
I would like to know if it's possible to do a kind of call-limit (i.e.
restrict to XX) channels but on a per dialcode and / or destination basis.
For example:
[trunk]
; reunion proper, i want to send no more than 24 channels
exten => _0262XXXXXX,1,Dial(IAX2/mytrunk/${EXTEN})
; reunion mobile, i want to send no more than 12 channels
exten => _0692XXXXXX,1,Dial(IAX2/mytrunk/${EXTEN})
exten => _0693XXXXXX,1,Dial(IAX2/mytrunk/${EXTEN})
How would you go about it? Currently my IAX2 peer definition looks like
this:
# machine in london
[mytrunk]
type=friend
host=$reunion_ip
trunk=yes
qualify=yes
context=route
# machine in reunion island
[mytrunk]
type=friend
host=$london_ip
trunk=yes
qualify=yes
context=route
I use version Asterisk 1.4.11, production environment currently doing 25,000
minutes / day (that means if i want to upgrade i need to do it on separate
servers just in case something goes wrong).
Cheers,
Jean-Michel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20090226/47d015bd/attachment.htm
Klaus Darilion
2009-Feb-26 11:14 UTC
[asterisk-users] call-limit on a per destination basis
I have no clue about IAX, but if IAX does not support it you can program it yourself using the GROUP and GROUPCOUNT functions. regards klaus Jean-Michel Hiver wrote:> Hello, > > I use asterisk to to IAX2 trunking between London POP & Reunion Island > pop. I would like to know if it's possible to do a kind of call-limit > (i.e. restrict to XX) channels but on a per dialcode and / or > destination basis. > > > For example: > > [trunk] > ; reunion proper, i want to send no more than 24 channels > exten => _0262XXXXXX,1,Dial(IAX2/mytrunk/${EXTEN}) > > ; reunion mobile, i want to send no more than 12 channels > exten => _0692XXXXXX,1,Dial(IAX2/mytrunk/${EXTEN}) > exten => _0693XXXXXX,1,Dial(IAX2/mytrunk/${EXTEN}) > > > How would you go about it? Currently my IAX2 peer definition looks like > this: > > # machine in london > [mytrunk] > type=friend > host=$reunion_ip > trunk=yes > qualify=yes > context=route > > # machine in reunion island > [mytrunk] > type=friend > host=$london_ip > trunk=yes > qualify=yes > context=route > > I use version Asterisk 1.4.11, production environment currently doing > 25,000 minutes / day (that means if i want to upgrade i need to do it on > separate servers just in case something goes wrong). > > > Cheers, > Jean-Michel. > > > ------------------------------------------------------------------------ > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
Klaus Darilion
2009-Feb-27 15:54 UTC
[asterisk-users] [FIXED] Re: call-limit on a per destination basis
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
didier.cuffaut
2009-Feb-28 11:04 UTC
[asterisk-users] [FIXED] Re: call-limit on a per destination basis
Ne manque t il pas des espaces entre } > 24] ????????
----- Original Message -----
From: Jean-Michel Hiver
To: Asterisk Users Mailing List - Non-Commercial Discussion ;
klaus.mailinglists at pernau.at
Sent: Friday, February 27, 2009 2:01 PM
Subject: [asterisk-users] [FIXED] Re: call-limit on a per destination basis
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
------------------------------------------------------------------------------
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20090228/9775007f/attachment.htm