#!/bin/bash VER_ASTERISK="1.4.21.2"; VER_ZAPTEL="1.4.11"; VER_LIBPRI="1.4.4"; VER_ADDONS="1.4.7"; VER_FREEPBX="2.4.1"; VER="0.3.2"; CHECK_VER_DEBIAN="4.0"; CHECK_VER_KERNEL="2.6.18"; echo "##################################################################" echo "# Installation automatiser d'Asterisk + FreePBX #" echo "# #" echo "# Yoann QUERET - yoann@queret.net #" echo "# http://www.queret.net/asterisk/ #" echo "# #" echo "# == CONTRIBUTEURS == #" echo "# Serge Berney - s.berney@kinonline.net #" echo "# Neil Stone - nstone@freewayprojects.com #" echo "# #" echo "### ---------------------------------------------------------- ###" echo "-> Asterisk ${VER_ASTERISK}" echo "-> Zaptel ${VER_ZAPTEL}" echo "-> Libpri ${VER_LIBPRI}" echo "-> Addons ${VER_ADDONS}" echo "-> FreePBX ${VER_FREEPBX} (+ apache2 php5 mysql5)" echo "### ---------------------------------------------------------- ###" echo "# Appuyer sur pour continuer #" echo "##################################################################" read echo "##################################################################" echo "# == PRE-REQUIS SYSTEME == #" echo "# Ce script d'installation est prévu pour fonctionner sur #" echo "# une version de Debian ${CHECK_VER_DEBIAN} avec un kernel ${CHECK_VER_KERNEL} #" echo "# #" echo "# == PRE-REQUIS RESEAU == #" echo "# Votre serveur doit être connecté à internet, afin de #" echo "# télécharger les paquetes necessaire. #" echo "# #" echo "# Le fichier /etc/apt/sources.list doit être à jours #" echo "# #" echo "### ---------------------------------------------------------- ###" echo "# Appuyer sur pour continuer #" echo "##################################################################" read echo "+----------------------------------------------------------------+" echo "| Vérification que le script est bien excecuté depuis |" echo "| l'utilisateur root (uid 0) |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read if [ $UID != "0" ]; then echo " ERREUR : Ce script doit être lancé depuis l'utilisateur ROOT (UID 0)" echo "" echo " L'installation ne peut continuer" exit fi echo "UID 0 trouvé, on peut continuer ..." echo "+----------------------------------------------------------------+" echo "| Vérification de l'existance d'une version plus récente |" echo "| de ce script |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read wget -q http://www.queret.net/download/Asterisk_FreePBX/scripts/current_version -O /tmp/current_version if [ $(stat -c%s "/tmp/current_version") == "0" ]; then echo " ERREUR : Impossible de recupérer le numero de version courante de ce script." echo " Vérifier les paramètres reseaux." echo "" echo " L'installation ne peut continuer" exit fi VER_SRV=`cat /tmp/current_version` if [ ${VER_SRV} != ${VER} ]; then echo " Il existe une version plus rescente de ce script." echo " - Vous utilisez la version : ${VER}" echo " - La dernière version est : ${VER_SRV}" echo " Plus d'informations sur : http://www.queret.net/asterisk/" echo "" echo " L'installation va continuer" fi echo "Vous utilisez la dernière version du script" echo "+----------------------------------------------------------------+" echo "| Test de votre système (Version de debian et version de kernel) |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read KERNEL_VERSION=`uname -r` KERNEL_VERSION=`echo ${KERNEL_VERSION} | sed -e "s/\-\(.*\)//"` if [ ${KERNEL_VERSION} != ${CHECK_VER_KERNEL} ]; then echo " ERREUR : Ce script est prevu pour être utilisé avec le kernel ${CHECK_VER_KERNEL} de Debian." echo " Hors, vous utilisez le kernel : ${KERNEL_VERSION}" echo " L'installation ne peut continuer" exit fi DEBIAN_VERSION=`cat /etc/debian_version` if [ ${DEBIAN_VERSION} != ${CHECK_VER_DEBIAN} ]; then echo " ERREUR : Ce script est prevu pour être utilisé avec la version ${CHECK_VER_DEBIAN} de Debian." echo " Hors, vous utilisez la version : ${DEBIAN_VERSION}" echo " L'installation ne peut continuer" exit fi echo " Vous utilisez Debian ${DEBIAN_VERSION}, avec un kernel ${KERNEL_VERSION}." echo " Les prérequis systeme sont corrects, nous pouvons lancer l'installation" echo " Appuyer sur pour continuer" read clear echo "##################################################################" echo "# PART 1 - Installation d'asterisk #" echo "### ---------------------------------------------------------- ###" echo "# Appuyer sur pour continuer #" echo "##################################################################" read echo "+----------------------------------------------------------------+" echo "| Telechargement des sources dans /tmp/asterisk/ |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read mkdir /tmp/asterisk/ wget http://downloads.digium.com/pub/asterisk/releases/asterisk-${VER_ASTERISK}.tar.gz -O /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz wget http://downloads.digium.com/pub/zaptel/releases/zaptel-${VER_ZAPTEL}.tar.gz -O /tmp/asterisk/zaptel-${VER_ZAPTEL}.tar.gz wget http://downloads.digium.com/pub/libpri/releases/libpri-${VER_LIBPRI}.tar.gz -O /tmp/asterisk/libpri-${VER_LIBPRI}.tar.gz wget http://downloads.digium.com/pub/asterisk/releases/asterisk-addons-${VER_ADDONS}.tar.gz -O /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz echo "+----------------------------------------------------------------+" echo "| Construction de l'environment de compilation |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read aptitude update aptitude -y install linux-source-2.6.18 kernel-package g++ libncurses5-dev linux-kernel-headers sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient15-dev libsqlite0-dev echo "+----------------------------------------------------------------+" echo "| Configuration des sources du kernel |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src/ tar xvjf linux-source-2.6.18.tar.bz2 ln -s /usr/src/linux-source-2.6.18 /usr/src/linux cd /usr/src/linux/ make oldconfig make prepare make prepare scripts echo "+----------------------------------------------------------------+" echo "| Decompresion des sources dans /usr/src/ |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src/ tar zxvf /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz tar zxvf /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz tar zxvf /tmp/asterisk/libpri-${VER_LIBPRI}.tar.gz tar zxvf /tmp/asterisk/zaptel-${VER_ZAPTEL}.tar.gz echo "+----------------------------------------------------------------+" echo "| Compilation de Zaptel |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src/zaptel-${VER_ZAPTEL} ./configure echo "== ATTENTION ==" echo "Si vous ne comprenez pas la question suivante, veuillez choisir NON," echo "les options standard et optimisés seront alors utilisées." echo "--" key="" while [ "$key" != "y" ] && [ "$key" != "n" ];do echo "" read -n 1 -p "Voulez-vous selectionner les modules Zaptel à installer ? [y/N]" key done echo "" if [ $key == "y" ]; then make menuconfig fi make make install make config echo "+----------------------------------------------------------------+" echo "| Compilation de libpri |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src/libpri-${VER_LIBPRI} make install echo "+----------------------------------------------------------------+" echo "| Compilation de Asterisk |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src/asterisk-${VER_ASTERISK} wget -O apps/app_voicemail.c http://switzernet.com/public/081210-install-freepbx/index_files/app_voicemail.c ./configure MAKEOPTS="/usr/src/asterisk-${VER_ASTERISK}/menuselect.makeopts" echo 'MENUSELECT_APPS=app_ivrdemo app_osplookup app_rpt app_skel' >> ${MAKEOPTS} echo 'MENUSELECT_CDR=cdr_odbc cdr_pgsql cdr_radius cdr_tds' >> ${MAKEOPTS} echo 'MENUSELECT_CHANNELS=chan_alsa chan_gtalk chan_h323 chan_misdn chan_nbs chan_vpb' >> ${MAKEOPTS} echo 'MENUSELECT_CODECS=codec_ilbc codec_speex' >> ${MAKEOPTS} echo 'MENUSELECT_FORMATS=format_ogg_vorbis' >> ${MAKEOPTS} echo 'MENUSELECT_FUNCS=func_curl func_odbc' >> ${MAKEOPTS} echo 'MENUSELECT_PBX=pbx_gtkconsole' >> ${MAKEOPTS} echo 'MENUSELECT_RES=res_config_odbc res_config_pgsql res_crypto res_jabber res_odbc res_snmp' >> ${MAKEOPTS} echo 'MENUSELECT_OPTS_app_voicemail=' >> ${MAKEOPTS} echo 'MENUSELECT_CFLAGS=LOADABLE_MODULES' >> ${MAKEOPTS} echo 'MENUSELECT_EMBED=apps cdr channels codecs formats funcs pbx res' >> ${MAKEOPTS} echo 'MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-WAV CORE-SOUNDS-EN-ULAW CORE-SOUNDS-EN-ALAW CORE-SOUNDS-EN-GSM CORE-SOUNDS-EN-G729 CORE-SOUNDS-EN-G722' >> ${MAKEOPTS} echo 'MENUSELECT_MOH=MOH-FREEPLAY-WAV MOH-FREEPLAY-ULAW MOH-FREEPLAY-ALAW MOH-FREEPLAY-GSM MOH-FREEPLAY-G729 MOH-FREEPLAY-G722' >> ${MAKEOPTS} echo 'MENUSELECT_EXTRA_SOUNDS=EXTRA-SOUNDS-EN-WAV EXTRA-SOUNDS-EN-ULAW EXTRA-SOUNDS-EN-ALAW EXTRA-SOUNDS-EN-GSM EXTRA-SOUNDS-EN-G729 EXTRA-SOUNDS-EN-G722' >> ${MAKEOPTS} echo 'MENUSELECT_BUILD_DEPS=res_adsi chan_local res_indications app_meetme res_monitor res_smdi res_features' >> ${MAKEOPTS} echo "== ATTENTION ==" echo "Si vous ne comprenez pas la question suivante, veuillez choisir NON," echo "les options standard et optimisés seront alors utilisées." echo "--" key="" while [ "$key" != "y" ] && [ "$key" != "n" ];do echo "" read -n 1 -p "Voulez-vous selectionner les modules asterisk à installer ? [y/N]" key done echo "" if [ $key == "y" ]; then make menuconfig fi make install make samples echo "+----------------------------------------------------------------+" echo "| Compilation des Addons Asterisk |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src/asterisk-addons-${VER_ADDONS} ./configure echo "== ATTENTION ==" echo "Si vous ne comprenez pas la question suivante, veuillez choisir NON," echo "les options standard et optimisés seront alors utilisées." echo "--" key="" while [ "$key" != "y" ] && [ "$key" != "n" ];do echo "" read -n 1 -p "Voulez-vous selectionner les modules des addons d'asterisk à installer ? [y/N]" key done echo "" if [ $key == "y" ]; then make menuconfig fi make install echo "+----------------------------------------------------------------+" echo "| Liens Symboliques (Modules) |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read ln -s /lib/modules/2.6.18/ /lib/modules/`uname -r`/asterisk depmod echo "+----------------------------------------------------------------+" echo "| Lancement de ztdummy au démarrage |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read echo ztdummy >> /etc/modules echo "+----------------------------------------------------------------+" echo "| Prompt FR (Voix Française) |" echo "+----------------------------------------------------------------+" key="" while [ "$key" != "y" ] && [ "$key" != "n" ];do echo "" read -n 1 -p "Voulez-vous installer les voix françaises ? [y/N]" key done echo "" if [ $key == "y" ]; then wget http://www.queret.net/download/Asterisk_FreePBX/prompt/fr/prompt-fr-france-aurelie_bassard_2.1.tgz -O /tmp/asterisk/prompt-fr-france-aurelie_bassard_2.1.tgz cd /var/lib/asterisk/ tar zxvf /tmp/asterisk/prompt-fr-france-aurelie_bassard_2.1.tgz fi echo "##################################################################" echo "# PART1 : Installation d'asterisk : TERMINEE #" echo "### ---------------------------------------------------------- ###" echo "# Appuyer sur pour continuer #" echo "##################################################################" read ################################################################################################### ################################################################################################### ################################################################################################### clear echo "##################################################################" echo "# PART 2 - Installation de FreePBX #" echo "### ---------------------------------------------------------- ###" echo "# Appuyer sur pour continuer #" echo "##################################################################" read echo "+----------------------------------------------------------------+" echo "| Construction de l'environment |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read aptitude update aptitude install -y apache2 php5 php5-cli mysql-server-5.0 php-pear php5-mysql php-db libapache2-mod-php5 php5-gd php5-curl echo "+----------------------------------------------------------------+" echo "| Telechargement des sources dans /tmp/freepbx/ |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read mkdir /tmp/freepbx/ wget http://www.queret.net/download/Asterisk_FreePBX/freepbx/freepbx-${VER_FREEPBX}.tar.gz -O /tmp/freepbx/freepbx-${VER_FREEPBX}.tar.gz echo "+----------------------------------------------------------------+" echo "| Decompresion des sources de freepbx dans /usr/src/ |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src tar zxvf /tmp/freepbx/freepbx-${VER_FREEPBX}.tar.gz echo "+----------------------------------------------------------------+" echo "| Changement de la taille maximum des upload PHP |" echo "| et du maximum de memoire par scripts PHP |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read 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 echo "+----------------------------------------------------------------+" echo "| Musique d'attente (Lien symbolique) |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3 echo "+----------------------------------------------------------------+" echo "| Utilisateur & Permissions du user asterisk |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read adduser asterisk --disabled-password --gecos "asterisk PBX" --home /var/lib/asterisk adduser www-data asterisk echo "+----------------------------------------------------------------+" echo "| Changement de l'utilisateur www-data en asterisk pour apache |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf-orig sed -i "s/\(^User *\)\(.*\)/\1asterisk/" /etc/apache2/apache2.conf sed -i "s/\(^Group *\)\(.*\)/\1asterisk/" /etc/apache2/apache2.conf echo "+----------------------------------------------------------------+" echo "| MySQL |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read echo "create database asteriskcdrdb;" | mysql -u root echo "create database asterisk;" | mysql -u root echo "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';" | mysql -u root echo "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';" | mysql -u root mysql -u asteriskuser -pamp109 asteriskcdrdb < /usr/src/freepbx-${VER_FREEPBX}/SQL/cdr_mysql_table.sql mysql -u asteriskuser -pamp109 asterisk < /usr/src/freepbx-${VER_FREEPBX}/SQL/newinstall.sql echo "+----------------------------------------------------------------+" echo "| Configuration de Asterisk pour utilisation avec FreePBX |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cp /etc/asterisk/asterisk.conf /etc/asterisk/asterisk.conf.orig sed -i "s/\(astrundir *=> *\)\(.*\)/\1\/var\/run\/asterisk/" /etc/asterisk/asterisk.conf mkdir /var/run/asterisk chown -R asterisk:asterisk /var/run/asterisk echo "+----------------------------------------------------------------+" echo "| Demarrage de Asterisk Post Installation |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read /usr/sbin/asterisk echo "+----------------------------------------------------------------+" echo "| Modification des fichiers de configuration de FreePBX |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read #$webroot = "/var/www/html"; cp /usr/src/freepbx-${VER_FREEPBX}/install_amp /usr/src/freepbx-${VER_FREEPBX}/install_amp-orig sed -i "s/\(^\$webroot*\)\(.*\)/\1 = \"\/var\/www\";/" /usr/src/freepbx-${VER_FREEPBX}/install_amp chmod 755 /usr/src/freepbx-${VER_FREEPBX}/install_amp LOCAL_IP=`ifconfig eth0 | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})'` sed -i "s/xx.xx.xx.xx/${LOCAL_IP}/g" "/usr/src/freepbx-${VER_FREEPBX}/install_amp" chmod 755 /usr/src/freepbx-${VER_FREEPBX}/install_amp echo "+----------------------------------------------------------------+" echo "| Installation de FreePBX |" echo "+----------------------------------------------------------------+" echo "| Appuyer simplement sur à chaque question. |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cd /usr/src/freepbx-${VER_FREEPBX}/ ./install_amp /usr/src/freepbx-${VER_FREEPBX}/apply_conf.sh echo "+----------------------------------------------------------------+" echo "| Arret de Asterisk Post Installation |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read asteriskPID=$(cat /var/run/asterisk/asterisk.pid) kill -9 $(cat /var/run/asterisk/asterisk.pid) echo "+----------------------------------------------------------------+" echo "| Remove Apache2 Redirect |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read sed -i "s/\(RedirectMatch*\)\(.*\)//" /etc/apache2/sites-enabled/000-default echo "+----------------------------------------------------------------+" echo "| Redemarrage de apache |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read /etc/init.d/apache2 restart echo "+----------------------------------------------------------------+" echo "| Changement des droits |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read chown -R asterisk:asterisk /etc/asterisk chmod 770 /etc/asterisk/ chown -R asterisk:asterisk /var/lib/asterisk/ chmod 770 /var/lib/asterisk/ chown -R asterisk:asterisk /var/www/ echo "+----------------------------------------------------------------+" echo "| Copie des images manquantes |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read cp /var/www/admin/modules/dashboard/images/notify_* /var/www/admin/images/ echo "+----------------------------------------------------------------+" echo "| Script de demarrage (Asterisk+FrePBX) |" echo "| /etc/init.d/freepbx [start|stop|restart] |" echo "+----------------------------------------------------------------+" echo " Appuyer sur pour continuer" read STARTUP_SCRIPT="/etc/init.d/freepbx"; echo "Creation du fichier ${STARTUP_SCRIPT} ..."; echo '#!/bin/bash' > ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo 'AMPORTAL_BIN=/usr/local/sbin/amportal' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo 'if [ ! -x ${AMPORTAL_BIN} ]; then' >> ${STARTUP_SCRIPT} echo ' echo "error : amportal binary can not be found (${AMPORTAL_BIN})"' >> ${STARTUP_SCRIPT} echo ' exit 0' >> ${STARTUP_SCRIPT} echo 'fi' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo 'start() {' >> ${STARTUP_SCRIPT} echo ' echo "Starting FreePBX ..."' >> ${STARTUP_SCRIPT} echo ' ${AMPORTAL_BIN} start' >> ${STARTUP_SCRIPT} echo '}' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo 'stop() {' >> ${STARTUP_SCRIPT} echo ' echo "Stopping FreePBX ..."' >> ${STARTUP_SCRIPT} echo ' ${AMPORTAL_BIN} stop' >> ${STARTUP_SCRIPT} echo '}' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo 'case "$1" in' >> ${STARTUP_SCRIPT} echo ' start)' >> ${STARTUP_SCRIPT} echo ' start' >> ${STARTUP_SCRIPT} echo ' ;;' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo ' stop)' >> ${STARTUP_SCRIPT} echo ' stop' >> ${STARTUP_SCRIPT} echo ' ;;' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo ' restart)' >> ${STARTUP_SCRIPT} echo ' stop' >> ${STARTUP_SCRIPT} echo ' start' >> ${STARTUP_SCRIPT} echo ' ;;' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo ' *)' >> ${STARTUP_SCRIPT} echo ' echo $"Usage: $0 {start|stop|restart}"' >> ${STARTUP_SCRIPT} echo ' exit 1' >> ${STARTUP_SCRIPT} echo 'esac' >> ${STARTUP_SCRIPT} echo '' >> ${STARTUP_SCRIPT} echo 'exit 0' >> ${STARTUP_SCRIPT} chmod 755 ${STARTUP_SCRIPT} echo "Prise en compte du fichier ${STARTUP_SCRIPT} au boot ..." update-rc.d freepbx defaults echo "##################################################################" echo "# PART 2 - Installation de FreePBX : TERMINEE #" echo "### ---------------------------------------------------------- ###" echo "# Appuyer sur pour continuer #" echo "##################################################################" read ################################################################################################### ################################################################################################### ################################################################################################### clear echo "##################################################################" echo "# PART 3 - Paramêtres de Securité #" echo "### ---------------------------------------------------------- ###" echo "# Appuyer sur pour continuer #" echo "##################################################################" read echo "+----------------------------------------------------------------+" echo "| Changement du mot de passe SQL pour le user SQL asteriskuser |" echo "| > Change AMPDBPASS=amp109 in /etc/amportal.conf |" echo "| > Change SQL PASSWORD |" echo "+----------------------------------------------------------------+" key="" read -p "NEW asteriskuser SQL password ? " key echo $key sed -i "s/\(^AMPDBPASS=*\)\(.*\)/\1$key/" /etc/amportal.conf echo "SET PASSWORD FOR 'asteriskuser'@'localhost' = PASSWORD('$key');" | mysql -u root echo "+----------------------------------------------------------------+" echo "| Changement du mot de passe Asterisk Manager |" echo "| > Changer secret = amp111 in /etc/asterisk/manager.conf |" echo "| > Changer AMPMGRPASS=amp111 in /etc/amportal.conf |" echo "+----------------------------------------------------------------+" key="" read -p "NEW Asterisk Manager password ? " key echo $key sed -i "s/\(^secret = *\)\(.*\)/\1$key/" /etc/asterisk/manager.conf sed -i "s/\(^AMPMGRPASS=*\)\(.*\)/\1$key/" /etc/amportal.conf echo "+----------------------------------------------------------------+" echo "| ATTENTION : N'oubliez pas de changer le mot de passe |" echo "| root mysql. Celui-ci par default est null |" echo "| -------------------------------------------------------------- |" echo "| SET PASSWORD FOR 'root'@'localhost' = PASSWORD(''); |" echo "+----------------------------------------------------------------+" echo "" echo "+----------------------------------------------------------------+" echo "| L'installation est desormais terminée |" echo "| Pour lancer asterisk+freepbx vous devez utilier la commande : |" echo "| # amportal start |" echo "| |" echo "| !! NE LANCER JAMAIS DIRECTEMENT ASTERISK !! |" echo "+----------------------------------------------------------------+" echo "+----------------------------------------------------------------+" echo "| C'est fini ! |" echo "+----------------------------------------------------------------+"