Skip to content

Repository files navigation

FusionPBX Enhanced Dialplans

Overview

The Enhanced Dialplans app is a part my extensions library for FusionPBX, designed to manage and visualize dialplan configurations. This app allows users to view, edit, and manage dialplan settings, making it easier to configure call routing and other telephony features.

Features

  • Automatic synchronization: Automatically synchronized XML file as you update the drag-and-drop elements of the dialplan.
  • Simple rule checking: Checks for simple mistakes and gives error notifications.
  • Extendable rules: Allows adding custom rules by creating a file in your resources/javascript/dialplan_lint_rules.js file.
  • Dialplan Management: Users can add, edit, and delete dialplans.
  • Context Filtering: Users can filter dialplans by context to manage specific sets of rules.
  • Search Functionality: Users can search for dialplans by name, number, or description.
  • Toggle Enabled/Disabled: Users can enable or disable dialplans as needed.

Usage

  1. Access the App: Navigate to the Enhanced Dialplans section in the FusionPBX menu under Dialplans.
  2. View Dialplans: The app displays a list of all dialplans, with options to filter and search.
  3. Edit Dialplans: Click on a dialplan to edit its settings.
  4. Add New Dialplans: Use the "Add" button to create new dialplan configurations.
  5. Toggle Status: Use the toggle button to enable or disable dialplans.
  6. Export XML: Use the "XML" button to export the current dialplan configuration in XML format.

Permissions

  • dialplan_view: View dialplans.
  • dialplan_add: Add new dialplans.
  • dialplan_edit: Edit existing dialplans.
  • dialplan_delete: Delete dialplans.
  • dialplan_xml: Export dialplans in XML format.

Images and Snapshots

  • Dialplan Main List: Mismatched Dialplans
  • Visual Dialplan Editor: Dialplan List
  • Syncronized XML View:
    • Dialplan Edit
    • Dialplan Edit
  • Pop-out XML View: Dialplan Popout
  • Three-way buttons:
    • Dialplan Add
    • Dialplan Add
    • Dialplan Add
  • Drag-and-drop: Dialplan XML Export
  • Nesting:
    • Nested
  • Autocomplete as you type:
    • Autocomplete
  • Rules based error checking:
    • Notice
    • Error

Migrate

The original FusionPBX dialplan editor uses a hybrid approach where the xml file OR the dialplan details can determine the final xml values used depending on which one was last saved. This version uses a single authority of the xml file as the ultimate authority.

The included tool: php app/enhanced_dialplans/resources/migrate_to_unified.php will ensure all dialplans can use the new visual tool.

Once the xml file is saved using this editor, the dialplan details are removed and xml file is the only source of editing the dialplan entry. It is assumed that you will not use the old one once this one is installed.

Install

Requires PHP 8.1+ and FusionPBX 5.4 or higher

cd /var/www/fusionpbx/app
git clone https://github.com/frytimo/enhanced_dialplans
cd /var/www/fusionpbx
php core/upgrade/upgrade.php --schema
php core/upgrade/upgrade.php --defaults
php core/upgrade/upgrade.php --permissions
php core/upgrade/upgrade.php --menu

Logout and back in again

Developers

Enhanced Dialplan Custom Lint Rules

The Enhanced Dialplan editor can load lint rules from any app automatically.

Rule file location per app:

  • app/<your_app>/resources/javascript/dialplan_lint_rules.js

How discovery works:

  • The loader in app/enhanced_dialplans/dialplan_lint_rules_loader.php scans all app folders for resources/javascript/dialplan_lint_rules.js.
  • Each file is loaded in isolation and merged into the global DialplanLintRules array.
  • If one custom rule file has an error, it is ignored so the editor continues working.

Rule format:

var DialplanLintRules = [
	{
		id: 'action-missing-data',
		severity: 'warning', // 'error' | 'warning' | 'info'
		description: 'Action or anti-action has an application but no data',
		check: function (tree) {
			var findings = [];

			function walk(nodes) {
				if (!nodes) return;
				for (var i = 0; i < nodes.length; i++) {
					var node = nodes[i];

					if ((node.type === 'action' || node.type === 'anti-action') &&
						node.enabled !== false &&
						node.attributes &&
						node.attributes.application &&
						!node.attributes.data) {
						findings.push({
							node: node,
							message: 'Application is set but data is empty'
						});
					}

					if (node.type === 'condition' && node.children) {
						walk(node.children);
					}
				}
			}

			walk(tree.children || []);

			return findings;
		}
	}
];

Notes:

  • check(tree) must return an array of objects with { node, message }.
  • node should be a reference to a node from the parsed dialplan tree.
  • Keep rule files self-contained and avoid dependencies on app page globals.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages