VoIP, Linux, Security & much more fun
If you need any help regarding these subjects do not hesitate about sending me a text
fusionpbx-app-menu.png

FusionPBX is a WEB frontend for FreeSWITCH. It allows to do many things almost out of the box (don't take it wrong, it stills need configuration but you save time). FusionPBX as an in-app architecture that allows it to add different functionalities. These in-app are usually in the Advanced menu.

As I have already coding Billing for FusionPBX and RSVP for FusionPBX. I will share some of the know-how to do this. In this article, I will explain the anatomy of a basic in-app. This will help developers to do their own applications.

 The Basic Files for a FusionPBX Application

  • root.php: this file creates some indexes in the $_SERVER array and it defines some constants that are going to be used in the application. This file can be copied from other applications as it is the same in all.
  • app_config.php: this file contains the basic information about the application manifest, the database structure, and group permissions. If you are coding backward compatibility with FusionPBX 4.0, you should include with include_once the app_menu.php, app_defaults.php, and app_language files.
  • app_menu.php: this file contains information about the menu items.
  • app_defaults.php: this file contains scripts to set default actions. Usually, it has some actions that only runs in clean installations. As far as I know, this file is optional.
  • app_languages.php: this file contains language definitions. As far as I know, this file is optional.
  • name.php: this is the main file of your application, your app_menu.php file should do reference to it. This is not a must, but it is a way to keep a standard.
  • name_action.php: these are the files that do the stuff. Usually, they are for example billing_edit.php, which it means it's the file to edit in the billing application.
  • resources/: this directory contains all other specific functions and classes the application needs.

Inside the app_config.php File

This file contains the basic manifest for the application. For example:

$apps[$x]['name'] = "Extensions";
$apps[$x]['uuid'] = "e68d9689-2769-e013-28fa-6214bf47fca3";
$apps[$x]['category'] = "Switch";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Used Configure SIP extensions.";
$apps[$x]['description']['es-cl'] = "Utilizado para configurar Extensiones SIP.";
$apps[$x]['description']['es-mx'] = "Utilizado para configurar Extensiones SIP.";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "Utilisé pour configurer des extentions SIP";
$apps[$x]['description']['fr-ca'] = "Utilisé pour configurer des éxtentions SIP";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "Utilizado para configurar extensões SIP.";
$apps[$x]['description']['pt-br'] = "";

Which they define the basic name, the application UUID and more related information.

Inside the app_menu.php File

This file contains the menu definitions. For example:

$apps[$x]['menu'][0]['title']['en-us'] = "Extensions";
$apps[$x]['menu'][0]['title']['es-cl'] = "Extensiones";
$apps[$x]['menu'][0]['title']['es-mx'] = "Extensiones";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Extensions";
$apps[$x]['menu'][0]['title']['fr-ca'] = "Post téléphonique";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Extensões";
$apps[$x]['menu'][0]['title']['pt-br'] = "Extensões";
$apps[$x]['menu'][0]['title']['pl'] = "Numery wewnętrzne";
$apps[$x]['menu'][0]['title']['uk'] = "Розширення";
$apps[$x]['menu'][0]['title']['sv-se'] = "Anknytningar";
$apps[$x]['menu'][0]['title']['ro'] = "Extensii";
$apps[$x]['menu'][0]['title']['de-at'] = "Nebenstellen";
$apps[$x]['menu'][0]['title']['ar-eg'] = "الأرقام الداخلية";
$apps[$x]['menu'][0]['title']['he'] = "שלוחות";
$apps[$x]['menu'][0]['uuid'] = "d3036a99-9a9f-2ad6-a82a-1fe7bebbe2d3";
$apps[$x]['menu'][0]['parent_uuid'] = "bc96d773-ee57-0cdd-c3ac-2d91aba61b55";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/extensions/extensions.php";
$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";

Please note you can add as many menus you want. You just need to be careful with the uuid (it should not be repeated) and to put the parent_uuid correct. In this case, bc96d773-ee57-0cdd-c3ac-2d91aba61b55 can be a constant for the parent menu.

Inside the apps_default.php File

There is no a standard for on this file. If you read the ones in the project, you will find it is not the same. This file contains actions that will make sure the correct configuration is done when installing from scratch. Some actions you may find are:

  • creation of missing directories
  • changing file values

Inside the app_languages.php File

This file contains all the message traductions your application may use. Usually, it is like this:

$text['title-extensions']['en-us'] = "Extensions";
$text['title-extensions']['es-cl'] = "Extensiones";
$text['title-extensions']['pt-pt'] = "Extensões";
$text['title-extensions']['fr-fr'] = "Extensions";
$text['title-extensions']['pt-br'] = "Extensões";
$text['title-extensions']['pl'] = "Numery wewnętrzne";
$text['title-extensions']['uk'] = "Розширення";
$text['title-extensions']['sv-se'] = "Anknytningar";
$text['title-extensions']['ro'] = "Extensii";
$text['title-extensions']['de-at'] = "Nebenstellen";
$text['title-extensions']['ar-eg'] = "الأرقام الداخلية";
$text['title-extensions']['he'] = "שלוחות";

When all your definitions are done, you can do a reference in your files by using the $text array. For example: $text[title-extensions']. FusionPBX will choose the correct language based on your settings.

Happy coding!

blog comments powered by Disqus
If you need more help than the free one provided here...