From 40c426ca09daeaf2b75512610cd4d114c626fbba Mon Sep 17 00:00:00 2001 From: Yalu Zhang Date: Mon, 25 Nov 2019 14:09:38 +0100 Subject: [PATCH] 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 --- voice-client/files/etc/init.d/voice_client | 23 ++++--------------- voice-client/files/lib/voice/broadcom.sh | 2 +- voice-client/files/lib/voice/intel.sh | 5 ++-- .../files/usr/libexec/rpcd/voice.asterisk | 4 ++-- 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/voice-client/files/etc/init.d/voice_client b/voice-client/files/etc/init.d/voice_client index c2f7e4769..617779e64 100755 --- a/voice-client/files/etc/init.d/voice_client +++ b/voice-client/files/etc/init.d/voice_client @@ -263,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 @@ -274,28 +272,17 @@ read_lines() # convert line format to 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) diff --git a/voice-client/files/lib/voice/broadcom.sh b/voice-client/files/lib/voice/broadcom.sh index 70c737d38..f4f02b724 100755 --- a/voice-client/files/lib/voice/broadcom.sh +++ b/voice-client/files/lib/voice/broadcom.sh @@ -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() { diff --git a/voice-client/files/lib/voice/intel.sh b/voice-client/files/lib/voice/intel.sh index 267990896..ca4a17d4f 100755 --- a/voice-client/files/lib/voice/intel.sh +++ b/voice-client/files/lib/voice/intel.sh @@ -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() { diff --git a/voice-client/files/usr/libexec/rpcd/voice.asterisk b/voice-client/files/usr/libexec/rpcd/voice.asterisk index d01029301..dc8156740 100755 --- a/voice-client/files/usr/libexec/rpcd/voice.asterisk +++ b/voice-client/files/usr/libexec/rpcd/voice.asterisk @@ -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