diff --git a/debian/install.sh b/debian/install.sh index 36c1be6..a30493f 100755 --- a/debian/install.sh +++ b/debian/install.sh @@ -11,8 +11,8 @@ cd "$(dirname "$0")" # removes the cd img from the /etc/apt/sources.list file (not needed after base install) sed -i '/cdrom:/d' /etc/apt/sources.list -#Update to latest packages -verbose "Update installed packages" +#Update to the latest packages +verbose "Update installed packages." apt-get update && apt-get upgrade -y #Add dependencies @@ -25,6 +25,7 @@ apt-get install -y dialog apt-get install -y nano apt-get install -y net-tools apt-get install -y gpg +apt-get install -y unzip #SNMP apt-get install -y snmpd diff --git a/debian/resources/maintenance/call_recordings.php b/debian/resources/maintenance/call_recordings.php index 74f860e..6d81ba3 100644 --- a/debian/resources/maintenance/call_recordings.php +++ b/debian/resources/maintenance/call_recordings.php @@ -156,17 +156,26 @@ crontab -e if (!file_exists($new_path)) { system('mkdir -p '.$new_path); } $command = "mv ".$old_path."/".$record_name." ".$new_path."/".$record_name; if ($debug) { echo $command."\n"; } - system($command); + system($command, $move_result_code); + + //skip the database update if the move failed + if ($move_result_code !== 0) { + if ($debug) { echo "mv failed with exit code ".$move_result_code.", skipping database update.\n"; } + continue; + } + } + + //set the sql update params + $sql_params = []; + if ($action_name == 'move' || $action_name == 'both') { + $sql_params[] = "record_path = '".$new_path."'"; + } + if ($action_name == 'convert' || $action_name == 'both') { + $sql_params[] = "record_name = '".$path_parts['filename'].".mp3'"; } //update the database to the new directory - $sql = "update v_xml_cdr set \n"; - if ($action_name == 'move' || $action_name == 'both') { - $sql .= "record_path = '".$new_path."' \n"; - } - if ($action_name == 'convert' || $action_name == 'both') { - $sql .= "record_name = '".$path_parts['filename'].".mp3'\n"; - } + $sql = "update v_xml_cdr set " . implode(", ", $sql_params) . " \n"; $sql .= "where xml_cdr_uuid = '".$row['xml_cdr_uuid']."';\n"; if ($debug) { echo $sql."\n"; } $database->execute($sql); diff --git a/debian/resources/switch/source-release.sh b/debian/resources/switch/source-release.sh index 03c946d..ed260c7 100755 --- a/debian/resources/switch/source-release.sh +++ b/debian/resources/switch/source-release.sh @@ -35,6 +35,12 @@ if [ ."$os_codename" = ."trixie" ]; then apt install -y python3-distutils-extra plocate fi +#use master branch for Debian 13 for now +if [ ."$os_codename" = ."trixie" ]; then + switch_branch=master + switch_version=1.10.13 +fi + # additional dependencies apt install -y sqlite3 unzip @@ -42,7 +48,7 @@ apt install -y sqlite3 unzip CWD=$(pwd) #install the following dependencies if the switch version is greater than 1.10.0 -if [ ."$switch_version" = ."master" ] || [ $(echo "$switch_version" | tr -d '.') -gt 1100 ] || [ ."$os_codename" = ."trixie" ]; then +if [ ."$switch_branch" = ."master" ] || [ $(echo "$switch_version" | tr -d '.') -gt 1100 ]; then # libks build-requirements apt install -y cmake uuid-dev @@ -60,7 +66,7 @@ if [ ."$switch_version" = ."master" ] || [ $(echo "$switch_version" | tr -d '.') # sofia-sip cd /usr/src - if [ ."$sofia_version" = ."master" ] || [ ."$os_codename" = ."trixie" ]; then + if [ ."$sofia_version" = ."master" ]; then git clone https://github.com/freeswitch/sofia-sip.git sofia-sip cd sofia-sip else @@ -77,7 +83,7 @@ if [ ."$switch_version" = ."master" ] || [ $(echo "$switch_version" | tr -d '.') cd /usr/src git clone https://github.com/freeswitch/spandsp.git spandsp cd spandsp - if [ ."$sofia_version" != ."master" ] && [ ."$os_codename" != ."trixie" ] && [ ."$switch_branch" != ."master" ]; then + if [ ."$sofia_version" != ."master" ] && [ ."$switch_branch" != ."master" ]; then git reset --hard 0d2e6ac65e0e8f53d652665a743015a88bf048d4 fi #/usr/bin/sed -i 's/AC_PREREQ(\[2\.71\])/AC_PREREQ([2.69])/g' /usr/src/spandsp/configure.ac @@ -91,7 +97,7 @@ fi cd /usr/src #check for master -if [ ."$os_codename" = ."trixie" ] || [ ."$switch_branch" = ."master" ]; then +if [ ."$switch_branch" = ."master" ]; then #master branch echo "Using version master" rm -r /usr/src/freeswitch @@ -100,14 +106,14 @@ if [ ."$os_codename" = ."trixie" ] || [ ."$switch_branch" = ."master" ]; then git remote add fusionpbx https://github.com/fusionpbx/freeswitch.git git fetch fusionpbx - git checkout -b $switch_version + git checkout 1.10.12 git rebase fusionpbx/master ./bootstrap.sh -j fi #check for stable release -if [ ."$switch_branch" != ."master" ] && [ ."$os_codename" != ."trixie" ] && [ ."$switch_branch" = ."stable" ]; then +if [ ."$switch_branch" != ."master" ] && [ ."$switch_branch" = ."stable" ]; then echo "Using version $switch_version" #1.8 and older if [ $(echo "$switch_version" | tr -d '.') -lt 1100 ]; then @@ -116,18 +122,22 @@ if [ ."$switch_branch" != ."master" ] && [ ."$os_codename" != ."trixie" ] && [ . cd /usr/src/freeswitch-$switch_version # Reset repo just-in-case we are rebuilding - git reset --hard HEAD && git clean -fdx + #git reset --hard HEAD && git clean -fdx fi #1.10.0 and newer if [ $(echo "$switch_version" | tr -d '.') -gt 1100 ]; then - + # Get the source code using git git clone https://github.com/fusionpbx/freeswitch freeswitch-$switch_version + # Change the working directory cd /usr/src/freeswitch-$switch_version + # Get the stable branch + git checkout $switch_version + # Reset repo just-in-case we are rebuilding - git reset --hard origin/master && git clean -fdx + #git reset --hard origin/master && git clean -fdx #wget http://files.freeswitch.org/freeswitch-releases/freeswitch-$switch_version.-release.zip #unzip freeswitch-$switch_version.-release.zip diff --git a/debian/resources/switch/source-sounds.sh b/debian/resources/switch/source-sounds.sh index 420c6c1..d2ad211 100755 --- a/debian/resources/switch/source-sounds.sh +++ b/debian/resources/switch/source-sounds.sh @@ -1,20 +1,44 @@ #!/bin/sh -#move to script directory so all relative paths work +# Move to script directory so all relative paths work cd "$(dirname "$0")" -#includes +# Includes . ../config.sh . ../environment.sh -# change the working directory -cd /usr/src/freeswitch-$switch_version +# Change the working directory +cd /usr/share/freeswitch/sounds -# compile and install the sounds -make sounds-install moh-install -make hd-sounds-install hd-moh-install -make cd-sounds-install cd-moh-install +# Make sure wget is installed +apt-get install -y wget -#move the music into music/default directory -mkdir -p /usr/share/freeswitch/sounds/music/default -mv /usr/share/freeswitch/sounds/music/*000 /usr/share/freeswitch/sounds/music/default +# Array of sample rates +sample_rates="48000 32000 16000 8000" + +# Loop through each sample rate +for sample_rate in $sample_rates; do + # Download the file + /usr/bin/wget "https://files.freeswitch.org/releases/sounds/freeswitch-sounds-en-us-callie-${sample_rate}-1.0.53.tar.gz" + + # Extract the file + /usr/bin/tar xvzf "freeswitch-sounds-en-us-callie-${sample_rate}-1.0.53.tar.gz" +done + +# Change to directory to the music directory +cd /usr/share/freeswitch/sounds/music + +# Loop through each sample rate +for sample_rate in $sample_rates; do + # Download the file + /usr/bin/wget "https://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-${sample_rate}-1.0.52.tar.gz" + + # Extract the file + /usr/bin/tar xvzf "freeswitch-sounds-music-${sample_rate}-1.0.52.tar.gz" +done + +# Move the music to the default directory +/usr/bin/mv music default + +# Remove the tar.gz files +/usr/bin/rm /usr/share/freeswitch/sounds/music/*.tar.gz diff --git a/ubuntu/install.sh b/ubuntu/install.sh index 8ed06cf..eb1ab89 100755 --- a/ubuntu/install.sh +++ b/ubuntu/install.sh @@ -11,8 +11,8 @@ cd "$(dirname "$0")" # removes the cd img from the /etc/apt/sources.list file (not needed after base install) sed -i '/cdrom:/d' /etc/apt/sources.list -#Update to latest packages -verbose "Update installed packages" +#Update to the latest packages +verbose "Update installed packages." apt-get update && apt-get upgrade -y #Add dependencies @@ -25,6 +25,7 @@ apt-get install -y dialog apt-get install -y nano apt-get install -y nginx apt-get install -y build-essential +apt-get install -y unzip #SNMP apt-get install -y snmpd