System files customisation

The system file customization section can be found under System -> System file customization:

This section allows for customization of system and Asterisk configuration files. We recommend using this section only for experienced Asterisk administrators. MikoPBX provides the ability to modify the following configuration files via the web interface:

You will be presented with the configuration file editing form:

Choose one of four editing options:

  • "Not change" - prevents modifications, read-only mode.

  • "Add to end of file" - appends content to the end of the selected configuration file (recommended).

  • "To replace all" - your changes will completely overwrite the configuration file.

  • "Script" mode in MikoPBX system file customization allows administrators to add custom scripts or commands directly into the configuration files. This mode is ideal for advanced users who need to execute specific actions, automate tasks, or modify system behavior dynamically, enhancing the flexibility of the PBX configuration. It should be used with caution to avoid system disruptions.

Customizing System Files with Scripts

In some cases, more complex modifications to system files are required than simply adding text to the end of a configuration file. For instance, you may need to redistribute PJSIP account parameters while retaining the ability to configure the system through the web interface.

We've introduced a new approach to customization, where you can describe a Bash script that will execute each time the system generates a configuration file. This way, integrators can make precise changes to configuration files without developing additional modules.

For example, you can modify the pjsip.conf file and change the max_contacts parameter for all internal numbers, except one.

sip.conf

You can add parameters to an existing section using the (+) syntax:

[user2_pingtel]
type=friend
username=user2_pingtel
secret=blah
host=dynamic
qualify=1000 ; Consider the client unreachable if response time exceeds 1 sec.
callgroup=1,3-4 ; The client is a member of call groups: 1, 3, and 4.
pickupgroup=1,3-4 ; We can "pick up" calls using *8 for calls in groups 1, 3, and 4.
defaultip=192.168.0.60
disallow=all
allow=ulaw
allow=alaw
allow=g729

extensions.conf

Modify the dialplan with caution – there is a high chance of disrupting the PBX!

It is possible to intercept the execution of the dialplan by defining custom contexts. Currently, you can intercept executions in the following contexts:

  • internal-originate-custom - used for calls originating from the telephony panel for 1C.

  • <PROVIDER-ID>-incoming-custom - used for handling incoming calls from the provider.

  • <PROVIDER-ID>-outgoing-custom - used for handling outgoing calls via the provider.

  • all_peers-custom - used for direct outgoing calls from a phone.

  • outgoing-custom - used when dialing an external number, before selecting an outbound route.

  • add-trim-prefix-clid-custom - used for handling incoming calls, best suited for normalizing incoming phone numbers by adding/removing a prefix.

  • internal-users-custom - used for handling calls to internal extensions.

  • public-direct-dial-custom - used for handling incoming calls without authentication.

Example context:

[outgoing-custom]
exten => _X!,1,NoOp(--- hangup - ${CHANNEL} ---)
    same => n,return

Make sure to call the method "return" at the end.

Some examples of using custom contexts:

Last updated