blob: e336570ef5b404d0c7e17e63ab97662aaf8a0b78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#!/bin/sh
# Feature.conf
ast_add_conf feature
init_featureconf(){
ast_add_reload feature
ast_enable_type feature
ast_enable_type featurepark
ast_enable_type featuremap
feature_park_parkenabled=no
feature_park_parkext=700
feature_park_parkpos="701-720"
feature_park_context=parkedcalls
feature_park_parkingtime=45
feature_park_courtesytone=beep
feature_park_parkedplay=caller
feature_park_adsipark=yes
feature_park_findslot=first
feature_park_parkedmusicclass=default
feature_park_transferdigittimeout=3
feature_park_xfersound=beep
feature_park_xferfailsound=beeperr
feature_park_pickupexten="*8"
feature_park_featuredigittimeout=500
feature_park_atxfernoanswertimeout=15
}
feature_park_list="parkext parkpos context parkingtime \
courtesytone parkedplay adsipark findslot parkedmusicclass \
transferdigittimeout xfersound xferfailsound pickupexten \
featuredigittimeout atxfernoanswertimeout"
feature_map_list="blindxfer disconnect automon atxfer parkcall"
valid_features(){
case $1 in
park) is_in_list $2 ${feature_park_list} parkenabled ; return $? ;;
map) is_in_list $2 ${feature_map_list} ; return $? ;;
*) return 1;;
esac
}
create_featureconf(){
file=${DEST_DIR}/features.conf
get_checksum feature_conf $file
local isempty=1
if [ $feature_park_parkenabled == no ] ; then
rm -f $file
isempty=2
else
enable_module res_features
echo "${asteriskuci_gen}${N}[general]" > $file
for i in ${feature_park_list} ; do
eval value="\"\${feature_park_$i}\""
[ ! -z "$value" ] && echo "$i=$value" >> $file
done
echo "${N}[featuremap]" >> $file
for i in ${feature_map_list} ; do
eval value="\"\${feature_map_$i}\""
[ ! -z "$value" ] && echo "$i=$value" >> $file
done
fi
check_checksum "$feature_conf" "$file" || ast_feature_restart=$isempty
}
handle_featurepark() {
handle_feature park
}
handle_featuremap() {
handle_feature map
}
handle_feature() {
feature_type=$1
option_cb() {
if valid_features ${feature_type} $1 $2 ; then
eval "feature_${feature_type}_$1=\"$2\""
else
logerror "Invalid feature: $1"
fi
}
}
append_dialplan_park(){
local file=$1
# Check for parked calls - add into available extensions
if [ ${feature_park_parkenabled} == yes ] && [ ! -z ${feature_park_context} ] ; then
add_dialplan_include extensions ${feature_park_context}
enable_module app_parkandannounce
enable_format gsm
fi
}
reload_feature() astcmd "module reload res_features.so"
unload_feature() astcmd "module unload res_features.so"
# vim: ts=2 sw=2 noet foldmethod=indent
|