Change line/channel names from tapi/1 and tapi/2 to tapi/0 and tapi1

Unsupported lines/channes like TAPI/[2-6], BRCM/6 are also removed.

This change has the following benefits.
- To simplify the line/channel name handling in /etc/init.d/voice_client
- To have the consistent implementation both on Intel and on Broadcom platforms

(cherry picked from commit 40c426ca09)
This commit is contained in:
Yalu Zhang 2019-11-25 14:09:38 +01:00 committed by Sukru Senli
parent 6bf2135bbc
commit e5f389aab6
4 changed files with 37 additions and 26 deletions

View file

@ -153,7 +153,6 @@ assemble_and_copy_config()
[ -f $TMPL_ASTERISK ] && cp $TMPL_ASTERISK $WORKDIR/asterisk.conf
[ -f $TMPL_CDR ] && cp $TMPL_CDR $WORKDIR/cdr.conf
[ -f $TMPL_CEL ] && cp $TMPL_CEL $WORKDIR/cel.conf
[ -f $TMPL_INDICATIONS ] && cp $TMPL_INDICATIONS $WORKDIR/indications.conf
[ -f $TMPL_MANAGER ] && cp $TMPL_MANAGER $WORKDIR/manager.conf
[ -f $TMPL_MODULES ] && cp $TMPL_MODULES $WORKDIR/modules.conf
[ -f $TMPL_EXTENSIONS_MACRO ] && cp $TMPL_EXTENSIONS_MACRO $WORKDIR/extensions_macro.conf
@ -165,6 +164,14 @@ assemble_and_copy_config()
[ -f $TMPL_UDPTL ] && cp $TMPL_UDPTL $WORKDIR/udptl.conf
[ -f $SPECRATECFG ] && cp $SPECRATECFG $WORKDIR/special_rate_nr.cfg
[ -f $TMPL_INDICATIONS ] && {
cp $TMPL_INDICATIONS $WORKDIR/indications.conf
config_get country TEL country
country_code=$(supportedCountries |grep $country |cut -d':' -f3 |tr [A-Z] [a-z])
sed -i "s/^country=.*/country=${country_code}/g" $WORKDIR/indications.conf
}
test -e $TMPL_MEETME && cp $TMPL_MEETME $WORKDIR/meetme.conf
# Handle extensions_extra, carry over old file to new config if there is one
@ -256,9 +263,7 @@ read_codecs_ptime()
#
read_lines()
{
local line call_lines lineid ldx lines llength clength
local loffset=$(ubus -t 1 call voice.asterisk platform | jsonfilter -e @.lineoffset)
loffset=${loffset:-0}
local line call_lines lines clength
config_get call_lines $1 call_lines
@ -267,28 +272,17 @@ read_lines()
# convert line format to <LINENAME><LINEID>
case $line in
[0-9])
line="$LINENAME$line"
;;
"$CHANNELNAME"/[0-9])
# get the index from channel name
clength=$(echo $CHANNELNAME | wc -c)
line="$LINENAME${line:$clength}"
line="${line:$clength}"
;;
esac
# get the index from line name
# llength=$(echo $LINENAME | wc -c)
# lineid="${lineid:$llength}"
[ -n "$line" ] || continue
# get the index from uci config order
lineid="$(uci show voice_client | grep =tel_line | grep -wn $line | cut -d ':' -f1)"
[ -n "$lineid" ] || continue
# -1 to match the line's uci config index number
# +loffset to match the correct number in channel driver
ldx=$((lineid-1+loffset))
lines="$lines$CHANNELNAME/$ldx&"
lines="$lines$CHANNELNAME/$line&"
done
lines=$(escape_sed_substitution $lines)
@ -1795,6 +1789,7 @@ configure_tel()
local fac
local echocancel
local hold_target_before_refer
local calleridtype
config_get jbenable TEL jbenable
config_get jbforce TEL jbforce
@ -1805,6 +1800,7 @@ configure_tel()
config_get fac TEL fac
config_get echocancel TEL echo_cancel
config_get hold_target_before_refer TEL hold_target_before_refer
config_get calleridtype TEL calleridtype
CHANNEL_FAC="$CHANNEL_FAC $fac"
# Convert whitespace to commas
@ -1823,6 +1819,12 @@ configure_tel()
sed -i "s/|CHANNELS|/$(db get hw.board.VoicePorts)/" $WORKDIR/$LINENAME.tmp
sed -i "s/|ECHOCANCEL|/$(getEchoCancellingValue $echocancel)/" $WORKDIR/$LINENAME.tmp
if [ -n "${calleridtype}" ] ; then
sed -i "s/^calleridtype *=.*/calleridtype = ${calleridtype}/g" $WORKDIR/$LINENAME.tmp
else
sed -i "/^calleridtype *=.*/d" $WORKDIR/$LINENAME.tmp
fi
if [ "$dtmfmode" == "compatibility" ] ; then
dtmfcompatibility="1"
else
@ -2243,6 +2245,7 @@ reload_service() {
# FXS channel module must be reloaded before sip module. Otherwise some attributes like
# line's registration state which is updated by SIP module through callback might be
# reset.
asterisk -rx "config reload $ASTERISKDIR/indications.conf"
asterisk -rx "$(getChipVendor) reload"
asterisk -rx "config reload $ASTERISKDIR/sip.conf"
sleep 1

View file

@ -22,7 +22,7 @@ getBaseMAC() {
}
getAllLines() {
echo "BRCM/0&BRCM/1&BRCM/2&BRCM/3&BRCM/4&BRCM/5&BRCM/6"
echo "BRCM/0&BRCM/1&BRCM/2&BRCM/3&BRCM/4&BRCM/5"
}
getLineIdx() {

View file

@ -28,12 +28,11 @@ getBaseMAC() {
}
getAllLines() {
echo "TAPI/1&TAPI/2&TAPI/3&TAPI/4&TAPI/5&TAPI/6"
echo "TAPI/0&TAPI/1"
}
getLineIdx() {
i=$1
echo $((i+1))
echo $1
}
getEchoCancellingValue() {
@ -52,5 +51,14 @@ getEchoCancellingValue() {
}
supportedCountries() {
echo "ETSI:ETS"
echo "Austria:AUT:AT"
echo "Denmark:DNK:DK"
echo "Estonia:EST:EE"
echo "Germany:DEU:DE"
echo "Netherlands:NLD:NL"
echo "Norway:NOR:NO"
echo "Spain:ESP:ES"
echo "Sweden:SWE:SE"
echo "Switzerland:CHE:CH"
echo "United Kingdom:GBR:UK"
}

View file

@ -137,8 +137,8 @@ case "$1" in
json_add_int chanoffset 0
;;
"tapi")
json_add_int lineoffset 1
json_add_int chanoffset -1
json_add_int lineoffset 0
json_add_int chanoffset 0
;;
*)
# Error, unknown platform