diff --git a/services/asterisk.sh b/services/asterisk.sh index 4ff649f..0cfa883 100644 --- a/services/asterisk.sh +++ b/services/asterisk.sh @@ -1692,7 +1692,26 @@ install_asterisk() { return 0 ;; fresh) - log_info "Proceeding with a full fresh reinstall — every prompt below runs from scratch." + echo "" + log_warning "Full reinstall stops the existing containers and re-runs every" + log_warning "prompt below from scratch (domain, networking, firewall, Caddy/" + log_warning "Authelia). The TURN credential registered with the shared coturn" + log_warning "service is reused as-is — no need to touch coturn for this." + local _WIPE_PBX_DATA="" + prompt_yn " Also delete stored PBX data (extensions, voicemail, recordings, spool)? (y/n):" "n" _WIPE_PBX_DATA + + log_info "Stopping the existing containers..." + (cd "$EA_DIR" && docker compose down 2>/dev/null) + + if [[ "$_WIPE_PBX_DATA" =~ ^[Yy]$ ]]; then + rm -rf "$EA_DIR/config/asterisk" "$EA_DIR/spool" "$EA_DIR/logs" "$EA_DIR/lib" + log_warning "Deleted config/asterisk, spool, logs, and lib — extensions," + log_warning "voicemail, and call recordings are gone." + if declare -F install_pstn-trunk >/dev/null 2>&1 || [ -f "$EA_DIR/pstn-trunk-usage-alert.sh" ]; then + log_warning "PSTN trunk patches config/asterisk's dialplan — re-run" + log_warning "'sudo ./setup.sh pstn-trunk' afterward to restore it." + fi + fi ;; esac fi diff --git a/services/coturn.sh b/services/coturn.sh index a0ce841..08dbb94 100644 --- a/services/coturn.sh +++ b/services/coturn.sh @@ -186,6 +186,27 @@ install_coturn() { log_warning "change the host/port/realm below, every already-registered consumer" log_warning "(Asterisk, Mattermost, ...) keeps pointing at the OLD values in its own" log_warning ".env until you re-run that service's installer too." + + local _consumers="" + [ -d "$DIR/users" ] && _consumers="$(find "$DIR/users" -maxdepth 1 -name '*.env' -printf '%f\n' 2>/dev/null | sed 's/\.env$//' | tr '\n' ' ')" + if [ -n "$_consumers" ]; then + echo "" + log_info "Registered consumers: $_consumers" + local _WIPE_USERS="" + prompt_yn " Also delete all TURN user credentials and the user database (forces every consumer above to re-register)? (y/n):" "n" _WIPE_USERS + if [[ "$_WIPE_USERS" =~ ^[Yy]$ ]]; then + rm -rf "$DIR/users" "$DIR/db" + mkdir -p "$DIR/db" "$DIR/users" + # The running container (if any) still holds the old, + # now-deleted turndb file open — new turnadmin writes + # to the fresh file at that path go unseen until the + # server process restarts and reopens it. + docker restart coturn >/dev/null 2>&1 + log_warning "Deleted TURN credentials and the user database." + log_warning "Re-run each consumer's installer in Update mode afterward —" + log_warning "ensure_coturn_user() auto-recovers a fresh credential for it." + fi + fi ;; esac fi diff --git a/services/mattermost.sh b/services/mattermost.sh index 67363fd..7ccb3a6 100644 --- a/services/mattermost.sh +++ b/services/mattermost.sh @@ -314,6 +314,20 @@ install_mattermost() { log_warning "the shared coturn service — the Calls plugin's TURN config in System" log_warning "Console will need updating to the new credentials afterward (see below)." fi + echo "" + log_warning "Full reinstall stops the existing containers and re-runs every prompt" + log_warning "below from scratch. The TURN credential registered with the shared" + log_warning "coturn service is reused as-is — no need to touch coturn for this." + local _WIPE_MM_DATA="" + prompt_yn " Also delete stored data (Postgres database, uploaded files, config, plugins)? (y/n):" "n" _WIPE_MM_DATA + + log_info "Stopping the existing containers..." + (cd "$DIR" && docker compose down 2>/dev/null) + + if [[ "$_WIPE_MM_DATA" =~ ^[Yy]$ ]]; then + rm -rf "$DIR/db" "$DIR/data" "$DIR/logs" "$DIR/config" "$DIR/plugins" + log_warning "Deleted the Postgres database, uploaded files, config, and plugins." + fi ;; esac fi