Ticket #3301 (new Feature Requests)

Opened 5 years ago

Last modified 4 years ago

Simplified translations/restrictions module

Reported by: wiseoldowl Assigned to: p_lindheimer
Priority: minor Milestone: Undetermined
Component: Core - Trunks/Routing Version:
Keywords: Cc:
Confirmation: Unreviewed Distro:
Backend Engine: All Distro Ver:
Backend Ver: SVN Revision (if applicable):

Description

I'm just going to throw this out there and see if anyone else thinks it's a good idea. A lot of FreePBX users are using the Custom Contexts module when it's overkill for what they really want, which is number translations and restrictions on a per-extension or per-group-of-extensions basis. So I will propose a simplified module that creates translation/restriction sets. In the extensions configuration, each extension could optionally specify one (and only one) pre-defined translation/restriction set, using a drop-down menu. The set chosen would affect outgoing call placed by that extension only, and would never affect incoming calls. Other than extensions, the only other thing this module might possibly interact with is DISA, since it also allows outgoing calls.

The new module would allow users to create translation/restriction sets. Each set would filter outgoing calls based on dial patterns BEFORE those patterns are sent to the outgoing route logic. On the translation/restriction set page, each filter would be added one at a time (press submit after each addition) and existing filters would be displayed with a checkbox next to each; you could click a checkbox and then a DELETE button to delete existing filters. There would also be a place to name the translation/restriction set (this would then appear in the dropdown on the extension pages) and also a "destination if call blocked" selection area (which would show all the standard destinations known to the system).

When adding a new filter, there would be two text fields, one for the number to be matched - this would be the actual number that the user might dial - and the second box would be for the translation, if any. Some examples might be in order:

1XXXXXXXXXX | (Blank entry) - deny access to any 11 digit number starting with 1

1800NXXXXXX | # - If found in the second field, # would override any restriction for numbers matching that pattern, in other words this would say that calls to 1-800 numbers may go through despite the presence of the filter in the previous entry.

411 | 18005551212 - if 411 is dialed, translate it to 18005551212 (this is just an example, not something you'd actually want to do)

911 | (full 11 digit number for local 911 center) - this could be used if you have a remote extension and know the appropriate 11 digit number for their local 911 answering point (e.g. the one that the smaller cell phone companies use when sending calls to that 911 center).

As you can see, this is a very simplified pattern matching system. The first field can contain either a number or a pattern. The second field can contain a number, a # (which means to pass numbers matching the pattern unchanged despite any other less specific rules) or be blank, which means that call should go to the "blocked calls" destination.

Possible enhancements on the basic idea:

Now there is another thing that could be added to this, though I only throw this out as an "if it takes less than five minutes to code" idea, because probably not that many people would use it, but those who might want it would really appreciate it. And that is, you add a third field to set the outgoing caller ID. If left blank, it takes the Caller ID set by the extension, but if it is set then on calls matching the pattern in the first field it sets the outgoing Caller ID to the name and number in the third field. So you could do something like this:

1212NXXXXXX | # | My Big Company <2125552368> - to show your company's local 212 number on calls to the 212 area code

911 | (full 11 digit number for local 911 center) | {another local number at same location that is already in 911 database)

The beauty of this (I think) is its simplicity -- it simply sits as a shim in the outbound call flow and does nothing but number translations/restrictions. If you don't want someone to have access to a particular route, you simply include the same dial pattern definitions that are in that route (or something a bit more generic). Note that this is not nearly as flexible as Custom Contexts - for example, as described so far, you could not send some extensions to one route for a particular pattern and others to a different route. However, if you wanted that flexibility, an easy way to add that would be to allow digit prepending in the second field - this would increase the complexity of the code a bit, however. As an example:

1NXXNXXXXXX | 000001+#

In this example, whatever is before the + sign would be prepended to the original number (indicated by the #) before it is sent to the route logic. Now you could create a route that looks only for patterns starting with 000001 and strips those digits before sending the call to a trunk. So in this example, any call to a NANP number could be sent to a route that ONLY accesses "free" or low-cost trunks, and the route would strip the 000001 before sending to the trunk (using 000001|1NXXNXXXXXX in the dial pattern, for example).

The biggest advantage to this method is you don't have to worry about the priority drop-downs as you do in Custom Contexts, and also this is a far simpler method of achieving what (I would guess) the majority of Custom Context users really want, which is to be able to set up number translations or restrictions for a single extension or a group of extensions. By creating these definitions in such a way that they can be easily applied to one or more extensions, you would gain much additional flexibility.

One additional suggestion - On the page for each translation/restriction set, include a "clone" button that would simply create a new translation/restriction set already populated with the same data as the page you are on - that way, if someone builds a set with a number of entries and then only has to change one or two items for a particular extension, they don't have to re-enter all the data.

Also, I have suggested using two or three text boxes to enter each new filter: One for the number or pattern to match, one for the translation (which is left blank of the call is to be blocked), and perhaps one for a changed Caller ID (if relatively trivial to include). This would allow more "sanity checking" on each item, at the cost of not allowing the mass copying of filters from one FreePBX installation to another. There may be a better way to enter the filters, particularly in large installations, so I will just say upfront that it matters not to me how these filters are actually entered, as long as they can be.

Just an idea, and please keep in mind that some users probably would prefer to keep using Custom Contexts so it's not my intention to "break" that module. It's just my impression that Custom Contexts offers too much flexibility for some users and is a bit daunting to set up and maintain, particularly when you have to explicitly set a priority for each item.

Change History

(follow-up: ↓ 3 ) 10/19/08 15:43:57 changed by mbrevda

is this the same/related to #669, #1690?

10/20/08 00:28:14 changed by p_lindheimer

  • milestone changed from 2.5 to 3.0.

(in reply to: ↑ 1 ) 10/20/08 05:36:13 changed by wiseoldowl

Replying to mbrevda:

is this the same/related to #669, #1690?

Closer to #1690 than #669, but #1690 wants to make Custom Contexts part of core. Which I actually would not have a problem with, if there were some way to get rid of the priority drop-downs (or at least make their use optional). However, as I said above, I think that Custom Contexts is overkill for many users - it's difficult for them to understand the concept and how it "fits in" with the rest of FreePBX. If ALL you want to do is restrict extensions from calling certain numbers, or translate certain numbers to other numbers then you really don't need the functionality and complexity of Custom Contexts. To put it in programming terms, there's no reason people should have to learn a high level programming language to accomplish something that could be easily handled with a few lines in a bash script, and similarly, there's no reason people should have to worry about setting a whole list of priorities from dropdowns if all you need is something that will look at the called number and block or translate it accordingly.

I'm speaking from experience, by the way - I was a big supporter of Custom Contexts when it was first released and I used it here, but quickly found that it was a real chore to create a new context because of all the dropdowns, plus if you added or deleted a route, or moved a route up or down in priority in FreePBX you still had to go back in to every single one of your Custom Contexts and make sure that the priorities were changed there. That might mean you'd spend anywhere from several minutes to the better part of an hour messing with unwieldy dropdowns, just because you wanted to make a simple routing change. Computers are supposed to simplify your life, not make it harder, and those priority dropdowns were the thing that made us stop using Custom Contexts when we recently did a complete reinstall/upgrade. It was just too much pain for too little gain. Even so, it would be great to have a simple, uncomplicated way to do restrictions and translations on a per-extension (or per-group-of-extensions) basis, and that's what I'm attempting to propose here. Also, the same filtering logic could be applied to things like DISA access. It's really a totally different approach from the two tickets you mention, though it some cases it may offer a different (hopefully simplified) path to the same end result.

10/20/08 05:44:06 changed by mbrevda

I think you forgot the </end rant> :) Seriously though - I wasn't sure what you were aiming at, so I didn't close the ticket as a dup. Thanks for clearing things up!

12/22/08 14:09:04 changed by wiseoldowl

See also Ticket #3450 for another possible approach that may (or may not) be easier to implement - it would not be quite as versatile as what I suggested above (in particular it would not allow changing Caller ID on certain outgoing calls), but perhaps it would be something that someone's actually willing to code because of the relative simplicity.

02/13/09 08:49:17 changed by rjenkinsgb

See also Ticket #3035 - similar request, limit which trunks an extension may use.

08/18/09 17:56:19 changed by p_lindheimer

  • version deleted.
  • milestone changed from 2.6 to 2.7.