7 ast_add_reload dialplan
8 ast_enable_type asterisk
9 ast_enable_type setglobal
10 ast_enable_type include
11 # ast_enable_type hardware
12 ast_enable_type hardwarereboot
15 asterisk_zone
="Australia/Perth"
16 asterisk_spooldir
="${DEST}/var/spool/asterisk"
17 asterisk_logdir
="${DEST}/var/log/asterisk"
18 asterisk_agidir
="${DEST}/usr/lib/asterisk/agi-bin"
22 asterisk_option_list
="verbose debug quiet dontwarn timestamp execincludes \
23 highpriority initcrypto nocolor dumpcore languageprefix internal_timing \
24 systemname maxcalls maxload cache_record_files record_cache_dir \
25 transmit_silence_during_record transcode_via_sln runuser rungroup"
26 asterisk_path_list
="spooldir logdir agidir"
28 valid_asterisk_option
() {
29 is_in_list
$1 ${asterisk_option_list} ${asterisk_path_list} zone
33 create_asteriskconf
() {
35 file=${DEST_DIR}/asterisk.conf
36 get_checksum asterisk_conf
$file
38 echo "${asteriskuci_gen}${N}[directories]
39 astetcdir => ${DEST_DIR}
40 astmoddir => ${DEST}/usr/lib/asterisk/modules
41 astvarlibdir => ${DEST}/usr/lib/asterisk
42 astdatadir => ${DEST}/usr/lib/asterisk
43 astrundir => /var/run" > $file
44 for i
in ${asterisk_path_list} ; do
45 eval "value=\"\${asterisk_$i}\""
46 if [ ! -z $value ] ; then
47 echo "ast$i => $value" >> $file
50 echo "${N}[options]" >> $file
52 for i
in ${asterisk_option_list} ; do
53 eval "value=\"\${asterisk_$i}\""
54 if [ ! -z $value ] ; then
55 echo "$i => $value" >> $file
59 echo "${N}; Changing the following lines may compromise your security.
61 astctlpermissions = 0660
64 astctl = asterisk.ctl " >> $file
65 check_checksum
"$asterisk_conf" "$file" || ast_restart
=1
75 if valid_asterisk_option
$1 $2 ; then
76 eval "asterisk_${1}=\"$2\""
78 logerror
"Invalid Asterisk option: $1"
87 dialplan|dialplan_ITEM
*)
88 append dialplan_includes
"#include <$2>" "${N}"
91 *) logerror
"Invalid option \"$1\" for include" ;;
101 if [ "${2%=*}" == "${2}" ] ; then
102 logerror
"SetGlobal option \"$2\" not of the form VARIABLE=Value"
104 append dialplan_globals
"" "${N}"
106 *) logerror
"Invalid option \"$1\" for setglobal" ;;
111 handle_hardwarereboot
() handle_hardware reboot
113 # Handle hardware options (reboot) for Softphones
122 hardware_method
="$2";;
124 case ${hardware_method} in
125 web
) append hardware_reboots
"wget -q $2 -O - >&- 2>&-" "${N}" ;;
126 system
) append hardware_reboots
"$2 >&- 2>&-" "${N}" ;;
127 *) logerror
"Invalid Hardware reboot method: ${hardware_method}"
133 *) logerror
"Invalid Hardware option: $1"
139 eval ${hardware_reboots}
144 # vim: ts=2 sw=2 noet foldmethod=indent