Commit 45016f45 authored by Markus Gothe's avatar Markus Gothe 👌 Committed by Yalu Zhang
Browse files

asterisk: fix getAllLines() in util.sh

This fixes getAllLines() to not use hard-coded number of lines. Instead we look at hw.board.VoicePorts and
enumerates the ports from the value.

This solves an issue with the FT-P3414B which only has one FXS port.
parent f58fce34
......@@ -8,24 +8,33 @@ LINENAME="extension"
CHANNELNAME="TELCHAN"
getSerial() {
sn=$(uci -q get /etc/board-db/config/hw.board.serial_number)
local sn=$(db -q get hw.board.serial_number)
[ -z "$sn" ] && sn="0000000000"
echo $sn
}
getBaseMAC() {
mac=$(uci -q get /etc/board-db/config/hw.board.basemac)
local mac=$(db -q get hw.board.basemac)
[ -z "$mac" ] && mac="00:22:07:11:22:30"
echo $mac
}
getAllLines() {
has_dect=$(uci -q get /etc/board-db/config/hw.board.hasDect)
if [ "$has_dect" == "1" ]; then
echo "TELCHAN/0&TELCHAN/1&TELCHAN/2&TELCHAN/3&TELCHAN/4&TELCHAN/5"
else
echo "TELCHAN/0&TELCHAN/1"
fi
local i=0
local lines=""
local voiceports=$(db -q get hw.board.VoicePorts)
while [ $i -lt $voiceports ]; do
if [ -z "$lines" ]; then
lines="TELCHAN/${i}"
else
lines="${lines}&TELCHAN/${i}"
fi
i=$((i+1))
done
echo "$lines"
}
supportedCountries() {
......@@ -45,4 +54,3 @@ SERIAL="$(getSerial)"
BASEMAC="$(getBaseMAC)"
BASEMAC="${BASEMAC//:}"
USERAGENT="iopsys_${SERIAL}_${BASEMAC}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment