[SOLVED] Extension Sort Order in FOP?

How can I affect the sort order of extensions (and trunks, for that matter) in FOP?

Currently, they seem to be arranged in the order in which they were created, which is not necessarily the order in which an operator can most easily find them.


You can change most any aspect of FOP including background, buttons, icon type, what is displayed and in what order.

The catch is once you get your config the way you like it you either need to set the config files r/o so FreePBX can’t update them or make a backup and restore each time your reload.

The config files are in /var/www/html/panel

The documentation is at www.asternic.org

I know how I can directly modify the FOP config files; that is of course less than optimal because either they get overwritten everytime you make a change with the GUI or else the panel and the PBX config drift apart.

What I want to know is what determines the order in which FreePBX arranges the buttons and how I can change that.


The FOP config files are generated by FreePBX using the Perl script “retrieve_op_conf_from_mysql.pl” in /var/lib/asterisk/bin, everytime a config change is applied in the GUI.

This script uses the parameter FOPSORT from /etc/amportal.conf to sort the extensions either by last name or by extension. Unfortunately (in my case) the latter sort is a STRING sort rather than a numerical sort.

By simply changing “{$a->[1] cmp $b->[1]}” to "{$a->[1] <=> $b->[1]} the extension sort is changed to a numerical sort and I get what I want.

FEATURE SUGGESTION: add the option “numerical” to FOPSORT and this perl script.


Please file this as a feature request against the FOP and provide a patch file if possible. To file a Feature request select Development Site on the left hand side, the Report Bug. Select Feature Request from the drop down instead of bug and put it against the FOP. That way it get’s tracked and addressed.

The FOP developer does get those notices so he might be able to address it quickly and include it in a future release.