How to make a whitelist of numbers for a specific extension?

I need to allow only 5 numbers to be called from one of my extensions… Is there an easy way to do it in FreePBX ?

There are multiple options, from using the custom-context module, to putting in some custom dialplan code by hand, to doing some ‘kludges.’

If using 2.7 (won’t work before 2.7), you could do the following, assuming your restricted extension number is 7001:

  1. Create your first route as your emergency route (I always do this, standard practice for a lot of good reasons, and put in any such numbers for both this and other extensions.

  2. Create a route with the following dial patterns:
    2125551212/7001
    1215551213/7001

etc. where the first part is the numbers you are allowing

  1. Create a route with the following dial patterns:
    X./7001

and point it to a bogus trunk (or get fancy crating a custom trunk that ends in a message of your choosing).

  1. Create the rest of your routes for other phones after this point.

The net result of this is that your emergency route will always be first so there are never any errors. The next 2 routes are limited to just the desired extension, the third route assuring that anything not caught in the first two results in failure for that extension. All other extensions will bypass these two and move on to the fourth where they will proceed as normal.