This commit is contained in:
CanbiZ 2025-11-03 11:09:34 +01:00
parent 00bca3d916
commit 958e42edee
4 changed files with 161 additions and 13 deletions

35
ct/asterisk.sh Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: michelroegl-brunner
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://asterisk.org/
APP="Asterisk"
var_tags="${var_tags:-telephone;pbx}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
msg_error "No Update function provided for ${APP} LXC"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"

View File

@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}" var_ram="${var_ram:-2048}"
var_disk="${var_disk:-5}" var_disk="${var_disk:-5}"
var_os="${var_os:-debian}" var_os="${var_os:-debian}"
var_version="${var_version:-12}" var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"
header_info "$APP" header_info "$APP"
@ -20,18 +20,18 @@ color
catch_errors catch_errors
function update_script() { function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /var ]]; then if [[ ! -d /var ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating $APP LXC"
$STD apt-get update
$STD apt-get -y upgrade
msg_ok "Updated $APP LXC"
exit exit
fi
msg_info "Updating $APP LXC"
$STD apt-get update
$STD apt-get -y upgrade
msg_ok "Updated $APP LXC"
exit
} }
start start

113
install/asterisk-install.sh Normal file
View File

@ -0,0 +1,113 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: michelroegl-brunner
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://asterisk.org
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
ASTERISK_VERSIONS_URL="https://www.asterisk.org/downloads/asterisk/all-asterisk-versions/"
html=$(curl -fsSL "$ASTERISK_VERSIONS_URL")
LTS_VERSION=""
for major in 20 22 24 26; do
block=$(echo "$html" | awk "/Asterisk $major - LTS/,/<ul>/")
ver=$(echo "$block" | grep -oE 'Download Latest - [0-9]+\.[0-9]+(\.[0-9]+)?' | head -n1 | sed -E 's/.* - //')
if [ -n "$ver" ]; then
LTS_VERSION="$LTS_VERSION $ver"
fi
unset ver block
done
LTS_VERSION=$(echo "$LTS_VERSION" | xargs | tr ' ' '\n' | sort -V | tail -n1)
STD_VERSION=""
for major in 21 23 25 27; do
block=$(echo "$html" | awk "/Asterisk $major</,/<ul>/")
ver=$(echo "$block" | grep -oE 'Download (Latest - )?[0-9]+\.[0-9]+(\.[0-9]+)?' | head -n1 | sed -E 's/.* - //;s/Download //')
if [ -n "$ver" ]; then
STD_VERSION="$STD_VERSION $ver"
fi
unset ver block
done
STD_VERSION=$(echo "$STD_VERSION" | xargs | tr ' ' '\n' | sort -V | tail -n1)
cert_block=$(echo "$html" | awk '/Certified Asterisk/,/<ul>/')
CERT_VERSION=$(echo "$cert_block" | grep -oE 'Download Latest - [0-9]+\.[0-9]+-cert[0-9]+' | head -n1 | sed -E 's/.* - //')
cat <<EOF
Choose Asterisk version to install:
1) Latest Standard ($STD_VERSION)
2) Latest LTS ($LTS_VERSION)
3) Latest Certified ($CERT_VERSION)
EOF
read -rp "Enter choice [1-3]: " ASTERISK_CHOICE
case "$ASTERISK_CHOICE" in
2)
ASTERISK_VERSION="$LTS_VERSION"
;;
3)
ASTERISK_VERSION="$CERT_VERSION"
CERTIFIED=1
;;
*)
ASTERISK_VERSION="$STD_VERSION"
;;
esac
if [[ "$CERTIFIED" == "1" ]]; then
RELEASE="certified-asterisk-${ASTERISK_VERSION}.tar.gz"
DOWNLOAD_URL="https://downloads.asterisk.org/pub/telephony/certified-asterisk/$RELEASE"
else
RELEASE="asterisk-${ASTERISK_VERSION}.tar.gz"
DOWNLOAD_URL="https://downloads.asterisk.org/pub/telephony/asterisk/$RELEASE"
fi
msg_info "Installing Dependencies"
$STD apt install -y \
libsrtp2-dev \
build-essential \
libedit-dev \
uuid-dev \
libjansson-dev \
libxml2-dev \
libsqlite3-dev
msg_ok "Installed Dependencies"
msg_info "Downloading Asterisk"
temp_file=$(mktemp)
curl -fsSL "$DOWNLOAD_URL" -o "$temp_file"
mkdir -p /opt/asterisk
tar zxf "$temp_file" --strip-components=1 -C /opt/asterisk
cd /opt/asterisk
msg_ok "Downloaded Asterisk ($RELEASE)"
msg_info "Installing Asterisk"
$STD ./contrib/scripts/install_prereq install
$STD ./configure
$STD make -j$(nproc)
$STD make install
$STD make config
$STD make install-logrotate
$STD make samples
mkdir -p /etc/radiusclient-ng/
ln /etc/radcli/radiusclient.conf /etc/radiusclient-ng/radiusclient.conf
systemctl enable -q --now asterisk
msg_ok "Installed Asterisk"
motd_ssh
customize
msg_info "Cleaning up"
rm -f "$temp_file"
$STD apt -y autoremove
$STD apt -y autoclean
$STD apt -y clean
msg_ok "Cleaned"

View File

@ -14,7 +14,7 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt install -y \
caddy \ caddy \
apt-transport-https \ apt-transport-https \
ca-certificates ca-certificates