added lang /lib pkgs
[librewrt/.git] / packages / xwrt / webif-asterisk / lib / asterisk / agi_bin / get_config_file.sh
1 #!/bin/sh
2
3 # Set a variable called stdin to help us
4 # get the variables from Asterisk
5 stdin="0"
6
7 # Read in the variables from Asterisk,
8 # and write them to a log file
9 while [ "$stdin" != "" ]
10 do
11 read stdin
12 # if [ "$stdin" != EOF ]
13 # then
14 # echo $stdin >> /tmp/logfile.txt
15 # fi
16 done
17
18 /bin/uci show "mars" | grep AST_* | sort | while read LINE; do
19
20 ### VAR=$(echo "$LINE" | sed 's/mars\./mars /; s/\./ /' | awk '{print $3}')
21 ### VAR=$(echo $LINE | cut -f 3 -d '.')
22 POS=$(expr index "$LINE" A)
23 VAR=$(expr substr "$LINE" $POS 100)
24
25 # Send AGI Cmd to asterisk
26 echo "EXEC SetGlobalVar \"$VAR\""
27 #done
28
29 # Now read the response back from Asterisk,
30 ### Reading resp cause problems with first read. just ignore
31 # read response
32 # echo $response >> /tmp/logfile.txt
33 done
34
35 exit 0