Create uses and set permissions


cd /usr/src
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk

chown -R asterisk /var/run/asterisk
chown -R asterisk /var/log/asterisk

chown -R asterisk /var/lib/asterisk/moh
chown -R asterisk /var/lib/php/session

Since the Asterisk default moh directory (/moh) and the Freepbx default moh directory (/mohmp3) are different we need to create a symbolic link so moh files are where FreePBX expect them to be.
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3

The new default behaviour for Asterisk and Freepbx is to only use wav files for moh due to transcoding overhead and Asterisk stability issues. So we want to install mpg123 to allow us to convert uploaded mp3's to wav automagically.
cd /usr/src
tar -xjvf mpg123-1.12.5.tar.bz2

cd mpg123-1.12.5
make clean

make install

Freepbx php script cannot find mpg123 by default so we need to create a symbolic link.
ln -s /usr/local/bin/mpg123 /usr/bin/mpg123

Change User apache and Group apache to User asterisk and Group asterisk.

sed -i "s/User apache/User asterisk/" /etc/httpd/conf/httpd.conf
sed -i
"s/Group apache/Group asterisk/" /etc/httpd/conf/httpd.conf

You can choose to change the default AllowOverride All to AllowOverride None to prevent .htaccess permission problems which can be frustrating to troubleshoot.
sed -i "s/AllowOverride All/AllowOverride None/" /etc/httpd/conf/httpd.conf