📜 ⬆️ ⬇️

Spam protection at 8800 in FreePBX

Greetings, asteriskers and sympathizers! Yesterday night, at a popular asterisk forum, I came across the question: how can you “quickly” protect your 8800 number from a technique that is often used by competitors - by dialing a number to trigger the billing number?

The operator of numbers 8800, whom I advise my clients, takes 2.42 rubles per minute with per-minute billing, and 2.89 rubles per minute with per-second. With a second, of course, everything is easier, but also unpleasant. In one minute you can make at least 10 calls, which will be written off from the balance of the owner of the number almost 15 rubles. In an hour it will be 900 rubles, and this if in one stream. In general, the problem is obvious.

The solution was found simple, by tradition, everything is done from the FreePBX webmoney. We will need the Smart Routes module, which I mentioned in the previous publication , and you can download it there.

The logic is simple - we look for the last calls from the current number in the CDR, and if there are more than X in Y minutes, we reset the call.
')
The request in the module is simple:

SELECT count(`calldate`) FROM `cdr` WHERE (`src`='${CALLERID(number)}') AND (`calldate` BETWEEN NOW() - INTERVAL 5 MINUTE AND NOW()) 

As you can see, the interval is specified here, in the request. The query will select the number of calls from the current number in the last 5 minutes and display them in the resulting field in one line.

We need to set the Match Type in LESSER, by coincidence - go to the point we need, set Failover, for example, in Terminate => Hangup. It is in this field that the number of allowed calls from the current number for the interval specified in the request is configured.

Default Destination is also reset.

It looks like this:

image

It remains to send calls to the Smart Routes module in the incoming rules and that's it!
Good luck and fewer inadequate people on your way.

Source: https://habr.com/ru/post/309348/


All Articles