Global SIP call limiting, how?

Using Asterisk 1.2.9.1
Freepbx 2.1.2
(a 3-year old stable install and still going strong!)

We need a way of limiting call sessions across the entire pbx via SIP trunks?

Currently we have enough bandwidth for 9 calls concurrently (total, including in and outbound), and until now we haven’t reached this for it to cause problems if we receive too many calls for capacity - but we want to put a solution in place in the event that it happens (someone could effectively DOS our phone system if they bombarded us with calls maliciously).

How can this be done, we’d like any calls past 9 to be given Busy.

We tried setting ‘Maximum channels’ in the trunk config but the system seems to ignore this and allows calls to progress past the stated limit?

Our * box is old now and many of you would say needs upgrade, but it works well for our needs - however if this global call limiting is a specific feature in a later version we will use that opportunity to upgrade!

Many thanks.

you will have to have a look at the GROUP() and OUTBOUND group functions/channel variable. You will need modify the outbound and inbound dialplans so that every call is counted against a single group (in addition to the counting going on now).

Then you will have to stop outbound calls, and send inbound calls to busy and hangup when that global group count is met.

Thanks Philippe for a quick reply - unfortunately we are not fully * literate in doing advanced stuff, would you be able to link us to an example to implement or post a config to the forum for us (and the benefit of others wanting to do the same) please?

have a look at the current dialplan on how it does per trunk nums, and have a look at the 2.5 or 2.6 version, for both inbound and outbound channels. Then you should be able to extrapolate from there.

The example is effectively in the current code…

I found this in the trunk dialout macro;

exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = “foo”]?nomax)
exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
exten => s,n(nomax),AGI(fixlocalprefix)

How can anything be altered when Freepbx will overwrite changes (we’ve tried things like this before).

Again, we have no knowledge of scripting this way so it is plain puzzling to us! ;(

Surely we can’t be the only people who hope daily their Asterisk doesn’t get flooded with calls with no easy GUI option to limit them in Freepbx.

Thanks.

So… I am going to take the plunge and upgrade our box to the latest Trix version in the hope the ‘Maximum channels’ in trunk settings will limit the calls, it certainly doesn’t stop incoming calls in our current version, whether this was a bug in the early release I don’t know - I am hoping it is just that.

Can anyone confirm that setting the maximum channels for a trunk definately works for limiting incoming calls on that trunk (as well as outgoing)?

Thanks.

can’t say for tb, but in FreePBX, if you use the auto-generated inbound context then it will count inbound and outbound calls. (However over the max channels tooltip to get details). It won’t ever stop inbound calls, it just counts them against the total so that your outbound limit will take into account the inbound count.