Configuration
Using #exec for automatic config
The #exec directive lets you specify a script to be run when fop2 is started (or reloaded) and that outputs valid config data. Please do not remove the #, it is not a comment, in order for this directive to work the line must start with #exec
This way you can write a script that extracts configuration from a database, for example, and writes the appropiate config parameters from there.
Any output that is generated from a script will be interpreted, including other #exec directives. This is pretty powerful but also dangerous. You will have to be careful not to produce loops, and also that the output contains only valid configuration data
The automatic freepbx configurator is indeed a script to be run via #exec
The following example will run a script that generates SIP buttons from 100 to 200:
buttonfile=automatic_buttons.cfg
#exec automatic_buttons.sh
#/bin/bash for EXTEN in `seq 100 200` do echo "[SIP/$EXTEN]" echo "type=extension" echo "extension=$EXTEN" echo "context=from-internal" echo "label=Extension" echo "mailbox=$EXTEN@default" echo done
Automatic config for FreePBX
Included in the distributions there are a couple of scripts to configure users and buttons automagically.. To use them, just configure fop2 as follows:
.. .. #exec autoconfig-users-freepbx.sh
Instead of setting up each user for fop2, by using this script it will read asterisk's voicemail.conf file and generate users from there, with the same voicemail password and granting all permissions.
#exec autoconfig-buttons-freepbx.sh
Finally, the button configuration will be read from FreePBX MySQL tables and populated for you.
Be carefull as the automatic configuration does not configure the correct manager credentials, and it does not set up any databases or tables for the visual phonebook. It just setup users and buttons for FOP2.
