Skip to content

Commit 756a707

Browse files
authored
Rework additional_sounds to download instead of convert and add g722 (#434)
1 parent 9165d29 commit 756a707

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

asterisk/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
# Changelog
55

6+
## 6.2.0
7+
8+
### New Features
9+
10+
- The `additional_sounds` option will now also download `g722` sounds ([#434](https://github.com/TECH7Fox/asterisk-hass-addons/pull/434))
11+
- Additionally, this option has been reworked so that instead of converting the sound files from `sln16`, it directly downloads the variants from https://downloads.asterisk.org/pub/telephony/sounds.
12+
613
## 6.1.0
714

815
### New Features

asterisk/DOCS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Enables video support for the auto generated extensions, when `auto_add` is enab
5858

5959
### Option: `additional_sounds`
6060

61-
The additional sounds languages to download from <https://downloads.asterisk.org/pub/telephony/sounds> on add-on startup, skipping when already downloaded. Example: pt-BR.
61+
The additional sounds languages to download from <https://downloads.asterisk.org/pub/telephony/sounds> on add-on startup, skipping when already downloaded. Examples: `fr`, `en_GB`.
6262

6363
The sounds will be downloaded to `/media/asterisk`.
6464

asterisk/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Asterisk
2-
version: 6.1.0
2+
version: 6.2.0
33
breaking_versions:
44
- 6.0.0
55
- 5.1.0

asterisk/rootfs/etc/cont-init.d/asterisk.sh

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ readarray -t additional_sounds < <(set +e && bashio::config 'additional_sounds')
203203

204204
temp_dir="/tmp/sounds_download"
205205
for sound in "${additional_sounds[@]}"; do
206-
sound_rel_dir="sounds/${sound//-/_}"
206+
sound_rel_dir="sounds/${sound}"
207207
sound_dir="/media/asterisk/${sound_rel_dir}"
208208
asterisk_sound_dir="/var/lib/asterisk/${sound_rel_dir}"
209209
lang_file="${sound_dir}/.language"
@@ -219,21 +219,14 @@ for sound in "${additional_sounds[@]}"; do
219219

220220
cd "${temp_dir}" || exit 1
221221

222-
url="https://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-${sound}-sln16-current.tar.gz"
223-
bashio::log.info "Downloading ${url}..."
224-
curl -fsSL --retry 3 "${url}" | tar xz --strip-components=1
225-
226-
url="https://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-${sound}-sln16-current.tar.gz"
227-
bashio::log.info "Downloading ${url}..."
228-
curl -fsSL --retry 3 "${url}" | tar xz --strip-components=1
229-
230-
bashio::log.info "Converting sounds for '${sound}' (this can take a while)..."
231-
readarray -d $'\0' -t files < <(find . -type f -name "*.sln16" -print0)
232-
for file in "${files[@]}"; do
233-
file_without_ext="${file%".sln16"}"
234-
sox -t raw -e signed-integer -b 16 -c 1 -r 16k "${file}" -t gsm -r 8k "${file_without_ext}.gsm"
235-
sox -t raw -e signed-integer -b 16 -c 1 -r 16k "${file}" -t raw -r 8k -e a-law "${file_without_ext}.alaw"
236-
sox -t raw -e signed-integer -b 16 -c 1 -r 16k "${file}" -t raw -r 8k -e mu-law "${file_without_ext}.ulaw"
222+
for format in sln16 ulaw alaw gsm g722; do
223+
url="https://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-${sound}-${format}-current.tar.gz"
224+
bashio::log.info "Downloading ${url}..."
225+
curl -fsSL --retry 3 "${url}" | tar xz --strip-components=1
226+
227+
url="https://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-${sound}-${format}-current.tar.gz"
228+
bashio::log.info "Downloading ${url}..."
229+
curl -fsSL --retry 3 "${url}" | tar xz --strip-components=1
237230
done
238231

239232
cd - >/dev/null || exit 1

0 commit comments

Comments
 (0)