GOOD NEWS FreePBX Swiss Army Knife Module

Discussion in 'PIAF 3 Add-Ons' started by tm1000, Jul 11, 2011.

  1. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    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

    [​IMG]

    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)
     
  2. briankelly63

    Joined:
    Nov 14, 2008
    Messages:
    1,401
    Likes Received:
    319
    GREAT! Thx for the contribution....

    Brian
     
  3. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    I wrote this under FreePBX 2.9 so I'll check under a 2.8 distro right now

     
  4. MichiganTelephone

    Joined:
    Jun 29, 2009
    Messages:
    258
    Likes Received:
    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!
     
  5. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    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.
     
  6. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,412
    Likes Received:
    2,448
    The Hostage Crisis is Over :)

    [​IMG]
     
  7. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    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?

     
  8. darmock

    darmock PIAF Developer

    Joined:
    Oct 18, 2007
    Messages:
    2,892
    Likes Received:
    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
     
  9. mickecarlsson

    Joined:
    Oct 16, 2008
    Messages:
    94
    Likes Received:
    0
    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:
     
  10. dward

    dward Guru

    Joined:
    Nov 1, 2010
    Messages:
    4
    Likes Received:
    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.
     
  11. MichiganTelephone

    Joined:
    Jun 29, 2009
    Messages:
    258
    Likes Received:
    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:

    [​IMG]

    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!
     
  12. darmock

    darmock PIAF Developer

    Joined:
    Oct 18, 2007
    Messages:
    2,892
    Likes Received:
    98
    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
     
  13. MichiganTelephone

    Joined:
    Jun 29, 2009
    Messages:
    258
    Likes Received:
    0
    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.
     
  14. MichiganTelephone

    Joined:
    Jun 29, 2009
    Messages:
    258
    Likes Received:
    0
    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.
     
  15. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    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.

     
  16. dward

    dward Guru

    Joined:
    Nov 1, 2010
    Messages:
    4
    Likes Received:
    0
    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.
     
  17. dward

    dward Guru

    Joined:
    Nov 1, 2010
    Messages:
    4
    Likes Received:
    0
    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.
     
  18. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    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
     
  19. MichiganTelephone

    Joined:
    Jun 29, 2009
    Messages:
    258
    Likes Received:
    0
    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.
     
  20. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    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?