Update FusionPBX installer: SignalWire token required (files.freeswitch.com deprecated)
This commit is contained in:
Vendored
+62
-40
@@ -1,10 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Mundo Telecom - Instalação FusionPBX (Debian 12)
|
||||
#
|
||||
# Este script instala o FusionPBX a partir do nosso repositório local
|
||||
# em vez do GitHub oficial, garantindo controle de versão e disponibilidade.
|
||||
# ATUALIZADO: FreeSWITCH agora via SignalWire (token necessário)
|
||||
#
|
||||
# Uso: cd /usr/src/install-scripts/debian && ./install-fusionpbx.sh
|
||||
# Uso:
|
||||
# 1. Crie um token em https://signalwire.com → Personal Access Tokens
|
||||
# 2. Exporte o token:
|
||||
# export SIGNALWIRE_TOKEN=seu_token_aqui
|
||||
# 3. Execute:
|
||||
# cd /usr/src/install-scripts/debian && ./install-fusionpbx.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -24,6 +28,18 @@ if [ "$(id -u)" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verificar token SignalWire
|
||||
if [ -z "${SIGNALWIRE_TOKEN:-}" ]; then
|
||||
print_warn "Token SignalWire não definido!"
|
||||
print_warn "FreeSWITCH será instalado do source (mais lento)"
|
||||
print_warn "Para usar pacotes oficiais, defina:"
|
||||
print_warn " export SIGNALWIRE_TOKEN=seu_token"
|
||||
INSTALL_MODE="source"
|
||||
else
|
||||
INSTALL_MODE="package"
|
||||
print_status "Token SignalWire encontrado!"
|
||||
fi
|
||||
|
||||
# Configurações
|
||||
FUSIONPBX_REPO="https://git.homelabds.com.br/diegods/fusionpbx.git"
|
||||
FUSIONPBX_DIR="/usr/src/fusionpbx"
|
||||
@@ -35,30 +51,47 @@ DB_PASS=$(openssl rand -hex 24)
|
||||
# =============================================
|
||||
print_step "1/7 - Instalando FreeSWITCH"
|
||||
# =============================================
|
||||
print_status "Adicionando repositório FreeSWITCH..."
|
||||
wget -O - https://files.freeswitch.com/repo/deb/debian-release/fs-repo.gpg | apt-key add -
|
||||
echo "deb [signed-by=/usr/share/keyrings/freeswitch.gpg] https://files.freeswitch.com/repo/deb/debian-release/ bookworm main" > /etc/apt/sources.list.d/freeswitch.list
|
||||
|
||||
apt-get update
|
||||
apt-get install -y freeswitch-meta-vanilla freeswitch-mod-commands freeswitch-mod-conference \
|
||||
freeswitch-mod-curl freeswitch-mod-db freeswitch-mod-directory \
|
||||
freeswitch-mod-distributor freeswitch-mod-dptools freeswitch-mod-dialplan-xml \
|
||||
freeswitch-mod-esl freeswitch-mod-expr freeswitch-mod-hash \
|
||||
freeswitch-mod-httapi freeswitch-mod-json-cdr freeswitch-mod-logfile \
|
||||
freeswitch-mod-loopback freeswitch-mod-memcache freeswitch-mod-native-file \
|
||||
freeswitch-mod-pgsql freeswitch-mod-pin-collect freeswitch-mod-pt \
|
||||
freeswitch-mod-posix-timer freeswitch-mod-rad-gateway freeswitch-mod-rtc \
|
||||
freeswitch-mod-say-es freeswitch-mod-say-pt freeswitch-mod-say-ru \
|
||||
freeswitch-mod-say-zh freeswitch-mod-sms freeswitch-mod-sndfile \
|
||||
freeswitch-mod-snmp freeswitch-mod-sofia freeswitch-mod-spidermonkey \
|
||||
freeswitch-mod-spy freeswitch-mod-static freeswitch-mod-syslog \
|
||||
freeswitch-mod-tone-stream freeswitch-mod-valet-parking freeswitch-mod-vlc \
|
||||
freeswitch-mod-voicemail freeswitch-mod-voicemail-ivr freeswitch-mod-xml-curl \
|
||||
freeswitch-mod-xml-rpc freeswitch-mod-xml-cdr
|
||||
if [ "$INSTALL_MODE" = "package" ]; then
|
||||
print_status "Instalando FreeSWITCH via SignalWire (pacotes)..."
|
||||
apt-get update && apt-get install -y curl
|
||||
curl -sSL https://freeswitch.org/fsget | bash -s "$SIGNALWIRE_TOKEN" release install
|
||||
else
|
||||
print_status "Instalando FreeSWITCH do source..."
|
||||
print_warn "Isso pode levar 30+ minutos..."
|
||||
|
||||
systemctl enable freeswitch
|
||||
systemctl start freeswitch
|
||||
print_status "FreeSWITCH instalado e rodando!"
|
||||
# Dependências de build
|
||||
apt-get update
|
||||
apt-get install -y \
|
||||
build-essential automake autoconf libtool \
|
||||
libncurses5-dev libssl-dev libpcre3-dev \
|
||||
libcurl4-openssl-dev libsqlite3-dev libldns-dev \
|
||||
libedit-dev yasm cmake libspeexdsp-dev \
|
||||
libopus-dev libsndfile1-dev flac \
|
||||
uuid-dev libavformat-dev libswscale-dev \
|
||||
liblua5.2-dev libtiff5-dev libjpeg-dev \
|
||||
python3-dev
|
||||
|
||||
# Clonar e compilar FreeSWITCH
|
||||
cd /usr/src
|
||||
git clone https://github.com/signalwire/freeswitch.git -b v1.10.12
|
||||
cd freeswitch
|
||||
./bootstrap.sh -j
|
||||
./configure
|
||||
make -j$(nproc)
|
||||
make install
|
||||
make cd-sounds-install
|
||||
make cd-moh-install
|
||||
|
||||
# Criar links e configurar
|
||||
ldconfig
|
||||
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/
|
||||
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/
|
||||
fi
|
||||
|
||||
systemctl enable freeswitch 2>/dev/null || true
|
||||
systemctl start freeswitch 2>/dev/null || true
|
||||
print_status "FreeSWITCH instalado!"
|
||||
|
||||
# =============================================
|
||||
print_step "2/7 - Instalando PostgreSQL"
|
||||
@@ -93,8 +126,7 @@ else
|
||||
git clone "$FUSIONPBX_REPO" "$FUSIONPBX_DIR"
|
||||
fi
|
||||
|
||||
# Copiar para o diretório web
|
||||
print_status "Copiando para $FUSIONSQL_DIR..."
|
||||
mkdir -p "$FUSIONSQL_DIR"
|
||||
cp -R "$FUSIONPBX_DIR"/* "$FUSIONSQL_DIR"/
|
||||
chown -R www-data:www-data "$FUSIONSQL_DIR"
|
||||
find "$FUSIONSQL_DIR" -type d -exec chmod 755 {} \;
|
||||
@@ -105,10 +137,7 @@ print_step "5/7 - Configurando FusionPBX"
|
||||
# =============================================
|
||||
cd "$FUSIONSQL_DIR"
|
||||
|
||||
print_status "Configurando recursos do FusionPBX..."
|
||||
php "$FUSIONSQL_DIR"/secure.php 2>/dev/null || true
|
||||
|
||||
# Configurar banco de dados
|
||||
mkdir -p /etc/fusionpbx
|
||||
cat > /etc/fusionpbx/config.php << EOF
|
||||
<?php
|
||||
// Configuração FusionPBX - Mundo Telecom
|
||||
@@ -122,13 +151,9 @@ cat > /etc/fusionpbx/config.php << EOF
|
||||
\$db_type = 'pgsql';
|
||||
EOF
|
||||
|
||||
mkdir -p /etc/fusionpbx
|
||||
mv /etc/fusionpbx/config.php /etc/fusionpbx/ 2>/dev/null || true
|
||||
chown -R www-data:www-data /etc/fusionpbx
|
||||
|
||||
# Importar schema do banco
|
||||
print_status "Importando schema do banco..."
|
||||
sudo -u postgres psql -d "$DB_NAME" < "$FUSIONSQL_DIR"/app/ databases.sql 2>/dev/null || \
|
||||
php "$FUSIONSQL_DIR"/core/upgrade/upgrade.php 2>/dev/null || true
|
||||
|
||||
# =============================================
|
||||
@@ -158,7 +183,6 @@ server {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Segurança
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
@@ -194,7 +218,6 @@ FAIL2BAN
|
||||
systemctl enable fail2ban
|
||||
systemctl restart fail2ban
|
||||
|
||||
# IP do servidor
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
|
||||
# =============================================
|
||||
@@ -204,16 +227,15 @@ print_status " ✅ INSTALAÇÃO CONCLUÍDA!"
|
||||
print_status "============================================"
|
||||
print_status ""
|
||||
print_status " Acesse no navegador:"
|
||||
print_status " https://$IP"
|
||||
print_status " http://$IP"
|
||||
print_status ""
|
||||
print_status " Usuário: admin"
|
||||
print_status " Senha: (criada no primeiro acesso)"
|
||||
print_status " (senha criada no primeiro acesso)"
|
||||
print_status ""
|
||||
print_status " Banco de dados PostgreSQL:"
|
||||
print_status " Database: $DB_NAME"
|
||||
print_status " Usuário: $DB_USER"
|
||||
print_status " Senha: $DB_PASS"
|
||||
print_status " Arquivo: /etc/fusionpbx/config.php"
|
||||
print_status ""
|
||||
print_status " Repositório local:"
|
||||
print_status " $FUSIONPBX_REPO"
|
||||
|
||||
Reference in New Issue
Block a user