GOOD NEWS FreePBX Swiss Army Knife Module

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
Version: 2.0
Updated: 7-27-2011

This is a simple module I created to help supplement some missing/requested features by users for FreePBX. Though I am an active developer for FreePBX this module is not supported by FreePBX

Right now this module allows you to:
  • (NEW)Reg-Exp White/Black List
  • Export a CSV file of your Dial Patterns from your Outbound Dial Plans to use in importing into other Dial Plans on other machines or for your own personal use
  • Use Old Textbox Dial Patterns for Outbound Routes (all of the prefix(|), callerid(/) and prepends(+) work as you fondly remember them from the pre 2.8 days.)
  • A Modified Blacklist Module that allows you to enter any value not just numbers

outbound_r.jpg


As time goes on I will add more requested features. Or you can request more here.

All settings can be changed under Tools -> Swiss Army Knife!! -> Advanced Settings

Note: You HAVE to go to the 'Blacklist (Modified)' module under tools under 'Swiss Army Knife!!' to add any value to blacklist. I did NOT modify the default Blacklist module and you will still have to have it enabled for the blacklist features to work. :)

Download from Here: http://www.the159.com/sak/sak-latest.tgz
Repo Here: https://github.com/tm1000/freepbx-swiss-army-knife (Feel Free to Fork and then submit Pull Requests)
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
I wrote this under FreePBX 2.9 so I'll check under a 2.8 distro right now

Great news. Thanks a lot for this.

Questions:
  1. I'm using FreePBX 2.8, Installed the module, enabled the two checkboxes under tools, SAK, Settings but I don't see any change under outbound routes/trunks. How do I access the pre 2.8 dial rules entry method?
  2. Going to Tools, SAK, blacklist, entering 'asterisk' in the Number/Name field and clicking submit results in this error: "The section you requested does not exist or you do not have access to it."
Lorne
 
Joined
Jun 29, 2009
Messages
258
Reaction score
0
Didn't attempt to change the entry method (yet, but I will!), but the CSV export works great under 2.8. I can, however, confirm the blacklist issue. I trust you'll be able to address the issues, so, thank you SO MUCH for this, this addresses some of my main concerns about recent versions of FreePBX!
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
Ok all fixed now in 1.0.1

http://www.the159.com/sak/sak-1.0.1.tgz

lgaetz, I believe you didn't see the options because how I had the display setup was really confusing on certain systems depending on how FreePBX loaded other modules and in what order. I didn't notice that until I loaded it on another system. Should be much better now.

The blacklist issue was an dumb error on my part that has now been fixed.
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
hmmmm. Yes, FreePBX actually strips your + and | out. I'll have to add some code in there to parse it but first I need to ask

1. The numbers before the + are what? Prefix?
2. The numbers before the | are what? Prepend?
3. How would a number with Prefix & Prepend look?

Confirmed, blacklist entry working as expected and the dialplan field is now available in Outbound Routes. I havn't done any actual testing yet but I found another minor issue tho. The existing FreePBX 2.8 dial plan rules got imported into the SAK without the prefix and prepend digits. Example, I have pre SAK rules that look like this:
Code:
NXXNXXXXXX
902+NXXXXXX
1|NXXNXXXXXX
but SAK imports them as:
Code:
NXXNXXXXXX
NXXXXXX
NXXNXXXXXX
Not a serious issue, I can manually go thru my rules and clean them up. The second rule edited properly, I was able to add the '902+' with no problem but when trying to edit the last rule to this:
Code:
1|NXXNXXXXXX
I hit submit and FreePBX always changes it to this:
Code:
1NXXNXXXXXX
Lorne
 

darmock

PIAF Developer
Joined
Oct 18, 2007
Messages
2,892
Reaction score
98
I wish to extend our thanks to tm1000! We really really really appreciate his hard work. His swiss army knife is just what was needed. We hope you continue to expand it.

I must say it is nice when these little problems get fixed without having to write a book about why we need it etc etc....

Thanks!

Tom
 

dward

Guru
Joined
Nov 1, 2010
Messages
4
Reaction score
0
I am not sure if this is how you want to handle this, but I've created a fork of your code on github and have submitted a pull request for some changes that adjust the display and parsing of numbers with prepend/prefix/callerid.
 
Joined
Jun 29, 2009
Messages
258
Reaction score
0
tm1000, you are my hero! :biggrin5:

Regarding the patterns, let me give you an example. Suppose I have a rule that looks like this:

Example%20dial%20pattern.png


I might use this if I wanted to send international calls to a European carrier that requires an "00" prefix rather than "011", AND I wanted to restrict use of this route to extensions 200 through 299.

Here is how it should be written into the text box:

00+011|x./_2XX

Note the underscore before the extension pattern. This gets a bit tricky because technically if it's a single extension rather than a pattern then the underscore should be omitted, such as:

00+011|x./234

Naturally you only need to include the separators if the field is not empty. So If the first field is empty you don't need the +, if the second is empty you don't need the | and if the last is empty you don't need the /

Note it is possible to have a "full replacement" rule with no third field at all. For example, let's say you had a user in Minnesota on extension 444 and when they dial 811 you want it to go to Gopher State One Call. So, in your "Toll Free" route (or a special route you have set up just for such translations), you might include a rule that looks like this:

18002521166+811|/444

So if the user of extension 444 dials 811, it will translate it to 18002521166 before sending it to the trunk(s). This is a perfectly valid rule, even though there is "nothing" in the third field.

Hope this helps!
 

darmock

PIAF Developer
Joined
Oct 18, 2007
Messages
2,892
Reaction score
98
Allowing block of CallerID names in Blacklist module is already taken care of: freepbx.org/trac/ticket/5207

tm1000, I see that you are still editing with a mac computer:cool:
Wonderful of course the patch is only for the 2.9 tree. Where as the SAK works on 2.8 which is what the majority of our users have installed. I can't see forcing everybody to upgrade for a single feature enhancement.

Of course PIAF now comes with a CLI version that does the same thing that the SAK does for blacklist. We won't attempt to duplicate the other features he has so graciously provided to us with a minimum of fuss. I thought you had left our forums good to see you back.


Tom
 
Joined
Jun 29, 2009
Messages
258
Reaction score
0
Allowing block of CallerID names in Blacklist module is already taken care of: freepbx.org/trac/ticket/5207

That won't help us users of FreePBX 2.8, or FreePBX 2.9 users, unless you decide to backport (and since you guys still haven't backported CSV upload to 2.8, I'm not holding my breath).

And, you outright refused to even consider giving us back the pre-2.8 method of entering dual patterns. So in my opinion this is a MUCH needed module. We need more developers like tm1000 and fewer like… never mind, I'm not going there.
 
Joined
Jun 29, 2009
Messages
258
Reaction score
0
Wonderful of course the patch is only for the 2.9 tree.

Actually, unless I'm reading it wrong, it's only implemented in 2.10 (note where it says Milestone: 2.10). But maybe I'm wrong, their ticket system can be a bit confusing at times.
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
Yes this is exactly how I wanted it done! It's why I love github! You don't have to be part of a project to help out. :)

I'm assuming this will do the parsing correctly as stated by others above.

I am not sure if this is how you want to handle this, but I've created a fork of your code on github and have submitted a pull request for some changes that adjust the display and parsing of numbers with prepend/prefix/callerid.
 

dward

Guru
Joined
Nov 1, 2010
Messages
4
Reaction score
0
I'm assuming this will do the parsing correctly as stated by others above.

It should :wink5:

Whatever the text has is what will be used, so if an _ is wanted in the callerID then it needs to be entered in the text (my dialplans do not currently use that).

If anyone finds cases that fail let me know and I'll see about adjusting things.
 

dward

Guru
Joined
Nov 1, 2010
Messages
4
Reaction score
0
For this one case, where the rule is all prefix and prepend, can you place a period in the spot where the missing phone number would be. i.e:

18002521166+811|./444

As a period is a wildcard in the dial rules, it would not be clear if the . was intended as part of the dial string (allowing 8114321) or not.
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
Everyone,

Thanks to the wonderful efforts by dward all of the prefix, callerid and prepends work as you fondly remember them from the pre 2.8 days.

Here is the new download (or you can use the link in the original post)

http://www.the159.com/sak/sak-1.1.0.tgz
 
Joined
Jun 29, 2009
Messages
258
Reaction score
0
For this one case, where the rule is all prefix and prepend, can you place a period in the spot where the missing phone number would be. i.e:

18002521166+811|./444

I think that might make it easier to code.

Lorne

Not according to to the page at http://www.voip-info.org/wiki/view/Asterisk+Dialplan+Patterns :

. wildcard, matches one or more characters​

(emphasis added)

The same page reveals a better possibility:

! wildcard, matches zero or more characters immediately​

But I don't know offhand if that would actually work in this situation.
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
I can confirm that in FreePBX 2.9 FreePBX strips the '_' in CallerID, so I will have to investigate that further as the way this works right now SAK is like a middle man and sends modified data to the 'dial plan wizard'.

This is because the 'dial plan wizard' actually runs last (unfortunately)

Edit: Quickly reviewing the posts above, is the _ needed?

Unfortunately I am not in a position to test, but my understanding is that FreePBX 2.8 will not allow an underscore to be used in the CallerID field and will in fact strip it out if you try to put it there. MT maybe can confirm this, based on this exchange we had in the comments of his blog post.

Lorne
 

Members online

No members online now.

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top