Howto block Offshore/premium-rate numbers


#1

I’ve had so many friends and customers get stung by this, I thought I would put out a quick howto for blocking U.S. offshore and premium rate numbers numbers in FreePBX.

Overview
There are expensive phone desitnations that can be dialed directly with what looks like a normal US interstate phone number; 1-XXX-XXX-XXXX. Here I will describe how to specifically block certain area codes while still allowing other North American direct dialed destinations in the FreePBX dialplan.

The Problem
You are configuring a FreePBX managed PBX and you want to allow domestic calling but want to block all international calling. The simple and concise way to do that is create a FreePBX route that only allows for ten digit direct dialed numbers. In FreePBX, you can specify a pattern match like this; “1NXXNXXXXXX” . Unfortunately your still at risk of calls to premium-rate locations like 1-900- or offshore international numbers like Bahamas 1-242- or places you may have never heard of like Montseratt 1-664-. You really have two main choices. You can either explicityly add the area codes you want to route to, or create route matches to the places you don’t want to route and then send those calls to a bogus (unroutable) trunk. In the latter case, your not preventing the call from being dialed but you are blocking the call from completing.

Blocking by Routing
As explained above, you can selectivly block a desitnation by explicitly match on the dialed number pattern and then sending that call to a FreePBX trunk that does route anyplace at all. So, the first step is to create your trunk to nowhere.

In FreePBX, go to the “Trunks” dialog. Choose the “Custom Trunk” type. Name it something informative like “BlockedTrunk”. In the “Custom Dial String” field fill in something like “FAILEDROUTES”, or other undialable string. Hit the “Submit Changes” button, and apply the changes when prompted.

Next step is to create a FreePBX route that will include all the match patterns that you want to block. Go to the “Outbound Routes” dialog and add new route. Name the route “Blocked Routes”, then go to the “Dial Patterns” section. You can add the specific patterns manually, or upload a CSV list of the patterns using the “Dial patterns wizards” dialog. Be aware that CSV uploaded lists will replace any patterns you have in this route! There is an example CSV for blocking international and premium numbers below. The last step is to set the “Trunk Sequence” for this route to use your bogus trunk created earlier. In this example it was “BlockedTrunk”. Submit and apply your changes.

The final step is to consider all the dialplan routes. If you have a route for emergency calling (911), that should generally go first. Then you might have a specific route for local calls. Local calls would match on for example the local direct dialed are code. Place the BlockedRoute next. Then what would follow is the rest of your lond distance calling route(s). Since FreePBX matches on the first match, by placing the BlockedRoute ahead of the regular LD routes, your effectively blocking them.

Cautions, Tips and Tricks

Usually outbound dial routes are matched with the first match, so ordering of the routes matter!
You should never have an outbound route in PBX that is simply “1.”. That would allow all direct dial numbers starting with “1”, including the previously described premium-rate numbers.
If you don't have a route for international calling, in most cases it can't be called. By not adding any “011.” patterns, you are implicitly blocking such calls.
With the previous logic in mind, you can of course make dialplans that only allow specific destinations. For example, if you only want to make LD calls in the state of Oregon, you would have routes for “1503NXXXXXXXXX”, “1541NXXXXXXX” and “1971NXXXXXXXX”.
FreePBX includes a mandatory account code “PIN Codes”. You might consider using them as a way to add security and accountability to premium-rate numbers. There is also a “Route Password” PIN code, although that provides security, there is no accountability since it would need to be shared with all the users who need it. 

Disclaimer and Warnings
The opinions and notions here are those of the author alone. They do not represent the policies or opinions of my employer or its affliliates. There is no gaurantee that the materials presented here will be effective. Changes in a PBX dialplan can cause the phone system to be unusable and otherwise fail. Ulitimately you are responsible for the security and maintenance of your PBX and phone systems. In all cases seek the advice of a qualified or PBX certified professional if you require assistance.

References

Premium-rate numbers: http://en.wikipedia.org/wiki/Premium-rate_telephone_number#United_States...
Introduction to North American Numbering Plan: http://en.wikipedia.org/wiki/North_American_Numbering_Plan
NANPA website: http://www.nanpa.com 

Appendix A
Here is an example of premium-rate and international offshore numbers in a form that you can upload to FreePBX as a Comma Seperated Value (CSV) list. You will need to review the list and decide for yourself whats the appropriate list to block. See NANPA and Wiki resources in the References section.

,1900xxxxxxx,
,1976xxxxxxx,
,1242xxxxxxx,
,1246xxxxxxx,
,1264xxxxxxx,
,1268xxxxxxx,
,1284xxxxxxx,
,1345xxxxxxx,
,1441xxxxxxx,
,1473xxxxxxx,
,1649xxxxxxx,
,1664xxxxxxx,
,1721xxxxxxx,
,1758xxxxxxx,
,1767xxxxxxx,
,1784xxxxxxx,
,1809xxxxxxx,
,1829xxxxxxx,
,1849xxxxxxx,
,1868xxxxxxx,
,1869xxxxxxx,
,1876xxxxxxx,

Copywrite 2013 by Jay D. Allen. All rights reserved


Blocking 900 Etc Numbers
#2

Instead of dropping the call without explanation, you can take a few extra steps to play a message.

On the System Recordings page, select Built-in Recordings and build a recording using these settings:

  • Name: Blocked
  • Descriptive Name: "We are sorry, the number you have dialed is currently unavailable. Please contact technical support."
  • Files:
    • sorry
    • the-number-u-dialed
    • is-curntly-unavail
    • please-contact-tech-supt

On the Announcements page, create a new announcement:

  • Name: Blocked
  • Recording: Blocked
  • Destination After Playback: Terminate call (Congestion)

On the Misc Applications page, create a new application:

  • Name: Play blocked message
  • Feature Code: *999
  • Destination: Announcements (Blocked)

Finally, go back to the Trunks page and change the Custom Dial String to Local/*999@from-internal on the Blocked trunk created earlier. The application can also be tested by dialling *999 from any phone on the system.


(system) closed #3