#Shell script used to create #!/bin/bash # echo "This script is to install the Dahdi drivers, Asterisk and FreePBX on a new install of ubuntu 9.10 (Karmic Koala). Must be run with superuser privileges. Ubuntu 9.10 and downloaded versions of: asterisk-1.6.2.2 asterisk-addons-1.6.2 freepbx-2.6.0 libpri-1.4.10.2 dahdi-linux-2.2.1 dahdi-tools-2.2.1 Asterisk on Ubuntu Edited by: John Mathew, Mavelikara, Kerala, India. Ph:- +919944227447" # NOTE: Please change these according to your configuration!!! export MYSQL_ROOT_PW=asterix export ASTERISK_DB_PW=asterix export IP_ADDRESS=131.193.35.155 apt-get update apt-get upgrade apt-get -y install debconf-utils debconf-set-selections < /etc/init.d/asterisk <<-END_STARTUP #!/bin/bash set -e set -a PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="Asterisk" NAME=amportal DAEMON=/usr/sbin/\$NAME test -x \$DAEMON || exit 0 d_start() { amportal start } d_stop() { amportal stop } d_reload() { amportal restart } case "\$1" in start) echo -n "Starting \$DESC: \$NAME" d_start echo "." ;; stop) echo -n "Stopping \$DESC: \$NAME" d_stop echo "." ;; restart|force-reload) echo -n "Restarting \$DESC: \$NAME" d_stop sleep 10 d_start echo "." ;; *) echo "Usage: \$SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac exit 0 END_STARTUP chmod 755 /etc/init.d/asterisk update-rc.d asterisk defaults 90 10 wget http://mirror.freepbx.org/freepbx-2.6.0.tar.gz tar xfz freepbx-2.6.0.tar.gz cd freepbx-2.6.0 mysqladmin -u root -p${MYSQL_ROOT_PW} create asterisk mysqladmin -u root -p${MYSQL_ROOT_PW} create asteriskcdrdb mysql -u root -p${MYSQL_ROOT_PW} asterisk < SQL/newinstall.sql mysql -u root -p${MYSQL_ROOT_PW} asteriskcdrdb < SQL/cdr_mysql_table.sql mysql -u root -p${MYSQL_ROOT_PW} <<-END_PRIVS GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY "${ASTERISK_DB_PW}"; GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY "${ASTERISK_DB_PW}"; flush privileges; END_PRIVS cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini-orig sed -i "s/\(upload_max_filesize *= *\)\(.*\)/\120M/" /etc/php5/apache2/php.ini sed -i "s/\(memory_limit *= *\)\(.*\)/\1100M/" /etc/php5/apache2/php.ini sed -i "s/\(magic_quotes_gpc *= *\)\(.*\)/\1Off/" /etc/php5/apache2/php.ini chown asterisk:asterisk /var/run/ chown asterisk:asterisk -R /etc/asterisk chown asterisk:asterisk -R /var/lib/asterisk chown asterisk:asterisk -R /var/log/asterisk chown asterisk:asterisk -R /var/spool/asterisk chown asterisk:asterisk -R /var/www sed -i "s/\[directories\](!) .*/[directories]/" /etc/asterisk/asterisk.conf sed -i "s|astrundir *=> */var/run/asterisk|astrundir => /var/run/asterisk|" /etc/asterisk/asterisk.conf ./start_asterisk start cp amportal.conf /etc/amportal.conf sed -i "s/# \(AMPDBUSER=asteriskuser\) */\1/" /etc/amportal.conf sed -i "s/# \(AMPDBPASS=\).*/\1${ASTERISK_DB_PW}/" /etc/amportal.conf sed -i "s|\(AMPWEBROOT=\)/var/www/html|\1/var/www|" /etc/amportal.conf sed -i "s|\(FOPWEBROOT=\)/var/www/html/panel|\1/var/www/panel|" /etc/amportal.conf sed -i "s/AMPWEBADDRESS=/AMPWEBADDRESS=${IP_ADDRESS}/" /etc/amportal.conf ./install_amp /etc/init.d/apache2 restart /etc/init.d/dahdi start ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3 amportal start echo " Note:- Go to /etc/aterisk/asterisk.conf and change line astrundir= /var/run" echo " U have done it!" echo " Now, Go to your web browser and type:http://`${IP_ADDRESS}`/admin" echo " Also, check: http://wiki.ubuntu.com/AsteriskOnUbuntu to learn how to fine tune you PBX!" echo " bye! " echo "This script is to install the Dahdi drivers, Asterisk and FreePBX on a new install of ubuntu 9.10 (Karmic Koala). Must be run with superuser privileges. Ubuntu 9.10 and downloaded versions of: asterisk-1.6.2.2 asterisk-addons-1.6.2 freepbx-2.6.0 libpri-1.4.10.2 dahdi-linux-2.2.1 dahdi-tools-2.2.1 Asterisk on Ubuntu Edited by: John Mathew, Mavelikara, Kerala, India. Ph:- +919944227447" echo " Thanking you John Mathew"