Added option for firewall adjustment on blue
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 4 Feb 2008 06:47:55 +0000 (06:47 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 4 Feb 2008 06:47:55 +0000 (06:47 +0000)
Added the Asterisk GUI written by Peter
Changed the style of the graphs

git-svn-id: http://svn.ipfire.org/svn/ipfire/branches/2.1/trunk@1183 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

17 files changed:
config/cfgroot/graphs.pl
config/menu/20-status.menu
config/menu/EX-asterisk.menu [new file with mode: 0644]
config/rootfiles/packages/asterisk
doc/language_issues.de
doc/language_issues.en
html/cgi-bin/asterisk/calls.cgi [new file with mode: 0644]
html/cgi-bin/asterisk/conf.cgi [new file with mode: 0644]
html/cgi-bin/asterisk/conf/telbook.conf [new file with mode: 0644]
html/cgi-bin/asterisk/status.cgi [new file with mode: 0644]
html/cgi-bin/optionsfw.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
lfs/asterisk
src/initscripts/init.d/asterisk
src/misc-progs/wirelessctrl.c
src/scripts/asterisk [new file with mode: 0644]

index a01b4cc..a58b8f3 100644 (file)
@@ -264,7 +264,7 @@ sub updatediskgraph {
         "COMMENT:$Lang::tr{'minimal'}",
         "COMMENT:$Lang::tr{'current'}\\j",
         "AREA:st".$color{"color20"}."A0:standby\\j",
-        "AREA:read".$color{"color14"}."A0:".sprintf("%-25s",$Lang::tr{'read bytes'}),
+        "AREA:read".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'read bytes'}),
         "GPRINT:read:MAX:%8.1lf %sBps",
         "GPRINT:read:AVERAGE:%8.1lf %sBps",
         "GPRINT:read:MIN:%8.1lf %sBps",
index a66b4ec..84a6ff0 100644 (file)
                                'title' => "$Lang::tr{'network other'}",
                                'enabled' => 1,
                          };
-               $substatus->{'50.proxygraphs'} = {
-                               'caption' => $Lang::tr{'ssproxy graphs'},
-                               'uri' => '/cgi-bin/proxygraphs.cgi',
-                               'title' => "$Lang::tr{'ssproxy graphs'}",
-                               'enabled' => 1,
-                               };
     $substatus->{'60.hardwaregraphs'} = {
                                'caption' => "$Lang::tr{'hardware graphs'}",
                                'uri' => '/cgi-bin/hardwaregraphs.cgi',
diff --git a/config/menu/EX-asterisk.menu b/config/menu/EX-asterisk.menu
new file mode 100644 (file)
index 0000000..506fb6d
--- /dev/null
@@ -0,0 +1,15 @@
+    $subipfire->{'31.asterisk'} = {'caption' => 'Asterisk Status',
+                                  'uri' => '/cgi-bin/asterisk/status.cgi',
+                                  'title' => 'Asterisk Status',
+                                  'enabled' => 1,
+                                  };
+    $subipfire->{'32.asterisk'} = {'caption' => 'Asterisk Config',
+                                  'uri' => '/cgi-bin/asterisk/conf.cgi',
+                                  'title' => 'Asterisk Config',
+                                  'enabled' => 1,
+                                  };
+    $subipfire->{'33.asterisk'} = {'caption' => 'Asterisk Calls',
+                                  'uri' => '/cgi-bin/asterisk/calls.cgi',
+                                  'title' => 'Asterisk Calls',
+                                  'enabled' => 1,
+                                  };
index de9a842..3ccf804 100644 (file)
@@ -1,4 +1,8 @@
 etc/init.d/asterisk
+var/ipfire/menu.d/EX-asterisk.menu
+var/ipfire/asterisk
+srv/web/ipfire/cgi-bin/asterisk
+usr/sbin/asterisk
 #usr/include/asterisk
 #usr/include/asterisk.h
 #usr/include/asterisk/abstract_jb.h
index 503c703..e64532b 100644 (file)
@@ -155,6 +155,7 @@ WARNING: translation string unused: hint
 WARNING: translation string unused: host
 WARNING: translation string unused: host configuration
 WARNING: translation string unused: hostname and domain already in use
+WARNING: translation string unused: hour
 WARNING: translation string unused: hours2
 WARNING: translation string unused: ibod for dual isdn only
 WARNING: translation string unused: id
index f300830..ba59472 100644 (file)
@@ -181,6 +181,7 @@ WARNING: translation string unused: hint
 WARNING: translation string unused: host
 WARNING: translation string unused: host configuration
 WARNING: translation string unused: hostname and domain already in use
+WARNING: translation string unused: hour
 WARNING: translation string unused: hours2
 WARNING: translation string unused: ibod for dual isdn only
 WARNING: translation string unused: id
diff --git a/html/cgi-bin/asterisk/calls.cgi b/html/cgi-bin/asterisk/calls.cgi
new file mode 100644 (file)
index 0000000..c5877b2
--- /dev/null
@@ -0,0 +1,132 @@
+#!/usr/bin/perl
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+&Header::showhttpheaders();
+
+my (%asterisksettings, %checked);
+
+my %cgiparams;
+
+&Header::getcgihash(\%cgiparams);
+
+$asterisksettings{'ACTION'} = '';
+
+$file = "/var/log/asterisk/cdr-csv/Master.csv";
+
+open(DATEN, "$file") or die "Can't open file: $file: $!\n";
+@datafile = <DATEN>;
+close(DATEN);
+
+$file = "./conf/telbook.conf";
+open(DATEN, "$file") or die "Can't open file: $file: $!\n";
+@telbook = <DATEN>;
+close(DATEN);
+
+&Header::openpage('asterisk', 1, '');
+
+&Header::openbigbox('100%', 'LEFT');
+
+if ($cgiparams{'ACTION'} eq $Lang::tr{'update'})
+{
+ $mday3     = $cgiparams{'day3'};
+ $mon3     = $cgiparams{'month3'};
+ $jahr3     = $cgiparams{'year3'};
+ $mday4     = $cgiparams{'day4'};
+ $mon4      = $cgiparams{'month4'};
+ $jahr4     = $cgiparams{'year4'};
+}
+else
+{
+ @datum3    = localtime(time());
+ ($sec3,$min3,$stunde3,$mday3,$mon3,$jahr3,$wday3,$yday3,$isdst3)=@datum3;
+ $jahr3     = $jahr3 + 1900;
+ $mon3      = $mon3+1;
+ if ($mon3 < 10) { $mon3 = "0$mon3"; }
+ if ($mday3 <10) { $mday3= "0$mday3";}
+ $sec4      = $sec3;
+ $min4      = $min3;
+ $stunde4   = $stunde3;
+ $mday4     = $mday3;
+ $mon4      = $mon3;
+ $jahr4     = $jahr3;
+ $wday4     = $wday3;
+ $isdst4    = $isdst3;
+}
+
+if ($errormessage) {
+       &openbox('100%', 'LEFT', $tr{'error messages'});
+       print "<FONT CLASS='base'>$errormessage&nbsp;</FONT>\n";
+       &closebox();
+}
+
+print "<FORM METHOD='POST'>\n";
+
+&Header::openbox('100%', 'LEFT', 'Filter');
+
+print <<END
+<center><table border=0><tr><td>&nbsp;</td><td width=50px>Tag:</td><td width=50px>Monat:</td><td width=50px>Jahr:</td></tr>
+<tr><td>Von: <td><input type=text name=day3 maxlength=2 size=2 value="$mday3"><td><input type=text name=month3 maxlength=2 size=2 value="$mon3"><td><input type=text name=year3 maxlength=4 size=4 value="$jahr3">
+<tr><td>Bis: <td><input type=text name=day4 maxlength=2 size=2 value="$mday4"><td><input type=text name=month4 maxlength=2 size=2 value="$mon4"><td><input type=text name=year4 maxlength=4 size=4 value="$jahr4">
+
+<tr><td colspan=2>Von oder zum Anrufer mit der ID/Nummer:<td colspan=2><input type=text name=number size=20 maxlength=100 value="$cgiparams{'number'}">
+
+<tr><td align=center colspan=4><input type=submit name='ACTION' value=$Lang::tr{'update'}>
+</table>
+END
+;
+
+&Header::closebox();
+
+&Header::openbox('100%', 'LEFT', 'Anrufe');
+print "<table border=0 width=100%>     <tr>                            <td align=center><b>Anfrufer    <td align=center><b>Angerufene  <td align=center><b>CallerID    <td align=center><b>Start des Anrufs                    <td align=center><b>Ende des Anrufs                     <td align=center><b>Dauer (in Sek.)     <td align=center><b>Status";
+print "<tr><td colspan=6>&nbsp;<!-- Platzhalter -->";
+foreach $line (reverse @datafile) {
+chomp $line;
+(@spalten) = split (/,/, $line);
+$spalten[1] =~ s/"//g;
+$spalten[2] =~ s/"//g;
+$spalten[4] =~ s/"//g;
+$spalten[10]=~ s/"//g;
+$spalten[11]=~ s/"//g;
+$spalten[13]=~ s/"//g;
+$spalten[14]=~ s/"//g;
+(@zdatum) = split (/ /, $spalten[11]);
+(@datu)   = split (/-/, $zdatum[0]);
+(@dzeit)  = split (/:/, $zdatum[1]);
+$datum1   = $datu[0].$datu[1].$datu[2];
+@datum2_1   = localtime(time());
+($sec,$min,$stunde,$mday,$mon,$jahr,$wday,$yday,$isdst)=@datum2_1;
+$jahr     = $jahr + 1900;
+$mon      = $mon+1;
+if ($mon < 10) { $mon = "0$mon"; }
+if ($mday <10) { $mday= "0$mday";}
+$datum2   = $jahr.$mon.$mday;
+$datum3_1 = $jahr3.$mon3.$mday3;
+$datum4_1 = $jahr4.$mon4.$mday4;
+$datum2          = $datum2-100;
+if ($datum1 ge $datum3_1 && $datum1 le $datum4_1 && ($cgiparams{'number'} eq '' || $cgiparams{'number'} eq $spalten[1] || $cgiparams{'number'} eq $spalten[2])) {
+$telline = @telbook[0];
+$telline =~ s/\[telnr\]/$spalten[1]/g;
+$dauer_m = int($spalten[13]/60);
+$dauer_s = $spalten[13]%60;
+$dauer_h = int($spalten[13]/3600);
+$dauer_m2= $dauer_m-($dauer_h*60);
+$dauer_t = $dauer_h.":";
+if ($dauer_m2 < 10) { $dauer_t .= "0".$dauer_m2."."; }
+ else { $dauer_t .= $dauer_m2."."; }
+if ($dauer_s < 10) { $dauer_t .= "0".$dauer_s; }
+ else { $dauer_t .= $dauer_s; }
+print                                  "<tr bgcolor=#C0C0C0>   <td align=center><a target='_blank' href=$telline> $spalten[1]</a>      <td align=center>$spalten[2]    <td align=center>$spalten[4]    <td align=center bgcolor=#339933>$spalten[10]           <td align=center bgcolor=#339933>$spalten[11]           <td align=center>$dauer_t               <td align=center bgcolor='#993333'><font color=white>$spalten[14]\n";}
+}
+print "</table>";
+
+&Header::closebox();
+
+print "</FORM>\n";
+
+&Header::closebigbox();
+
+&Header::closepage();
diff --git a/html/cgi-bin/asterisk/conf.cgi b/html/cgi-bin/asterisk/conf.cgi
new file mode 100644 (file)
index 0000000..2dd8cf0
--- /dev/null
@@ -0,0 +1,161 @@
+#!/usr/bin/perl
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+&Header::showhttpheaders();
+
+my %cgiparams;
+
+&Header::getcgihash(\%cgiparams);
+
+&Header::openpage('asterisk', 1, '');
+
+&Header::openbigbox('100%', 'LEFT');
+
+if ($cgiparams{'ACTION'} eq $Lang::tr{'save'})
+  {
+        $conf_file = $cgiparams{'save_path'};
+        open (FILE, ">$conf_file") or die "Kann die Datei nicht speichern: $!";
+        flock (FILE, 2);
+        print FILE "$cgiparams{'textarea'}";
+        close FILE;
+        &Header::openbox('100%', 'LEFT', 'info');
+        print "$conf_file wurde gespeichert";
+        &Header::closebox();
+  }
+
+if ($cgiparams{'ACTION'} eq Bearbeiten)
+  {
+        $conf_file = $cgiparams{'conf_file'};
+  }
+
+if ($conf_file eq '') {
+       $conf_file='/var/ipfire/asterisk/extensions.conf';
+  }
+
+if ($cgiparams{'ACTION'} eq extensions)
+  {
+       $conf_file='/var/ipfire/asterisk/extensions.conf';
+  }
+
+if ($cgiparams{'ACTION'} eq sip)
+  {
+       $conf_file='/var/ipfire/asterisk/sip.conf';
+  }
+
+if ($cgiparams{'ACTION'} eq iax)
+  {
+       $conf_file='/var/ipfire/asterisk/iax.conf';
+  }
+
+
+
+
+if ($errormessage) {
+       &Header::openbox('100%', 'LEFT', $tr{'error messages'});
+       print "<FONT CLASS='base'>$errormessage&nbsp;</FONT>\n";
+       &Header::closebox();
+}
+
+$cgiparams{'ACTION'} = '';
+
+print "<FORM METHOD='POST'>\n";
+
+if ($conf_file ne '') {
+
+&Header::openbox('100%', 'LEFT', $conf_file);
+       print <<END
+               <center><table border=0> 
+                       <tr><td><textarea name="textarea" cols="80" rows="20" wrap="VIRTUAL">
+END
+;
+system("cat $conf_file");
+print <<END
+</textarea>\n 
+
+       <tr><td align=center>
+       <p><input type=text name=save_path value=$conf_file size=25>
+       <p><input type=submit name=ACTION value=$Lang::tr{'save'}>
+       </table>
+
+END
+;
+
+&Header::closebox();
+}
+
+&Header::openbox('100%', 'LEFT', 'Dateiauswahl');
+
+my $dir = '/var/ipfire/asterisk/';
+my @dateien;
+
+listFiles ($dir);
+
+print <<END
+<table width=100% border=0>
+<tr><td width=33% align=right>
+    <!-- Buttons -->
+       <input type=submit name=ACTION value=extensions><input type=submit name=ACTION value=sip><input type=submit name=ACTION value=iax>
+    <td width=33% align=right>
+       <center><select name=conf_file>
+END
+;
+foreach $line (sort (@dateien)) {
+$op_name =  $line;
+$op_name =~ s/$dir//g;
+print "<option value='$line'>$op_name</option>\n";
+}
+
+my $dir2 = '/home/httpd/cgi-bin/asterisk/conf/';
+my @dateien2;
+
+listFiles2 ($dir2);
+
+foreach $line2 (sort (@dateien2)) {
+$op_name2 =  $line2;
+$op_name2 =~ s/$dir2//g;
+print "<option value='$line2'>$op_name2</option>\n";
+}
+
+print "</select><input type=submit name=ACTION value=Bearbeiten></center><td width=33% align=right>&nbsp</table>";
+
+sub listFiles {
+local *DH;
+my ($item, $pfad);
+my $dir = shift;
+
+opendir (DH, $dir) or return;
+while ($item = readdir (DH)) {
+next if ( $item =~ /^\./ );
+$pfad = ( ($dir =~ /\/$/) ? ($dir . $item) : ($dir . '/'.$item) );
+push (@dateien, $pfad) if (-f $pfad);
+listFiles ($pfad) if (-d $pfad);
+}
+closedir (DH);
+}
+
+sub listFiles2 {
+local *DH2;
+my ($item2, $pfad2);
+my $dir2 = shift;
+
+opendir (DH2, $dir2) or return;
+while ($item2 = readdir (DH2)) {
+next if ( $item2 =~ /^\./ );
+$pfad2 = ( ($dir2 =~ /\/$/) ? ($dir2 . $item2) : ($dir2 . '/'.$item2) );
+push (@dateien2, $pfad2) if (-f $pfad2);
+listFiles2 ($pfad2) if (-d $pfad2);
+}
+closedir (DH2);
+}
+
+
+&Header::closebox();
+
+print "</FORM>\n";
+
+&Header::closebigbox();
+
+&Header::closepage();
diff --git a/html/cgi-bin/asterisk/conf/telbook.conf b/html/cgi-bin/asterisk/conf/telbook.conf
new file mode 100644 (file)
index 0000000..b2a1d6a
--- /dev/null
@@ -0,0 +1 @@
+http://tel.search.ch/result.html?name=&misc=&strasse=&ort=&kanton=&tel=[telnr]
diff --git a/html/cgi-bin/asterisk/status.cgi b/html/cgi-bin/asterisk/status.cgi
new file mode 100644 (file)
index 0000000..12c4c9f
--- /dev/null
@@ -0,0 +1,101 @@
+#!/usr/bin/perl
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+&Header::showhttpheaders();
+
+my %asterisksettings;
+
+&Header::getcgihash(\%asterisksettings);
+
+&Header::openpage('asterisk', 1, '');
+
+&Header::openbigbox('100%', 'LEFT');
+
+if ($asterisksettings{'ACTION'} eq 'Start')
+{
+       system("/etc/init.d/asterisk start >/dev/null 2>&1");
+       sleep 5;
+}
+if ($asterisksettings{'ACTION'} eq $Lang::tr{'stop'})
+{
+        system("/etc/init.d/asterisk stop >/dev/null 2>&1");
+        sleep 5;
+}
+if ($asterisksettings{'ACTION'} eq $Lang::tr{'reboot'})
+{
+        system("/etc/init.d/asterisk restart >/dev/null 2>&1");
+        sleep 5;
+}
+if ($asterisksettings{'ACTION'} eq "$Lang::tr{'reload'} EXT")
+{
+        system("/etc/init.d/asterisk remod ext >/dev/null 2>&1");
+}
+if ($asterisksettings{'ACTION'} eq "$Lang::tr{'reload'} SIP")
+{
+        system("/etc/init.d/asterisk remod sip >/dev/null 2>&1");
+}
+if ($asterisksettings{'ACTION'} eq "$Lang::tr{'reload'} IAX")
+{
+        system("/etc/init.d/asterisk remod iax >/dev/null 2>&1");
+}
+
+$checked{'ENABLE_AST'}{'status'} = system("/etc/init.d/asterisk status >/dev/null 2>&1");
+if ($checked{'ENABLE_AST'}{'status'}) {
+       $checked{'ENABLE_AST'}{'status_s'}="<font style=\"color:white;background-color:red;\"> $Lang::tr{'not running'}</font>";
+       $checked{'ENABLE_AST'}{'status_b'}="<INPUT TYPE='submit' NAME='ACTION' VALUE='Start'>";
+} else {
+       $checked{'ENABLE_AST'}{'status_s'}="<font style=\"color:white;background-color:green;\"> $Lang::tr{'running'}</font>";
+       $checked{'ENABLE_AST'}{'status_b'}="<INPUT TYPE='submit' NAME='ACTION' VALUE='$Lang::tr{'reboot'}'><INPUT TYPE='submit' NAME='ACTION' VALUE='$Lang::tr{'stop'}'>";
+}
+
+if ($errormessage) {
+       &Header::openbox('100%', 'LEFT', $tr{'error messages'});
+       print "<FONT CLASS='base'>$errormessage&nbsp;</FONT>\n";
+       &Header::closebox();
+}
+
+if ($message) {
+       &Header::openbox('100%', 'LEFT', 'Message');
+       print "<FONT CLASS='base'>$message&nbsp;</FONT>\n";
+       &Header::closebox();
+}
+
+print "<FORM METHOD='POST'>\n";
+
+&Header::openbox('100%', 'LEFT', 'Status:');
+       print <<END
+               <center>
+<TABLE WIDTH='100%'>
+<TR>
+       <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'>Asterisk</TD>
+       <TD WIDTH='33%' ALIGN='RIGHT'>$checked{'ENABLE_AST'}{'status_s'}</TD>
+       <TD WIDTH='33%' ALIGN='LEFT'>$checked{'ENABLE_AST'}{'status_b'}</TD>
+</TR>
+<TR>
+       <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'>Dialplan</TD>
+       <TD WIDTH='33%' ALIGN='RIGHT'></TD>
+       <TD WIDTH='33%' ALIGN='LEFT'> <INPUT TYPE='submit' NAME='ACTION' VALUE='$Lang::tr{'reload'} EXT'></TD>
+</TR>
+<TR>
+        <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'>SIP</TD>
+        <TD WIDTH='33%' ALIGN='RIGHT'></TD>
+        <TD WIDTH='33%' ALIGN='LEFT'> <INPUT TYPE='submit' NAME='ACTION' VALUE='$Lang::tr{'reload'} SIP'></TD>
+</TR>
+<TR>
+        <TD WIDTH='33%' CLASS='base' ALIGN='RIGHT'>IAX</TD>
+        <TD WIDTH='33%' ALIGN='RIGHT'></TD>
+        <TD WIDTH='33%' ALIGN='LEFT'> <INPUT TYPE='submit' NAME='ACTION' VALUE='$Lang::tr{'reload'} IAX'></TD>
+</TR>
+
+</TABLE>
+END
+;
+
+&Header::closebox();
+
+&Header::closebigbox();
+
+&Header::closepage();
index de68fea..cfbd101 100644 (file)
@@ -32,6 +32,8 @@ $settings{'DROPNEWNOTSYN'} = 'on';
 $settings{'DROPINPUT'} = 'on';
 $settings{'DROPOUTPUT'} = 'on';
 $settings{'DROPPORTSCAN'} = 'on';
+$settings{'DROPWIRELESSINPUT'} = 'on';
+$settings{'DROPWIRELESSFORWARD'} = 'on';
 
 my $errormessage = '';
 my $warnmessage = '';
@@ -70,6 +72,12 @@ $checked{'DROPOUTPUT'}{$settings{'DROPOUTPUT'}} = "checked='checked'";
 $checked{'DROPPORTSCAN'}{'off'} = '';
 $checked{'DROPPORTSCAN'}{'on'} = '';
 $checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'";
+$checked{'DROPWIRELESSINPUT'}{'off'} = '';
+$checked{'DROPWIRELESSINPUT'}{'on'} = '';
+$checked{'DROPWIRELESSINPUT'}{$settings{'DROPWIRELESSINPUT'}} = "checked='checked'";
+$checked{'DROPWIRELESSFORWARD'}{'off'} = '';
+$checked{'DROPWIRELESSFORWARD'}{'on'} = '';
+$checked{'DROPWIRELESSFORWARD'}{$settings{'DROPWIRELESSFORWARD'}} = "checked='checked'";
 
 &Header::openbox('100%', 'center', $Lang::tr{'options fw'});
 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
@@ -86,6 +94,10 @@ print <<END
                                                                                                                                                                                <input type='radio' name='DROPOUTPUT' value='off' $checked{'DROPOUTPUT'}{'off'} /> off</td></tr>
 <tr><td align='left' width='40%'>$Lang::tr{'drop portscan'}</td><td align='left'>on <input type='radio' name='DROPPORTSCAN' value='on' $checked{'DROPPORTSCAN'}{'on'} />/
                                                                                                                                                                                <input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr>
+<tr><td align='left' width='40%'>$Lang::tr{'drop wirelessinput'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSINPUT' value='on' $checked{'DROPWIRELESSINPUT'}{'on'} />/
+                                                                                                                                                                               <input type='radio' name='DROPWIRELESSINPUT' value='off' $checked{'DROPWIRELESSINPUT'}{'off'} /> off</td></tr>
+<tr><td align='left' width='40%'>$Lang::tr{'drop wirelessforward'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSFORWARD' value='on' $checked{'DROPWIRELESSFORWARD'}{'on'} />/
+                                                                                                                                                                               <input type='radio' name='DROPWIRELESSFORWARD' value='off' $checked{'DROPWIRELESSFORWARD'}{'off'} /> off</td></tr>
 </table>
 <br />
 <table width='10%' cellspacing='0'>
index a812923..602c2bb 100644 (file)
 'drop newnotsyn' => 'Verworfene New Not Syn Pakete loggen',
 'drop output' => 'Verworfene Output Pakete loggen',
 'drop portscan' => 'Verworfene Portscan Pakete loggen',
+'drop wirelessforward' => 'Verworfene Wireless Forward Pakete loggen',
+'drop wirelessinput' => 'Verworfene Wireless Input Pakete loggen',
 'dst port' => 'Ziel-Port',
 'dstprt range overlaps' => 'Der Zielportbereich ├╝berlappt mit einem bereits definierten Port.',
 'dstprt within existing' => 'Der Zielport liegt innerhalb eines bereits definierten Portbereichs.',
index 6e654f4..06b0c88 100644 (file)
 'drop newnotsyn' => 'Log dropped New Not Syn pakets',
 'drop output' => 'Log dropped Output pakets',
 'drop portscan' => 'Log dropped Portscan pakets',
+'drop wirelessforward' => 'Log dropped wireless Forward pakets',
+'drop wirelessinput' => 'Log dropped wireless Input pakets',
 'dst port' => 'Dst Port',
 'dstprt range overlaps' => 'Destination port range overlaps an already defined port.',
 'dstprt within existing' => 'Destination port is within an already defined port range.',
index ecf9c31..6dadd0c 100644 (file)
@@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = asterisk
-PAK_VER    = 1
+PAK_VER    = 2
 
 DEPS       = "sox zaptel libpri spandsp libmad"
 
@@ -109,4 +109,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        tar xfz $(DIR_DL)/asterisk-1.4-de-prompts.tar.gz -C /var/lib/asterisk/sounds/
        -rm -f /var/lib/asterisk/sounds/README.txt
        @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-*
+       -mkdir -p /var/ipfire/asterisk
+       cp -vrf $(DIR_SRC)/config/asterisk/* /var/ipfire/asterisk/
+       chmod o+w /var/ipfire/asterisk
+       ln -f -s /var/ipfire/asterisk/wakeup/wakeup.sh /etc/fcron.minutely/wakeup.sh
        @$(POSTBUILD)
index 223c016..5e04bfb 100644 (file)
@@ -18,6 +18,8 @@
 case "${1}" in
        start)
                boot_mesg "Starting Asterisk PBX..."
+               /sbin/modprobe zaptel
+               /sbin/modprobe ztdummy
                loadproc /usr/sbin/asterisk
                ;;
 
@@ -40,11 +42,28 @@ case "${1}" in
                ;;
 
        status)
-               statusproc /usr/sbin/asterisk
+               statusproc /usr/sbin/asterisk > /tmp/ast 2>&1
+               STAT=$(cat /tmp/ast)
+               /bin/rm -f /tmp/ast
+               echo $STAT
+               EX_Z=$(echo $STAT | grep "not" | wc -l)
+               exit $EX_Z
+               ;;
+
+       remod)
+               case "${2}" in
+                       sip)asterisk -rx "sip reload" >/dev/null 2>&1 ;;
+                       iax)asterisk -rx "iax2 reload" >/dev/null 2>&1 ;;
+                       ext)asterisk -rx "dialplan reload" >/dev/null 2>&1 ;;
+                       *) echo "Usage: ${0} remod {sip|iax|ext}"; exit 1 ;;
+               esac
+               ;;
+
+       test) touch /tmp/test$$
                ;;
 
        *)
-               echo "Usage: ${0} {start|stop|reload|restart|status}"
+               echo "Usage: ${0} {start|stop|reload|restart|status|remod}"
                exit 1
                ;;
 esac
index 51f3f25..321addf 100644 (file)
@@ -19,6 +19,7 @@
 #include <sys/stat.h>
 #include <signal.h>
 #include "setuid.h"
+#include <errno.h>
 
 FILE *fd = NULL;
 char blue_dev[STRING_SIZE] = "";
@@ -26,11 +27,21 @@ char command[STRING_SIZE];
 
 void exithandler(void)
 {
+  struct keyvalue *kv = NULL;
+  char buffer[STRING_SIZE];
        if(strlen(blue_dev))
        {
-               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG_DROP", blue_dev);
+        if(findkey(kv, "DROPWIRELESSINPUT", buffer) && !strcmp(buffer,"on")){
+               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG --log-prefix 'DROP_Wirelessinput'", blue_dev);
                safe_system(command);
-               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG_DROP", blue_dev);
+               }
+        if(findkey(kv, "DROPWIRELESSFORWARD", buffer) && !strcmp(buffer,"on")){
+               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG --log-prefix 'DROP_Wirelessforward'", blue_dev);
+               safe_system(command);
+               }
+               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j DROP -m comment --comment 'DROP_Wirelessinput'", blue_dev);
+               safe_system(command);
+               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j DROP -m comment --comment 'DROP_Wirelessforward'", blue_dev);
                safe_system(command);
        }
 
@@ -64,6 +75,13 @@ int main(void)
                exit(1);
        }
 
+       /* Read in the firewall values */
+       if (!readkeyvalues(kv, CONFIG_ROOT "/optionsfw/settings"))
+       {
+               fprintf(stderr, "Cannot read optionsfw settings\n");
+               exit(1);
+       }
+
        /* Get the GREEN interface details */
        if(!findkey(kv, "GREEN_DEV", green_dev))
        {
diff --git a/src/scripts/asterisk b/src/scripts/asterisk
new file mode 100644 (file)
index 0000000..cb6ccbb
Binary files /dev/null and b/src/scripts/asterisk differ