Update FusionPBX installer: SignalWire token required (files.freeswitch.com deprecated)
This commit is contained in:
Vendored
+62
-40
@@ -1,10 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Mundo Telecom - Instalação FusionPBX (Debian 12)
|
# Mundo Telecom - Instalação FusionPBX (Debian 12)
|
||||||
#
|
#
|
||||||
# Este script instala o FusionPBX a partir do nosso repositório local
|
# ATUALIZADO: FreeSWITCH agora via SignalWire (token necessário)
|
||||||
# em vez do GitHub oficial, garantindo controle de versão e disponibilidade.
|
|
||||||
#
|
#
|
||||||
# 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
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -24,6 +28,18 @@ if [ "$(id -u)" -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Configurações
|
||||||
FUSIONPBX_REPO="https://git.homelabds.com.br/diegods/fusionpbx.git"
|
FUSIONPBX_REPO="https://git.homelabds.com.br/diegods/fusionpbx.git"
|
||||||
FUSIONPBX_DIR="/usr/src/fusionpbx"
|
FUSIONPBX_DIR="/usr/src/fusionpbx"
|
||||||
@@ -35,30 +51,47 @@ DB_PASS=$(openssl rand -hex 24)
|
|||||||
# =============================================
|
# =============================================
|
||||||
print_step "1/7 - Instalando FreeSWITCH"
|
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
|
if [ "$INSTALL_MODE" = "package" ]; then
|
||||||
apt-get install -y freeswitch-meta-vanilla freeswitch-mod-commands freeswitch-mod-conference \
|
print_status "Instalando FreeSWITCH via SignalWire (pacotes)..."
|
||||||
freeswitch-mod-curl freeswitch-mod-db freeswitch-mod-directory \
|
apt-get update && apt-get install -y curl
|
||||||
freeswitch-mod-distributor freeswitch-mod-dptools freeswitch-mod-dialplan-xml \
|
curl -sSL https://freeswitch.org/fsget | bash -s "$SIGNALWIRE_TOKEN" release install
|
||||||
freeswitch-mod-esl freeswitch-mod-expr freeswitch-mod-hash \
|
else
|
||||||
freeswitch-mod-httapi freeswitch-mod-json-cdr freeswitch-mod-logfile \
|
print_status "Instalando FreeSWITCH do source..."
|
||||||
freeswitch-mod-loopback freeswitch-mod-memcache freeswitch-mod-native-file \
|
print_warn "Isso pode levar 30+ minutos..."
|
||||||
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
|
|
||||||
|
|
||||||
systemctl enable freeswitch
|
# Dependências de build
|
||||||
systemctl start freeswitch
|
apt-get update
|
||||||
print_status "FreeSWITCH instalado e rodando!"
|
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"
|
print_step "2/7 - Instalando PostgreSQL"
|
||||||
@@ -93,8 +126,7 @@ else
|
|||||||
git clone "$FUSIONPBX_REPO" "$FUSIONPBX_DIR"
|
git clone "$FUSIONPBX_REPO" "$FUSIONPBX_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copiar para o diretório web
|
mkdir -p "$FUSIONSQL_DIR"
|
||||||
print_status "Copiando para $FUSIONSQL_DIR..."
|
|
||||||
cp -R "$FUSIONPBX_DIR"/* "$FUSIONSQL_DIR"/
|
cp -R "$FUSIONPBX_DIR"/* "$FUSIONSQL_DIR"/
|
||||||
chown -R www-data:www-data "$FUSIONSQL_DIR"
|
chown -R www-data:www-data "$FUSIONSQL_DIR"
|
||||||
find "$FUSIONSQL_DIR" -type d -exec chmod 755 {} \;
|
find "$FUSIONSQL_DIR" -type d -exec chmod 755 {} \;
|
||||||
@@ -105,10 +137,7 @@ print_step "5/7 - Configurando FusionPBX"
|
|||||||
# =============================================
|
# =============================================
|
||||||
cd "$FUSIONSQL_DIR"
|
cd "$FUSIONSQL_DIR"
|
||||||
|
|
||||||
print_status "Configurando recursos do FusionPBX..."
|
mkdir -p /etc/fusionpbx
|
||||||
php "$FUSIONSQL_DIR"/secure.php 2>/dev/null || true
|
|
||||||
|
|
||||||
# Configurar banco de dados
|
|
||||||
cat > /etc/fusionpbx/config.php << EOF
|
cat > /etc/fusionpbx/config.php << EOF
|
||||||
<?php
|
<?php
|
||||||
// Configuração FusionPBX - Mundo Telecom
|
// Configuração FusionPBX - Mundo Telecom
|
||||||
@@ -122,13 +151,9 @@ cat > /etc/fusionpbx/config.php << EOF
|
|||||||
\$db_type = 'pgsql';
|
\$db_type = 'pgsql';
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p /etc/fusionpbx
|
|
||||||
mv /etc/fusionpbx/config.php /etc/fusionpbx/ 2>/dev/null || true
|
|
||||||
chown -R www-data:www-data /etc/fusionpbx
|
chown -R www-data:www-data /etc/fusionpbx
|
||||||
|
|
||||||
# Importar schema do banco
|
|
||||||
print_status "Importando 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
|
php "$FUSIONSQL_DIR"/core/upgrade/upgrade.php 2>/dev/null || true
|
||||||
|
|
||||||
# =============================================
|
# =============================================
|
||||||
@@ -158,7 +183,6 @@ server {
|
|||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Segurança
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN";
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
add_header X-Content-Type-Options "nosniff";
|
add_header X-Content-Type-Options "nosniff";
|
||||||
add_header X-XSS-Protection "1; mode=block";
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
@@ -194,7 +218,6 @@ FAIL2BAN
|
|||||||
systemctl enable fail2ban
|
systemctl enable fail2ban
|
||||||
systemctl restart fail2ban
|
systemctl restart fail2ban
|
||||||
|
|
||||||
# IP do servidor
|
|
||||||
IP=$(hostname -I | awk '{print $1}')
|
IP=$(hostname -I | awk '{print $1}')
|
||||||
|
|
||||||
# =============================================
|
# =============================================
|
||||||
@@ -204,16 +227,15 @@ print_status " ✅ INSTALAÇÃO CONCLUÍDA!"
|
|||||||
print_status "============================================"
|
print_status "============================================"
|
||||||
print_status ""
|
print_status ""
|
||||||
print_status " Acesse no navegador:"
|
print_status " Acesse no navegador:"
|
||||||
print_status " https://$IP"
|
print_status " http://$IP"
|
||||||
print_status ""
|
print_status ""
|
||||||
print_status " Usuário: admin"
|
print_status " Usuário: admin"
|
||||||
print_status " Senha: (criada no primeiro acesso)"
|
print_status " (senha criada no primeiro acesso)"
|
||||||
print_status ""
|
print_status ""
|
||||||
print_status " Banco de dados PostgreSQL:"
|
print_status " Banco de dados PostgreSQL:"
|
||||||
print_status " Database: $DB_NAME"
|
print_status " Database: $DB_NAME"
|
||||||
print_status " Usuário: $DB_USER"
|
print_status " Usuário: $DB_USER"
|
||||||
print_status " Senha: $DB_PASS"
|
print_status " Senha: $DB_PASS"
|
||||||
print_status " Arquivo: /etc/fusionpbx/config.php"
|
|
||||||
print_status ""
|
print_status ""
|
||||||
print_status " Repositório local:"
|
print_status " Repositório local:"
|
||||||
print_status " $FUSIONPBX_REPO"
|
print_status " $FUSIONPBX_REPO"
|
||||||
|
|||||||
Reference in New Issue
Block a user