Skip to content
Snippets Groups Projects
Commit a652b67d authored by Yalu Zhang's avatar Yalu Zhang
Browse files

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 40c426ca)
parent 0f85c77d
Branches
No related tags found
No related merge requests found
...@@ -153,7 +153,6 @@ assemble_and_copy_config() ...@@ -153,7 +153,6 @@ assemble_and_copy_config()
[ -f $TMPL_ASTERISK ] && cp $TMPL_ASTERISK $WORKDIR/asterisk.conf [ -f $TMPL_ASTERISK ] && cp $TMPL_ASTERISK $WORKDIR/asterisk.conf
[ -f $TMPL_CDR ] && cp $TMPL_CDR $WORKDIR/cdr.conf [ -f $TMPL_CDR ] && cp $TMPL_CDR $WORKDIR/cdr.conf
[ -f $TMPL_CEL ] && cp $TMPL_CEL $WORKDIR/cel.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_MANAGER ] && cp $TMPL_MANAGER $WORKDIR/manager.conf
[ -f $TMPL_MODULES ] && cp $TMPL_MODULES $WORKDIR/modules.conf [ -f $TMPL_MODULES ] && cp $TMPL_MODULES $WORKDIR/modules.conf
[ -f $TMPL_EXTENSIONS_MACRO ] && cp $TMPL_EXTENSIONS_MACRO $WORKDIR/extensions_macro.conf [ -f $TMPL_EXTENSIONS_MACRO ] && cp $TMPL_EXTENSIONS_MACRO $WORKDIR/extensions_macro.conf
...@@ -165,6 +164,14 @@ assemble_and_copy_config() ...@@ -165,6 +164,14 @@ assemble_and_copy_config()
[ -f $TMPL_UDPTL ] && cp $TMPL_UDPTL $WORKDIR/udptl.conf [ -f $TMPL_UDPTL ] && cp $TMPL_UDPTL $WORKDIR/udptl.conf
[ -f $SPECRATECFG ] && cp $SPECRATECFG $WORKDIR/special_rate_nr.cfg [ -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 test -e $TMPL_MEETME && cp $TMPL_MEETME $WORKDIR/meetme.conf
# Handle extensions_extra, carry over old file to new config if there is one # Handle extensions_extra, carry over old file to new config if there is one
...@@ -256,9 +263,7 @@ read_codecs_ptime() ...@@ -256,9 +263,7 @@ read_codecs_ptime()
# #
read_lines() read_lines()
{ {
local line call_lines lineid ldx lines llength clength local line call_lines lines clength
local loffset=$(ubus -t 1 call voice.asterisk platform | jsonfilter -e @.lineoffset)
loffset=${loffset:-0}
config_get call_lines $1 call_lines config_get call_lines $1 call_lines
...@@ -267,28 +272,17 @@ read_lines() ...@@ -267,28 +272,17 @@ read_lines()
# convert line format to <LINENAME><LINEID> # convert line format to <LINENAME><LINEID>
case $line in case $line in
[0-9]) [0-9])
line="$LINENAME$line"
;; ;;
"$CHANNELNAME"/[0-9]) "$CHANNELNAME"/[0-9])
# get the index from channel name
clength=$(echo $CHANNELNAME | wc -c) clength=$(echo $CHANNELNAME | wc -c)
line="$LINENAME${line:$clength}" line="${line:$clength}"
;; ;;
esac esac
# get the index from line name [ -n "$line" ] || continue
# llength=$(echo $LINENAME | wc -c)
# lineid="${lineid:$llength}"
# 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 lines="$lines$CHANNELNAME/$line&"
# +loffset to match the correct number in channel driver
ldx=$((lineid-1+loffset))
lines="$lines$CHANNELNAME/$ldx&"
done done
lines=$(escape_sed_substitution $lines) lines=$(escape_sed_substitution $lines)
...@@ -1795,6 +1789,7 @@ configure_tel() ...@@ -1795,6 +1789,7 @@ configure_tel()
local fac local fac
local echocancel local echocancel
local hold_target_before_refer local hold_target_before_refer
local calleridtype
config_get jbenable TEL jbenable config_get jbenable TEL jbenable
config_get jbforce TEL jbforce config_get jbforce TEL jbforce
...@@ -1805,6 +1800,7 @@ configure_tel() ...@@ -1805,6 +1800,7 @@ configure_tel()
config_get fac TEL fac config_get fac TEL fac
config_get echocancel TEL echo_cancel config_get echocancel TEL echo_cancel
config_get hold_target_before_refer TEL hold_target_before_refer config_get hold_target_before_refer TEL hold_target_before_refer
config_get calleridtype TEL calleridtype
CHANNEL_FAC="$CHANNEL_FAC $fac" CHANNEL_FAC="$CHANNEL_FAC $fac"
# Convert whitespace to commas # Convert whitespace to commas
...@@ -1823,6 +1819,12 @@ configure_tel() ...@@ -1823,6 +1819,12 @@ configure_tel()
sed -i "s/|CHANNELS|/$(db get hw.board.VoicePorts)/" $WORKDIR/$LINENAME.tmp sed -i "s/|CHANNELS|/$(db get hw.board.VoicePorts)/" $WORKDIR/$LINENAME.tmp
sed -i "s/|ECHOCANCEL|/$(getEchoCancellingValue $echocancel)/" $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 if [ "$dtmfmode" == "compatibility" ] ; then
dtmfcompatibility="1" dtmfcompatibility="1"
else else
...@@ -2243,6 +2245,7 @@ reload_service() { ...@@ -2243,6 +2245,7 @@ reload_service() {
# FXS channel module must be reloaded before sip module. Otherwise some attributes like # 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 # line's registration state which is updated by SIP module through callback might be
# reset. # reset.
asterisk -rx "config reload $ASTERISKDIR/indications.conf"
asterisk -rx "$(getChipVendor) reload" asterisk -rx "$(getChipVendor) reload"
asterisk -rx "config reload $ASTERISKDIR/sip.conf" asterisk -rx "config reload $ASTERISKDIR/sip.conf"
sleep 1 sleep 1
......
...@@ -22,7 +22,7 @@ getBaseMAC() { ...@@ -22,7 +22,7 @@ getBaseMAC() {
} }
getAllLines() { 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() { getLineIdx() {
......
...@@ -28,12 +28,11 @@ getBaseMAC() { ...@@ -28,12 +28,11 @@ getBaseMAC() {
} }
getAllLines() { getAllLines() {
echo "TAPI/1&TAPI/2&TAPI/3&TAPI/4&TAPI/5&TAPI/6" echo "TAPI/0&TAPI/1"
} }
getLineIdx() { getLineIdx() {
i=$1 echo $1
echo $((i+1))
} }
getEchoCancellingValue() { getEchoCancellingValue() {
...@@ -52,5 +51,14 @@ getEchoCancellingValue() { ...@@ -52,5 +51,14 @@ getEchoCancellingValue() {
} }
supportedCountries() { 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"
} }
...@@ -137,8 +137,8 @@ case "$1" in ...@@ -137,8 +137,8 @@ case "$1" in
json_add_int chanoffset 0 json_add_int chanoffset 0
;; ;;
"tapi") "tapi")
json_add_int lineoffset 1 json_add_int lineoffset 0
json_add_int chanoffset -1 json_add_int chanoffset 0
;; ;;
*) *)
# Error, unknown platform # Error, unknown platform
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment