]>
Commit | Line | Data |
---|---|---|
483f59cd MT |
1 | #!/usr/bin/perl |
2 | ||
3 | require '/var/ipcop/general-functions.pl'; | |
4 | require "${General::swroot}/lang.pl"; | |
5 | require "${General::swroot}/header.pl"; | |
6 | ||
7 | &Header::showhttpheaders(); | |
8 | ||
9 | my %asterisksettings; | |
10 | ||
11 | &Header::getcgihash(\%asterisksettings); | |
12 | ||
13 | &Header::openpage('asterisk', 1, ''); | |
14 | ||
15 | &Header::openbigbox('100%', 'LEFT'); | |
16 | ||
17 | if ($asterisksettings{'ACTION'} eq $Lang::tr{'save'}) | |
18 | { | |
19 | ||
20 | &General::writehash("${General::swroot}/asterisk/settings", \%asterisksettings); | |
21 | ||
22 | if ($asterisksettings{'ENABLE_AST'} eq 'on') | |
23 | { | |
24 | &General::log('Asterisk is enabled'); | |
25 | system ('/bin/touch', "${General::swroot}/asterisk/enable"); | |
26 | } | |
27 | else | |
28 | { | |
29 | &General::log('Asterisk is disabled'); | |
30 | unlink "${General::swroot}/asterisk/enable"; | |
31 | } | |
32 | ||
33 | if ($asterisksettings{'ENABLE_CAPI'} eq 'on') | |
34 | { | |
35 | &General::log('CAPI is enabled'); | |
36 | system ('/bin/touch', "${General::swroot}/asterisk/capi"); | |
37 | } | |
38 | else | |
39 | { | |
40 | &General::log('CAPI is disabled'); | |
41 | unlink "${General::swroot}/asterisk/capi"; | |
42 | } | |
43 | ||
44 | if ($asterisksettings{'ENABLE_ZAP'} eq 'on') | |
45 | { | |
46 | &General::log('Zaptel is enabled'); | |
47 | system ('/bin/touch', "${General::swroot}/asterisk/zap"); | |
48 | } | |
49 | else | |
50 | { | |
51 | &General::log('Zaptel is disabled'); | |
52 | unlink "${General::swroot}/asterisk/zap"; | |
53 | } | |
54 | ||
55 | { | |
56 | &General::writehash("${General::swroot}/asterisk/settings", \%asterisksettings); | |
57 | } | |
58 | ||
59 | system("/usr/local/bin/asteriskoff >/dev/null 2>&1"); | |
60 | system("/bin/sleep 2"); | |
61 | system("/usr/local/bin/amportalconf >/dev/null 2>&1"); | |
62 | system("/usr/local/bin/asteriskmodules >/dev/null 2>&1"); | |
63 | system("/usr/local/bin/asteriskon >/dev/null 2>&1"); | |
64 | &General::log('Asterisk config changed'); | |
65 | } | |
66 | ||
67 | &General::readhash("${General::swroot}/asterisk/settings", \%asterisksettings); | |
68 | ||
69 | $checked{'ENABLE_AST'}{'off'} = ''; | |
70 | $checked{'ENABLE_AST'}{'on'} = ''; | |
71 | $checked{'ENABLE_AST'}{$asterisksettings{'ENABLE_AST'}} = 'CHECKED'; | |
72 | ||
73 | $checked{'ENABLE_CAPI'}{'off'} = ''; | |
74 | $checked{'ENABLE_CAPI'}{'on'} = ''; | |
75 | $checked{'ENABLE_CAPI'}{$asterisksettings{'ENABLE_CAPI'}} = 'CHECKED'; | |
76 | ||
77 | $checked{'ENABLE_ZAP'}{'off'} = ''; | |
78 | $checked{'ENABLE_ZAP'}{'on'} = ''; | |
79 | $checked{'ENABLE_ZAP'}{$asterisksettings{'ENABLE_ZAP'}} = 'CHECKED'; | |
80 | ||
81 | if ($errormessage) { | |
82 | &Header::openbox('100%', 'LEFT', $tr{'error messages'}); | |
83 | print "<FONT CLASS='base'>$errormessage </FONT>\n"; | |
84 | &Header::closebox(); | |
85 | } | |
86 | ||
87 | if ($message) { | |
88 | &Header::openbox('100%', 'LEFT', 'Message'); | |
89 | print "<FONT CLASS='base'>$message </FONT>\n"; | |
90 | &Header::closebox(); | |
91 | } | |
92 | ||
93 | print "<FORM METHOD='POST'>\n"; | |
94 | ||
95 | &Header::openbox('100%', 'LEFT', 'Status:'); | |
96 | print <<END | |
97 | <center> | |
98 | <TABLE WIDTH='100%'> | |
99 | <TR> | |
100 | <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'><IMG SRC='/images/logoasterisk.gif' HEIGHT='100' BORDER='0' ALT='asterisk'></TD> | |
101 | <TD WIDTH='33%' ALIGN='RIGHT'>Aktiviert:</TD> | |
102 | <TD WIDTH='33%' ALIGN='LEFT'> <INPUT TYPE='checkbox' NAME='ENABLE_AST' $checked{'ENABLE_AST'}{'on'}></TD> | |
103 | </TR> | |
104 | <TR> | |
105 | <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'>Load CAPI kernel modules:</TD> | |
106 | <TD WIDTH='33%' ALIGN='RIGHT'>Aktiviert:</TD> | |
107 | <TD WIDTH='33%' ALIGN='LEFT'> <INPUT TYPE='checkbox' NAME='ENABLE_CAPI' $checked{'ENABLE_CAPI'}{'on'}></TD> | |
108 | </TR> | |
109 | <TR> | |
110 | <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'>Load ZAP kernel modules:</TD> | |
111 | <TD WIDTH='33%' ALIGN='RIGHT'>Aktiviert:</TD> | |
112 | <TD WIDTH='33%' ALIGN='LEFT'> <INPUT TYPE='checkbox' NAME='ENABLE_ZAP' $checked{'ENABLE_ZAP'}{'on'}></TD> | |
113 | </TR> | |
114 | <TR> | |
115 | <TD WIDTH='33%'> </TD> | |
116 | <TD WIDTH='33%' ALIGN='CENTER'><INPUT TYPE='submit' NAME='ACTION' VALUE='$Lang::tr{'save'}'></TD> | |
117 | <TD WIDTH='33%'> </TD> | |
118 | </TR> | |
119 | ||
120 | </TABLE> | |
121 | END | |
122 | ; | |
123 | ||
124 | &Header::closebox(); | |
125 | ||
126 | &Header::openbox('100%', 'LEFT', 'Asterisk:'); | |
127 | print <<END | |
128 | <center> | |
129 | <TABLE WIDTH='100%'> | |
130 | <TR> | |
131 | <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'> </TD> | |
132 | <TD WIDTH='33%' ALIGN='center'><a href="/cgi-bin/asterisk/conf.cgi">Konfiguration</TD> | |
133 | <TD WIDTH='33%' ALIGN='LEFT'> </TD> | |
134 | </TR> | |
135 | <TR> | |
136 | <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'> </TD> | |
137 | <TD WIDTH='33%' ALIGN='center'><a href="/cgi-bin/asterisk/calls.cgi">Anrufe</TD> | |
138 | <TD WIDTH='33%' ALIGN='LEFT'> </TD> | |
139 | </TR> | |
140 | </TABLE> | |
141 | END | |
142 | ; | |
143 | &Header::closebox(); | |
144 | ||
145 | &Header::closebigbox(); | |
146 | ||
147 | &Header::closepage(); |