ugoviti / izpbx

izPBX is a Turnkey Cloud Native Telephony System powered by Asterisk Engine and FreePBX Management GUI
GNU General Public License v3.0
168 stars 69 forks source link

Add Custom Script Hooks #58

Closed hobbit378 closed 5 months ago

hobbit378 commented 8 months ago

Commit adds a generic function 'runCustomHooks()' to izpbx-asterisk/rootfs/entrypoint-hooks.sh. The function sources - depending on the value of envar APP_CUSTOM_SCRIPTS - additional script includes from the directory path stored in APP_CUSTOM_SCRIPTS if any.

This allows the user to further extend and customize izpbx by adding additional modules to the ROOTFS the initialization code for which then can be easly integrated and called via runCustomHooks().

The advantage versus directly integrating and calling the initialization code for additional modules into izpbx-asterisk/rootfs/entrypoint-hooks.sh is that later changes of izpbx-asterisk/rootfs/entrypoint-hooks.sh made by the maintainer of this project won't easily break your code.

I use this function for initializing and starting the autoban module - a replacement for the fail2ban daemon (c.f. my branch 'autoban' for the corresponding code.