Module main class

This class helps to make new features, REST API methods, interacts with PBX core system

On the template repository, you can find an example in the file ModuleTemplate/Lib/TemplateConf.php You can use it for your project according to your preferences. The name of this class should be consist of a module unique identifier and ends with the Conf word.

Good examples:

  • MyFirstModuleConf

  • MikoCallTrackingConf

  • TheBestModuleConf

Non-workable examples:

  • TemplateConf

  • MyFirstModuleConf1

  • TheBestModuleConfig

The main MikoPBX module configuration class

After applying the instructions your config class will be renamed automatically.

Asterisk configs generators

generateConfig

Generates core modules config files with cli messages before and after generation.

Example:

extensions.conf

extensionGlobals

Prepares additional parameters for [globals] section in extensions.conf file

Example:

extensionGenContexts

Prepares additional contexts sections in extensions.conf file

Example:

getIncludeInternal

Prepares additional includes for [internal] context section in the extensions.conf file

Example:

extensionGenInternal

Prepares additional rules for [internal] context section in the extensions.conf file

Example:

getIncludeInternalTransfer

Prepares additional includes for [internal-transfer] context section in the extensions.conf file

Example:

extensionGenInternalTransfer

Prepares additional rules for [internal-transfer] context section in the extensions.conf file

Example:

extensionGenInternalUsersPreDial

Prepares additional rules for [internal-users] context section in the extensions.conf file

Example:

extensionGenHints

Prepares additional hints for [internal-hints] context section in the extensions.conf file

Example:

extensionGenCreateChannelDialplan

Adds priorities for [dial_create_chan] context section in the extensions.conf file

Example:

generateIncomingRoutBeforeDialPreSystem

Prepares additional parameters for each incoming context for each incoming route before dial in the extensions.conf file

Example:

generateIncomingRoutBeforeDial

Prepares additional parameters for each incoming context for each incoming route before dial in extensions.conf file

Example:

generateIncomingRoutBeforeDialSystem

Prepares additional parameters for each incoming context for each incoming route before dial in the extensions.conf file

Example:

generateIncomingRoutAfterDialContext

Prepares additional parameters for each incoming context * and incoming route after dial command in an extensions.conf file

Example:

generatePublicContext

Prepares additional parameters for [public-direct-dial] section in the extensions.conf file

Example:

generateOutRoutContext

Prepares additional parameters for each outgoing route context before dial call in the extensions.conf file

Example:

generateOutRoutAfterDialContext

Prepares additional parameters for each outgoing route context after dial call in the extensions.conf file

Example:

managers.conf

generateManagerConf

Prepares additional AMI users data in the manager.conf file. This record is not present on the web interface.

Example:

pjsip.conf

generatePeersPj

Prepares additional peers data in the pjsip.conf file

Example:

generatePeerPjAdditionalOptions

Prepares additional pjsip options on endpoint section in the pjsip.conf file for peer

Example:

overrideProviderPJSIPOptions

Override pjsip options for provider in the pjsip.conf file

Example:

overridePJSIPOptions

Override pjsip options for peer in the pjsip.conf file

Example:

features.conf

getFeatureMap

Prepares additional parameters for [featuremap] section in the features.conf file

Example:

Other

getMethodPriority

This method allows overriding the execution priority of a method when called through hookModulesMethod. By defining this method in the Conf class of a module, you can flexibly control the execution priority of HOOK methods. This provides the ability to specify a high priority for a method that generates CRON tasks in an external module, and a low priority for a method that generates peers for pjsip.conf. By changing the priority, you can control the order in which module methods are applied.

Example:

REST API Core generators

getPBXCoreRESTAdditionalRoutes

Returns array of additional routes for PBXCoreREST interface from module

[ControllerClass, ActionMethod, RequestTemplate, HttpMethod, RootUrl, NoAuth ]

Example:

moduleRestAPICallback

Process PBXCoreREST requests under root rights

Example:

System generators

System events

onAfterPbxStarted

The callback function will execute after PBX started

Example:

onBeforeModuleEnable

Process before enable action in web interface

Example:

onAfterModuleEnable

Process after enable action in web interface

Example:

onBeforeModuleDisable

Process before disable action in web interface

Example:

onAfterModuleDisable

Process after disable action in web interface

Example:

modelsEventChangeData

This method calls in the WorkerModelsEvents after receive each models change

Example:

modelsEventNeedReload

This method calls in the WorkerModelsEvents after finished process models changing

Example:

Core workers

getModuleWorkers

Returns array of workers classes for WorkerSafeScripts

Example:

Crond

createCronTasks

Add crond tasks

Example:

Iptables

getDefaultFirewallRules

Returns array of additional firewall rules for module

Example:

Fail2Ban

generateFail2BanJails

Generates additional fail2ban jail conf rules

Example:

Nginx

createNginxLocations

Create additional Nginx locations from modules

Example:

WebUI - manipulations

Assets

onAfterAssetsPrepared

Adds assets to the assets manager after it has been prepared.

Example:

ACL

authenticateUser

Authenticates a user over an external module.

Example:

onAfterACLPrepared

Adds roles and permissions to the ACL list after it has been prepared.

Example:

Routes

onAfterExecuteRoute

Example:

Volt

onVoltBlockCompile

The function compiles a Volt block and provides the file path of the compiled template. All available blocks can be found in the src/AdminCabinet/Views folder. For example, in the Asterisk manager modify form, there is a block called MainFields, which is represented in the Volt file using the following syntax:

Example:

Forms

onBeforeFormInitialize

Initializes the form before it is rendered. It useful to add an extra form fields before it compile.

Example:

onBeforeHeaderMenuShow

Modifies the sidebar menu items before it is shown.

Example:

Last updated

Was this helpful?