Commit 8d1577ed authored by Yalu Zhang's avatar Yalu Zhang

Fix some errors in /usr/libexec/rpcd/voice.asterisk

- status
- codecs
parent e136cc0d
......@@ -21,7 +21,6 @@ case "$1" in
json_get_var num_endpoints num_endpoints
#json_get_var num_dect_endpoints num_dect_endpoints
json_cleanup
pndiff=$((voiceports - num_endpoints))
json_init
......@@ -53,8 +52,8 @@ case "$1" in
for line in $(uci show $(getUciConfig) | grep tel_line | awk -F[.,=] '{print$2}'); do
json_add_object "$line"
linestate="ONHOOK"
linenum=${line:4}
linenum=$((linenum - pndiff))
len_line=${#line}
linenum=${line:$((len_line-1))}
[ $linenum -ge 0 ] && ubus call endpt status "{'line':$linenum}" | grep offhook | grep -q 1 && linestate="OFFHOOK"
json_add_string sub_0_state "$linestate"
json_add_string sub_1_state "$linestate"
......@@ -77,10 +76,10 @@ case "$1" in
;;
codecs)
json_init
for codec in $(uci show voice_codecs | grep supported_codec | awk -F[.,=] '{print$2}'); do
for codec in $(uci show $(getUciConfig) | grep supported_codec | awk -F[.,=] '{print$2}'); do
json_add_object "$codec"
json_add_string name "$(uci -q get voice_codecs.$codec.name)"
bitrate=$(uci -q get voice_codecs.$codec.bitrate)
json_add_string name "$(uci -q get $(getUciConfig).$codec.name)"
bitrate=$(uci -q get $(getUciConfig).$codec.bitrate)
[ -n "$bitrate" ] && json_add_int bitrate $bitrate
json_select ..
done
......
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