voice-client: turn of voice led if no sip account is enabled

This commit is contained in:
Sukru Senli 2018-02-25 13:44:36 +01:00
parent bdc4c121ab
commit 26611cec75
2 changed files with 10 additions and 4 deletions

View file

@ -2310,10 +2310,6 @@ reload_service() {
#stop
start
# turn off voice led; asterisk will turn it on
# if there is a registered account
ubus call led.voice1 set '{"state":"off"}'
asterisk -rx "config reload $ASTERISKDIR/sip.conf"
sleep 1
asterisk -rx "core reload"

View file

@ -7,6 +7,16 @@ fi
[ "$1" == "stop" ] && exit
ACCOUNTENABLED=0
for peer in $(uci show voice_client | grep sip_service_provider | awk -F[.,=] '{print$2}'); do
[ "$(uci -q get voice_client.$peer.enabled)" == "1" ] && ACCOUNTENABLED=1
done
if [ $ACCOUNTENABLED -eq 0 ]; then
ubus call led.voice1 set '{"state":"off"}'
exit
fi
. /usr/share/libubox/jshn.sh
OFFHOOK=0