Last month I have been discussing with some customers about configuring its PBX. They want to allow all the traffic in their country but premium numbers. Premium numbers are those that the caller is billed when a call is done. In short, those are the 1-900 in North America. If your VoIP company doesn't have a way to secure the payment from a customer where a premium call is done, it may be a good idea to block them; premium rates are quite high.
In the case of North America, it is quite easy, maybe it is easier if you do a regular expression such as /^\+?1?900\d{6}$/ which will block all the premium numbers. However, if you do not live here or you want to block more things or your country doesn't have an easy breakdown, this could be a difficult task.
Fortunately for everybody, FreeSWITCH supports PCRE regular expressions and PCRE-regular expressions have a way to specify negative conditions.
The first step is to find what you want to forbid. This request was to forbid all premium numbers so I quickly researched (for the sake of this document I won't put a long list).
There are countries with way more complex breakdowns.
If you are doing by country, you can use these:
Want to do a test, look:
This email address is being protected from spambots. You need JavaScript enabled to view it.> regex 34904123456|^34(?!(90[1-9]))
false
This email address is being protected from spambots. You need JavaScript enabled to view it.> regex 34900123456|^34(?!(90[1-9]))
true
Easy right? Pay attention to the ?! operator that indicates that everything will pass but those numbers. You can also concatenate everything in a single expression. That's your homework. European people may want to allow any call that goes to Europe (fixed and mobile) but premium numbers, this is one case where the negative conditions become very useful.
Good luck!
blog comments powered by DisqusAbout
Read about IT, Migration, Business, Money, Marketing and other subjects.
Some subjects: FusionPBX, FreeSWITCH, Linux, Security, Canada, Cryptocurrency, Trading.