mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
updated asterisk init file to use network.sh
This commit is contained in:
parent
d7b71102f2
commit
9e2f153a5d
1 changed files with 5 additions and 30 deletions
|
|
@ -4,52 +4,27 @@ START=98
|
|||
STOP=10
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions/network.sh
|
||||
USE_PROCD=1
|
||||
NAME=asterisk
|
||||
PROG=/usr/sbin/asterisk
|
||||
DEFAULT=/etc/default/asterisk
|
||||
|
||||
get_ip(){
|
||||
local ifname="$1"
|
||||
local ifstatus="$(ifstatus "$ifname")"
|
||||
local address
|
||||
json_load "$ifstatus" || return
|
||||
if json_select "ipv4-address"; then
|
||||
if json_select 1; then
|
||||
json_get_var address "address"
|
||||
if [ "$address" != "" ]; then
|
||||
echo "$address"
|
||||
json_cleanup
|
||||
return
|
||||
fi
|
||||
json_select ..
|
||||
fi
|
||||
json_select ..
|
||||
fi
|
||||
if json_select "ipv6-address"; then
|
||||
if json_select 1; then
|
||||
json_get_var address "address"
|
||||
json_select ..
|
||||
fi
|
||||
json_select ..
|
||||
fi
|
||||
echo "$address"
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
init_asterisk() {
|
||||
# do not start asterisk until the
|
||||
# router receives a default route
|
||||
config_load voice_client
|
||||
local bindintf
|
||||
config_get bindintf SIP bindintf
|
||||
config_get bindintf SIP bindintf ""
|
||||
if [ "$bindintf" == "" ]; then
|
||||
while ! ip r | grep -q default; do
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
while [ "$(get_ip "$bindintf")" == "" ]; do
|
||||
network_get_ipaddr ip "$bindintf"
|
||||
while [ "$ip" == "" ]; do
|
||||
sleep 1
|
||||
network_get_ipaddr ip "$bindintf"
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue