24 lines
734 B
Bash
Executable File
24 lines
734 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Called on ip-up event on a LAN interface
|
|
# $LANID= LAN connection index
|
|
restart_voip() {
|
|
local lanid=${LANID:-0}
|
|
[ "$lanid" = 0 ] && return 0
|
|
|
|
local ipaddr=`cat /var/bewan/wan.d/$lanid/ip/ipaddr 2>/dev/null`
|
|
[ "$ipaddr" = '' ] && return 0
|
|
|
|
local ifname=`cat /var/bewan/wan.d/$lanid/ip/ifname 2>/dev/null`
|
|
[ "$ifname" = '' ] && return 0
|
|
|
|
# force first argument to 0 so that to adress all voice profiles
|
|
# Force lanid to 0 for VOIP app. Hardcoded to test on lan ID 1 for dev purposes for the moment.
|
|
# Execute in background to avoid blocking. Up to application to remove the pipe when shutting down.
|
|
(
|
|
[ -e /var/tmp/PHONE.pipe ] && echo "IP_UP,0,0,$ifname,$ipaddr" > /var/tmp/PHONE.pipe
|
|
) &
|
|
}
|
|
|
|
restart_voip
|