BB: hook voice_client and asterisk to procd

This commit is contained in:
Sukru Senli 2015-05-03 15:33:03 +02:00 committed by Martin Schröder
parent 498ad0be3e
commit d094459645
3 changed files with 18 additions and 45 deletions

View file

@ -3,11 +3,13 @@
START=98 START=98
STOP=10 STOP=10
USE_PROCD=1
DEST= DEST=
DEFAULT=$DEST/etc/default/asterisk DEFAULT=$DEST/etc/default/asterisk
OPTIONS="" OPTIONS=""
asterisk_boot() { asterisk_start() {
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
[ -d $DEST/var/run/asterisk ] || mkdir -p $DEST/var/run/asterisk [ -d $DEST/var/run/asterisk ] || mkdir -p $DEST/var/run/asterisk
[ -d $DEST/var/log/asterisk ] || mkdir -p $DEST/var/log/asterisk [ -d $DEST/var/log/asterisk ] || mkdir -p $DEST/var/log/asterisk
@ -24,28 +26,26 @@ asterisk_boot() {
$DEST/usr/sbin/asterisk $OPTIONS $DEST/usr/sbin/asterisk $OPTIONS
} }
asterisk_restart() { asterisk_reload() {
asterisk -rx "core reload" asterisk -rx "core reload"
asterisk -rx "dialplan reload" asterisk -rx "dialplan reload"
asterisk -rx "brcm reload" asterisk -rx "brcm reload"
echo "asterisk reloaded" echo "asterisk reloaded"
} }
boot() service_triggers() {
{ procd_add_reload_trigger voice_client
asterisk_boot
} }
start() { start_service() {
asterisk_boot asterisk_start
restart
} }
stop() { reload_service() {
[ -f $DEST/var/run/asterisk/asterisk.pid ] asterisk_reload
}
stop_service() {
echo 'stopping asterisk' echo 'stopping asterisk'
} }
restart() {
asterisk_restart
}

View file

@ -12,6 +12,7 @@ if [ -f "$HOOKS" ] ; then
fi fi
START=60 START=60
USE_PROCD=1
# Some global variables # Some global variables
SERIAL=$(cat /proc/nvram/SerialNumber) SERIAL=$(cat /proc/nvram/SerialNumber)
@ -1967,7 +1968,7 @@ configure_logger()
sed -i "s/|SYSLOG_FACILITY|/$syslog_facility/" $WORKDIR/logger.tmp sed -i "s/|SYSLOG_FACILITY|/$syslog_facility/" $WORKDIR/logger.tmp
} }
start() { start_service() {
run_hook preinit run_hook preinit
mkdir -p $WORKDIR mkdir -p $WORKDIR
mkdir -p $WORKDIR/ssl mkdir -p $WORKDIR/ssl
@ -2086,6 +2087,7 @@ start() {
return return
} }
restart() { service_triggers() {
start procd_add_reload_trigger voice_client
} }

View file

@ -1,29 +0,0 @@
#!/bin/sh
#
# Part of luci-app-voice.
# This file adds dependencies to /etc/config/ucitrack to allow uci to
# 1. recreate asterisk configuration files
# 2. restart asterisk
# whenever a user applies settings in the luci UI
#
# This file should be placed in /etc/uci-defaults/ on installation of
# the luci-app-voice-client. It will then be executed (once) by uci
# on the following reboot.
#
uci -q batch <<-EOF >/dev/null
delete ucitrack.@asterisk[-1]
add ucitrack asterisk
set ucitrack.@asterisk[-1].init=asterisk
commit ucitrack
EOF
uci -q batch <<-EOF >/dev/null
delete ucitrack.@voice_client[-1]
add ucitrack voice_client
set ucitrack.@voice_client[-1].init=voice_client
add_list ucitrack.@voice_client[-1].affects=asterisk
commit ucitrack
EOF
exit