I HAVE A DREAM Command Line Utilities for FreePBX + Drag-and-Drop GUI

Discussion in 'Developers' Corner' started by wardmundy, Sep 24, 2014.

  1. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    Since no one else has volunteered, we are beginning the painful process of creating BASH command line utilities to add extensions, trunks, outbound routes, inbound routes, and perhaps other components such as IVRs, call forwarding, etc. to PBX in a Flash and Incredible PBX. See also our earlier work with Phone Genie for other features we plan to incorporate. Should work fine with other FreePBX 2.11-compatible distros , but I'm not testing them!

    This will be a slow process as time permits. It's even slower because it requires reverse-engineering numerous pieces of FreePBX code to get things to work with and remain compatible with FreePBX 2.11. As (more) time permits, we will rework the basic components to work with FreePBX 12 as well, but the initial releases HAVE NOT BEEN TESTED AND PROBABLY WILL NOT WORK with FreePBX 12!

    If there are other components anyone desperately needs or wants, post a note about what is desired and why. It will then be prioritized on the Wish List. If others wish to contribute GPL2 code, please feel free to jump in.

    [​IMG]

    The long-range objective is to get these command-line utilities built and then hire some off-shore programmers to write a drag-and-drop GUI (see proof-of-concept video) similar to what's available with Anveo, RingRoost, and pbxww.com. See this thread for some examples. See jsPlumb documentation used for proof-of-concept video here. The GUI would hook into these command-line utilities to put the pieces together while remaining compatible with FreePBX. No promises whether it will be GPL2 code or commercial. Kinda depends on the development cost.

     
    ibstelix likes this.
  2. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    Add SIP Extension with NO Voicemail

    Syntax: add-extension-no-vm ext-num ext-pw

    License: GPL2

    Version: 0.002
     

    Attached Files:

    ibstelix likes this.
  3. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    Add SIP Extension with Voicemail

    Syntax: add-extension-vm ext-num ext-pw vm-pw

    License: GPL2

    Version: 0.002
     

    Attached Files:

    ibstelix likes this.
  4. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    Call Forwarding

    Forward Calls Syntax: call-forward ext-num fwd-num

    Cancel Forwarding Syntax: call-forward ext-num cancel/disable/delete

    License: GPL2

    Version: 0.002
     

    Attached Files:

    ibstelix likes this.
  5. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    Create Sample Trunks

    Create Sample Trunks Syntax: create-sample-trunks now

    License: GPL2

    Version: 0.002

    This script should be especially helpful (now) to those installing Incredible PBX for CentOS or Incredible PBX for Ubuntu 14. It creates and then disables the Baker's Dozen Trunks that were included in earlier builds of Incredible PBX 11 for PBX in a Flash servers. Just add your credentials and enable the desired trunks using FreePBX (for now).

    Strongly recommend that this only be run on virgin installs until more testing is done. Unless you have 70+ existing trunks, running this script shouldn't step on any of them.:taz:
     

    Attached Files:

    ibstelix likes this.
  6. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    Create Vestalink SIP Trunk

    Create Syntax: create-vestalink-trunk enabled/disabled acct-number acct-password acct-did

    License: GPL2

    Version: 0.002
     

    Attached Files:

    ibstelix likes this.
  7. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Devices & Extensions

    Syntax: list-devices

    License: GPL2

    Version: 0.002

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  8. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Trunks

    Syntax: list-trunks

    License: GPL2

    Version: 0.002

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  9. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Inbound Routes

    Syntax: list-inbound-routes

    License: GPL2

    Version: 0.002

    One of the real shortcomings of FreePBX is that there's no way to quickly identify which Trunk is associated with the DID specified in an Inbound Route. Usually, but not always, the DID matching that of the Inbound Route is tacked onto the end of the Trunk's Registration String. But this only applies to registered Trunks. Thus, it is prudent to name Inbound Routes in a way that identifies the Trunk to which each is associated.

    Example below shows a Default Inbound Route with a destination of the IVR sample shown here.

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  10. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Outbound Routes

    Syntax: list-outbound-routes

    License: GPL2

    Version: 0.002

    If you enjoy hairy MySQL queries with 4-table joins, this Bud's for you! In FreePBX parlance, this example shows two Outbound Routes (in seq order as shown in column 1). The first Outbound Route has two Routes specified in its Trunk Sequence (which are displayed in priority order based upon column 6 seq entries). All sequences start with 0. None of the trunks have Outbound CallerID set. Since all of the specified trunks have their disabled flag set on, outbound calls will go nowhere. This is a great troubleshooting tool for outbound call issues. :smartass:

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  11. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Users

    Syntax: list-users

    License: GPL2

    Version: 0.002

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  12. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Custom Destinations

    Syntax: list-custom-destinations

    License: GPL2

    Version: 0.002

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  13. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Misc Destinations

    Syntax: list-misc-destinations

    License: GPL2

    Version: 0.002

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  14. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Ring Groups

    Syntax: list-ring-groups

    License: GPL2

    Version: 0.002

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  15. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List Call Forwarding

    Syntax: list-call-forwarding

    License: GPL2

    Version: 0.002

    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  16. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    List IVRs

    Syntax: list-ivrs

    License: GPL2

    Version: 0.002
    [​IMG]
     

    Attached Files:

    ibstelix likes this.
  17. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    Here's the Po' Folks one-minute demo of how we envision the drag-and-drop GUI working with the GPL2 components in this thread to generate code for your existing Incredible PBX server.

    You would first click on each of the components to create and/or select extensions and trunks for inbound and outbound routes as well as a destination for failed calls and voicemail. This isn't shown in the video. Then you would use drag-and-drop connectors to interconnect the desired components in the way you want them to work (see video demo). Then the software would generate the necessary code to populate the requested setup to your existing Incredible PBX server for operation with Asterisk 11 and FreePBX 2.11.

     
    ibstelix likes this.
  18. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    And you thought your Outbound Routes were complicated. Here's one of our testing servers...

    [​IMG]
     
  19. matthew

    matthew Guru

    Joined:
    May 22, 2013
    Messages:
    83
    Likes Received:
    26
    These are great. Thanks Ward. :)

    I have a lot of inbound routes, so I modified your script slightly to show the name of the route and sort by it. This works a little better for me in my own situation.

    Code:
    mysql -u $DBUSER -p$DBPASS asterisk -e "select description,cidnum,extension,destination from incoming order by description"
     
    wardmundy likes this.
  20. matthew

    matthew Guru

    Joined:
    May 22, 2013
    Messages:
    83
    Likes Received:
    26
    I was inspired by this thread, so thought I'd whip up a quick script to do something like it on the cli. There's probably a million ways it could be improved.

    show_active_calls
    Code:
    #!/bin/bash -
    echo "A Party          B Party"
    asterisk -rx "core show channels concise"|awk -F ! '$6 == "Dial" { print $8"\t"$7 }'|sed -e 's/\t.*\//\t/g' -e 's/,.*$//g'
     
    wardmundy likes this.