From a6ae250626448753ec25daa5b8bf84fdcc431871 Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 24 Sep 2010 11:57:54 -0400 Subject: More DOS line endings fixes. --- config/dnsblacklist/dnsblacklist.tmp | 434 ++++++++++++------------ config/dnsblacklist/dnsblacklist.tmp.old | 552 +++++++++++++++---------------- config/freeswitch/disa.js | 156 ++++----- config/freeswitch_dev/disa.js | 156 ++++----- config/ipblocklist/convert.pl | 134 ++++---- 5 files changed, 716 insertions(+), 716 deletions(-) (limited to 'config') diff --git a/config/dnsblacklist/dnsblacklist.tmp b/config/dnsblacklist/dnsblacklist.tmp index a00bdb82..73464608 100644 --- a/config/dnsblacklist/dnsblacklist.tmp +++ b/config/dnsblacklist/dnsblacklist.tmp @@ -1,217 +1,217 @@ -"; - //echo "\$category['$value'] = 'zzz';
\n"; - //$x++; - //} - //unset($x); - //echo "
";
-	//print_r($_POST["blacklist"]);
-	//echo "
"; - //foreach($_POST["blacklist"] as $key => $value) { - //echo "name: ".$value."
"; - //$x++; - //} - -if (count($_POST)>0) { - - conf_mount_rw(); - - $dnsmasqfile = "/usr/local/etc/dnsmasq.conf"; - $targetfile = "/usr/local/etc/dnsmasq.blacklist.conf"; - $includestring = "conf-file=/usr/local/etc/dnsmasq.blacklist.conf"; - $dnsmasqconf = "/usr/local/etc/dnsmasq.conf"; - - //clear previous values - $ent = array(); - foreach($category as $key => $value) { - $ent[$key] = '0'; - } - $config['installedpackages']['dnsblacklist']['config'][0] = $ent; - //write_config(); - - //truncate the dnsmasq.blacklist.conf file - if (file_exists($targetfile)) { - $fh = fopen($targetfile, 'w'); - fclose($fh); - } - - if ($_POST['enable'] == 1) { - //echo "enabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; - } - else { - //echo "disabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 0; - } - - //add the include entry for dnsmasq.blacklist.conf to dnsmasq.conf - if (file_exists($dnsmasqfile)) { - $getdnsmasq = file_get_contents($dnsmasqfile); - if(stristr($getdnsmasq,'conf-file=/usr/local/etc/dnsmasq.blacklist.conf') === TRUE) { - //include found no need to add it - } - else { - $myfhandle = fopen($dnsmasqconf, 'r+'); - fwrite($myfhandle, $includestring); - fclose($myfhandle); - } - } - else { - $my2fhandle = fopen($dnsmasqconf, 'x+'); - fwrite($my2fhandle, $includestring); - fclose($my2fhandle); - } - - //build the dnsmasq.blacklist.conf - if (count($_POST["blacklist"]) > 0) { - foreach($_POST["blacklist"] as $value) { - //set the current selected values - $blackfile = "blacklists/$value/domains"; - $config['installedpackages']['dnsblacklist']['config'][0][$value] = 1; - //if enabled write the selected categories to the dnsmasq.blacklist.conf - if ($config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] == 1) { - $fh2 = fopen($targetfile, 'a'); - $fh = fopen($blackfile,'r'); - while($line=fgets($fh)) { - //remove all characters other than alpha numeric period and dash - preg_match("/([a-zA-Z0-9.-]*)/i", $line, $arraymatches); - $line = $arraymatches[1]; - fwrite($fh2, "address=/" .$line. "/74.125.45.100". "\n"); - } - fclose($fh); - fclose($fh2); - } - } - } - - write_config(); - services_dnsmasq_configure(); - sleep(1); - $savemsg_dnsb = "DNS Blacklist settings have been saved. "; - conf_mount_ro(); -} -?> - - -

Services: DNS Blacklist

-
- -\n"; -} -else { - echo "\n"; -} -?> - -Enable DNS Blacklist

- -\n"; - if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - else { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - echo "\n"; - $x++; -} -echo "
- - -Below is a scroll-box filled with categories you can select to be added to your blacklist.

Each category has a list of known domains/sites that will be denied access by users of this network. -

(Note: Using all categories at once will require 300Mb of free memory. The adult category is rather memory intensive, requiring 200Mb.) -


- - -
-\n"; -foreach($category as $key => $value) { - $domain_count = line_number("blacklists/$key/domains"); - echo "
".$value['name_en']."".$value['desc_en']."($domain_count domains)".$value['name_en']."".$value['desc_en']."($domain_count domains)
\n"; - -?> - -
-
- - "Edit Category", ); -////$tmp_category = str_replace(" ", " ", $category); -//echo "\n"; -?> - -"; -?> - - - - -
- - - - - \ No newline at end of file +"; + //echo "\$category['$value'] = 'zzz';
\n"; + //$x++; + //} + //unset($x); + //echo "
";
+	//print_r($_POST["blacklist"]);
+	//echo "
"; + //foreach($_POST["blacklist"] as $key => $value) { + //echo "name: ".$value."
"; + //$x++; + //} + +if (count($_POST)>0) { + + conf_mount_rw(); + + $dnsmasqfile = "/usr/local/etc/dnsmasq.conf"; + $targetfile = "/usr/local/etc/dnsmasq.blacklist.conf"; + $includestring = "conf-file=/usr/local/etc/dnsmasq.blacklist.conf"; + $dnsmasqconf = "/usr/local/etc/dnsmasq.conf"; + + //clear previous values + $ent = array(); + foreach($category as $key => $value) { + $ent[$key] = '0'; + } + $config['installedpackages']['dnsblacklist']['config'][0] = $ent; + //write_config(); + + //truncate the dnsmasq.blacklist.conf file + if (file_exists($targetfile)) { + $fh = fopen($targetfile, 'w'); + fclose($fh); + } + + if ($_POST['enable'] == 1) { + //echo "enabled"; + $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; + } + else { + //echo "disabled"; + $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 0; + } + + //add the include entry for dnsmasq.blacklist.conf to dnsmasq.conf + if (file_exists($dnsmasqfile)) { + $getdnsmasq = file_get_contents($dnsmasqfile); + if(stristr($getdnsmasq,'conf-file=/usr/local/etc/dnsmasq.blacklist.conf') === TRUE) { + //include found no need to add it + } + else { + $myfhandle = fopen($dnsmasqconf, 'r+'); + fwrite($myfhandle, $includestring); + fclose($myfhandle); + } + } + else { + $my2fhandle = fopen($dnsmasqconf, 'x+'); + fwrite($my2fhandle, $includestring); + fclose($my2fhandle); + } + + //build the dnsmasq.blacklist.conf + if (count($_POST["blacklist"]) > 0) { + foreach($_POST["blacklist"] as $value) { + //set the current selected values + $blackfile = "blacklists/$value/domains"; + $config['installedpackages']['dnsblacklist']['config'][0][$value] = 1; + //if enabled write the selected categories to the dnsmasq.blacklist.conf + if ($config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] == 1) { + $fh2 = fopen($targetfile, 'a'); + $fh = fopen($blackfile,'r'); + while($line=fgets($fh)) { + //remove all characters other than alpha numeric period and dash + preg_match("/([a-zA-Z0-9.-]*)/i", $line, $arraymatches); + $line = $arraymatches[1]; + fwrite($fh2, "address=/" .$line. "/74.125.45.100". "\n"); + } + fclose($fh); + fclose($fh2); + } + } + } + + write_config(); + services_dnsmasq_configure(); + sleep(1); + $savemsg_dnsb = "DNS Blacklist settings have been saved. "; + conf_mount_ro(); +} +?> + + +

Services: DNS Blacklist

+
+ +\n"; +} +else { + echo "\n"; +} +?> + +Enable DNS Blacklist

+ +\n"; + if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + else { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + $x++; +} +echo "
+ + +Below is a scroll-box filled with categories you can select to be added to your blacklist.

Each category has a list of known domains/sites that will be denied access by users of this network. +

(Note: Using all categories at once will require 300Mb of free memory. The adult category is rather memory intensive, requiring 200Mb.) +


+ + +
+\n"; +foreach($category as $key => $value) { + $domain_count = line_number("blacklists/$key/domains"); + echo "
".$value['name_en']."".$value['desc_en']."($domain_count domains)".$value['name_en']."".$value['desc_en']."($domain_count domains)
\n"; + +?> + +
+
+ + "Edit Category", ); +////$tmp_category = str_replace(" ", " ", $category); +//echo "\n"; +?> + +"; +?> + + + + +
+ + + + + diff --git a/config/dnsblacklist/dnsblacklist.tmp.old b/config/dnsblacklist/dnsblacklist.tmp.old index e9fadf57..24d34412 100644 --- a/config/dnsblacklist/dnsblacklist.tmp.old +++ b/config/dnsblacklist/dnsblacklist.tmp.old @@ -1,276 +1,276 @@ -"; - //echo "\$category['$value'] = 'zzz';
\n"; - //$x++; - //} - //unset($x); - //echo "
";
-	//print_r($_POST["blacklist"]);
-	//echo "
"; - //foreach($_POST["blacklist"] as $key => $value) { - //echo "name: ".$value."
"; - //$x++; - //} - -if (count($_POST)>0) { - $dnsmasqfile = "/usr/local/etc/dnsmasq.conf"; - $targetfile = "/usr/local/etc/dnsmasq.blacklist.conf"; - $includestring = "conf-file=/usr/local/etc/dnsmasq.blacklist.conf"; - $dnsmasqconf = "/usr/local/etc/dnsmasq.conf"; - //clear previous values - foreach($category as $key => $value) { - $config['installedpackages']['dnsblacklist']['config'][0][$key] = ''; - } - if ($_POST['enable'] == 1) { - //echo "enabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; - } - else { - //echo "disabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 0; - } - //add the include entry for dnsmasq.blacklist.conf to dnsmasq.conf - if (file_exists($dnsmasqfile)) { - $getdnsmasq = file_get_contents($dnsmasqfile); - if(stristr($getdnsmasq,'conf-file=/usr/local/etc/dnsmasq.blacklist.conf') === TRUE) { - //include found no need to add it - } - else { - $myfhandle = fopen($dnsmasqconf, 'r+'); - fwrite($myfhandle, $includestring); - fclose($myfhandle); - } - } - else { - $my2fhandle = fopen($dnsmasqconf, 'x+'); - fwrite($my2fhandle, $includestring); - fclose($my2fhandle); - } - //truncate the dnsmasq.blacklist.conf file - if (file_exists($targetfile)) { - $fh = fopen($targetfile, 'w'); - fclose($fh); - } - //build the dnsmasq.blacklist.conf - if (count($_POST["blacklist"]) > 0) { - foreach($_POST["blacklist"] as $value) { - //set the current selected values - $blackfile = "blacklists/$value/domains"; - $config['installedpackages']['dnsblacklist']['config'][0][$value] = 1; - //if enabled write the selected categories to the dnsmasq.blacklist.conf - if ($config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] == 1) { - $fh2 = fopen($targetfile, 'a'); - $fh = fopen($blackfile,'r'); - while($line=fgets($fh)) { - fwrite($fh2, "address=/" .trim($line). "/74.125.45.100". "\n"); - } - fclose($fh); - fclose($fh2); - } - } - } - write_config(); - services_dnsmasq_configure(); - sleep(1); - $savemsg_dnsb = "DNS Blacklist settings have been saved."; -} -?> - - -

Services: DNS Blacklist

-
- -\n"; -} -else { - echo "\n"; -} -?> - -Enable DNS Blacklist

- -\n"; - if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { - // echo "\n"; - } - else { - // echo " \n"; - } - echo "\n"; - $x++; -} -echo "
- - -Below is a scroll-box filled with categories you can select to be added to your blacklist.

Each category has a list of known domains/sites that will be denied access by users of this network. -

(Note: Using all categories at once will require 300Mb of free memory. The adult and porn categories are rather memory intensive, requiring 200Mb together.) -


- -function ListFiles($dir) { - - if($dh = opendir($dir)) { - - $files = Array(); - $inner_files = Array(); - - while($file = readdir($dh)) { - if($file != "." && $file != ".." && $file[0] != '.') { - if(is_dir($dir . "/" . $file)) { - array_push($files, $dir); - //$inner_files = ListFiles($dir . "/" . $file); - //if(is_array($inner_files)) $files = array_merge($files, $inner_files); - } else { - //array_push($files, $dir . "/" . $file); - } - } - } - - closedir($dh); - return $files; - } -} - - -foreach (ListFiles('/usr/local/www/packages/dnsblacklist/') as $key=>$file){ - echo $file ."
\n"; -} - - - -
-\n"; -foreach($category as $key => $value) { - $domain_count = line_number("blacklists/$key/domains"); - //echo "name: ".$key."
"; - echo "
$key$value($domain_count domains)$key$value($domain_count domains)
\n"; -*/ -?> - -
-
- - "Edit Category", ); -////$tmp_category = str_replace(" ", " ", $category); -//echo "\n"; -?> - - - - - - -
- - - - - \ No newline at end of file +"; + //echo "\$category['$value'] = 'zzz';
\n"; + //$x++; + //} + //unset($x); + //echo "
";
+	//print_r($_POST["blacklist"]);
+	//echo "
"; + //foreach($_POST["blacklist"] as $key => $value) { + //echo "name: ".$value."
"; + //$x++; + //} + +if (count($_POST)>0) { + $dnsmasqfile = "/usr/local/etc/dnsmasq.conf"; + $targetfile = "/usr/local/etc/dnsmasq.blacklist.conf"; + $includestring = "conf-file=/usr/local/etc/dnsmasq.blacklist.conf"; + $dnsmasqconf = "/usr/local/etc/dnsmasq.conf"; + //clear previous values + foreach($category as $key => $value) { + $config['installedpackages']['dnsblacklist']['config'][0][$key] = ''; + } + if ($_POST['enable'] == 1) { + //echo "enabled"; + $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; + } + else { + //echo "disabled"; + $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 0; + } + //add the include entry for dnsmasq.blacklist.conf to dnsmasq.conf + if (file_exists($dnsmasqfile)) { + $getdnsmasq = file_get_contents($dnsmasqfile); + if(stristr($getdnsmasq,'conf-file=/usr/local/etc/dnsmasq.blacklist.conf') === TRUE) { + //include found no need to add it + } + else { + $myfhandle = fopen($dnsmasqconf, 'r+'); + fwrite($myfhandle, $includestring); + fclose($myfhandle); + } + } + else { + $my2fhandle = fopen($dnsmasqconf, 'x+'); + fwrite($my2fhandle, $includestring); + fclose($my2fhandle); + } + //truncate the dnsmasq.blacklist.conf file + if (file_exists($targetfile)) { + $fh = fopen($targetfile, 'w'); + fclose($fh); + } + //build the dnsmasq.blacklist.conf + if (count($_POST["blacklist"]) > 0) { + foreach($_POST["blacklist"] as $value) { + //set the current selected values + $blackfile = "blacklists/$value/domains"; + $config['installedpackages']['dnsblacklist']['config'][0][$value] = 1; + //if enabled write the selected categories to the dnsmasq.blacklist.conf + if ($config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] == 1) { + $fh2 = fopen($targetfile, 'a'); + $fh = fopen($blackfile,'r'); + while($line=fgets($fh)) { + fwrite($fh2, "address=/" .trim($line). "/74.125.45.100". "\n"); + } + fclose($fh); + fclose($fh2); + } + } + } + write_config(); + services_dnsmasq_configure(); + sleep(1); + $savemsg_dnsb = "DNS Blacklist settings have been saved."; +} +?> + + +

Services: DNS Blacklist

+
+ +\n"; +} +else { + echo "\n"; +} +?> + +Enable DNS Blacklist

+ +\n"; + if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { + // echo "\n"; + } + else { + // echo " \n"; + } + echo "\n"; + $x++; +} +echo "
+ + +Below is a scroll-box filled with categories you can select to be added to your blacklist.

Each category has a list of known domains/sites that will be denied access by users of this network. +

(Note: Using all categories at once will require 300Mb of free memory. The adult and porn categories are rather memory intensive, requiring 200Mb together.) +


+ +function ListFiles($dir) { + + if($dh = opendir($dir)) { + + $files = Array(); + $inner_files = Array(); + + while($file = readdir($dh)) { + if($file != "." && $file != ".." && $file[0] != '.') { + if(is_dir($dir . "/" . $file)) { + array_push($files, $dir); + //$inner_files = ListFiles($dir . "/" . $file); + //if(is_array($inner_files)) $files = array_merge($files, $inner_files); + } else { + //array_push($files, $dir . "/" . $file); + } + } + } + + closedir($dh); + return $files; + } +} + + +foreach (ListFiles('/usr/local/www/packages/dnsblacklist/') as $key=>$file){ + echo $file ."
\n"; +} + + + +
+\n"; +foreach($category as $key => $value) { + $domain_count = line_number("blacklists/$key/domains"); + //echo "name: ".$key."
"; + echo "
$key$value($domain_count domains)$key$value($domain_count domains)
\n"; +*/ +?> + +
+
+ + "Edit Category", ); +////$tmp_category = str_replace(" ", " ", $category); +//echo "\n"; +?> + + + + + + +
+ + + + + diff --git a/config/freeswitch/disa.js b/config/freeswitch/disa.js index 5cff6424..f705b79c 100644 --- a/config/freeswitch/disa.js +++ b/config/freeswitch/disa.js @@ -1,78 +1,78 @@ -include("/usr/local/freeswitch/scripts/config.js"); - - //var admin_pin = ""; //don't require a pin - //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id - var predefined_destination = ""; //example: 9999 - //predefined_destination leave empty in most cases - //Use this to define a single destination - var digitmaxlength = 0; - var timeoutpin = 7500; - var timeouttransfer = 7500; - - function mycb( session, type, obj, arg ) { - try { - if ( type == "dtmf" ) { - console_log( "info", "digit: "+obj.digit+"\n" ); - if ( obj.digit == "#" ) { - //console_log( "info", "detected pound sign.\n" ); - exit = true; - return( false ); - } - - dtmf.digits += obj.digit; - - if ( dtmf.digits.length >= digitmaxlength ) { - exit = true; - return( false ); - } - } - } catch (e) { - console_log( "err", e+"\n" ); - } - return( true ); - } //end function mycb - - - //console_log( "info", "DISA Request\n" ); - - var dtmf = new Object( ); - dtmf.digits = ""; - - if ( session.ready( ) ) { - session.answer( ); - - if (admin_pin.length > 0) { - digitmaxlength = 6; - session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf"); - session.collectInput( mycb, dtmf, timeoutpin ); - //console_log( "info", "DISA pin: " + dtmf.digits + "\n" ); - } - - if (dtmf.digits == admin_pin || admin_pin.length == 0) { - - //console_log( "info", "DISA pin is correct\n" ); - - us_ring = session.getVariable("us-ring"); - session.execute("set", "ringback="+us_ring); //set to ringtone - session.execute("set", "transfer_ringback="+us_ring); //set to ringtone - session.execute("set", "hangup_after_bridge=true"); - - if (predefined_destination.length == 0) { - dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request - digitmaxlength = 11; - session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf"); - session.collectInput( mycb, dtmf, timeouttransfer ); - console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" ); - session.execute("transfer", dtmf.digits + " XML default"); - } - else { - session.execute("transfer", predefined_destination + " XML default"); - } - - } - else { - session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf"); - console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" ); - } - - } +include("/usr/local/freeswitch/scripts/config.js"); + + //var admin_pin = ""; //don't require a pin + //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id + var predefined_destination = ""; //example: 9999 + //predefined_destination leave empty in most cases + //Use this to define a single destination + var digitmaxlength = 0; + var timeoutpin = 7500; + var timeouttransfer = 7500; + + function mycb( session, type, obj, arg ) { + try { + if ( type == "dtmf" ) { + console_log( "info", "digit: "+obj.digit+"\n" ); + if ( obj.digit == "#" ) { + //console_log( "info", "detected pound sign.\n" ); + exit = true; + return( false ); + } + + dtmf.digits += obj.digit; + + if ( dtmf.digits.length >= digitmaxlength ) { + exit = true; + return( false ); + } + } + } catch (e) { + console_log( "err", e+"\n" ); + } + return( true ); + } //end function mycb + + + //console_log( "info", "DISA Request\n" ); + + var dtmf = new Object( ); + dtmf.digits = ""; + + if ( session.ready( ) ) { + session.answer( ); + + if (admin_pin.length > 0) { + digitmaxlength = 6; + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf"); + session.collectInput( mycb, dtmf, timeoutpin ); + //console_log( "info", "DISA pin: " + dtmf.digits + "\n" ); + } + + if (dtmf.digits == admin_pin || admin_pin.length == 0) { + + //console_log( "info", "DISA pin is correct\n" ); + + us_ring = session.getVariable("us-ring"); + session.execute("set", "ringback="+us_ring); //set to ringtone + session.execute("set", "transfer_ringback="+us_ring); //set to ringtone + session.execute("set", "hangup_after_bridge=true"); + + if (predefined_destination.length == 0) { + dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request + digitmaxlength = 11; + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf"); + session.collectInput( mycb, dtmf, timeouttransfer ); + console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" ); + session.execute("transfer", dtmf.digits + " XML default"); + } + else { + session.execute("transfer", predefined_destination + " XML default"); + } + + } + else { + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf"); + console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" ); + } + + } diff --git a/config/freeswitch_dev/disa.js b/config/freeswitch_dev/disa.js index 5cff6424..f705b79c 100644 --- a/config/freeswitch_dev/disa.js +++ b/config/freeswitch_dev/disa.js @@ -1,78 +1,78 @@ -include("/usr/local/freeswitch/scripts/config.js"); - - //var admin_pin = ""; //don't require a pin - //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id - var predefined_destination = ""; //example: 9999 - //predefined_destination leave empty in most cases - //Use this to define a single destination - var digitmaxlength = 0; - var timeoutpin = 7500; - var timeouttransfer = 7500; - - function mycb( session, type, obj, arg ) { - try { - if ( type == "dtmf" ) { - console_log( "info", "digit: "+obj.digit+"\n" ); - if ( obj.digit == "#" ) { - //console_log( "info", "detected pound sign.\n" ); - exit = true; - return( false ); - } - - dtmf.digits += obj.digit; - - if ( dtmf.digits.length >= digitmaxlength ) { - exit = true; - return( false ); - } - } - } catch (e) { - console_log( "err", e+"\n" ); - } - return( true ); - } //end function mycb - - - //console_log( "info", "DISA Request\n" ); - - var dtmf = new Object( ); - dtmf.digits = ""; - - if ( session.ready( ) ) { - session.answer( ); - - if (admin_pin.length > 0) { - digitmaxlength = 6; - session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf"); - session.collectInput( mycb, dtmf, timeoutpin ); - //console_log( "info", "DISA pin: " + dtmf.digits + "\n" ); - } - - if (dtmf.digits == admin_pin || admin_pin.length == 0) { - - //console_log( "info", "DISA pin is correct\n" ); - - us_ring = session.getVariable("us-ring"); - session.execute("set", "ringback="+us_ring); //set to ringtone - session.execute("set", "transfer_ringback="+us_ring); //set to ringtone - session.execute("set", "hangup_after_bridge=true"); - - if (predefined_destination.length == 0) { - dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request - digitmaxlength = 11; - session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf"); - session.collectInput( mycb, dtmf, timeouttransfer ); - console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" ); - session.execute("transfer", dtmf.digits + " XML default"); - } - else { - session.execute("transfer", predefined_destination + " XML default"); - } - - } - else { - session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf"); - console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" ); - } - - } +include("/usr/local/freeswitch/scripts/config.js"); + + //var admin_pin = ""; //don't require a pin + //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id + var predefined_destination = ""; //example: 9999 + //predefined_destination leave empty in most cases + //Use this to define a single destination + var digitmaxlength = 0; + var timeoutpin = 7500; + var timeouttransfer = 7500; + + function mycb( session, type, obj, arg ) { + try { + if ( type == "dtmf" ) { + console_log( "info", "digit: "+obj.digit+"\n" ); + if ( obj.digit == "#" ) { + //console_log( "info", "detected pound sign.\n" ); + exit = true; + return( false ); + } + + dtmf.digits += obj.digit; + + if ( dtmf.digits.length >= digitmaxlength ) { + exit = true; + return( false ); + } + } + } catch (e) { + console_log( "err", e+"\n" ); + } + return( true ); + } //end function mycb + + + //console_log( "info", "DISA Request\n" ); + + var dtmf = new Object( ); + dtmf.digits = ""; + + if ( session.ready( ) ) { + session.answer( ); + + if (admin_pin.length > 0) { + digitmaxlength = 6; + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf"); + session.collectInput( mycb, dtmf, timeoutpin ); + //console_log( "info", "DISA pin: " + dtmf.digits + "\n" ); + } + + if (dtmf.digits == admin_pin || admin_pin.length == 0) { + + //console_log( "info", "DISA pin is correct\n" ); + + us_ring = session.getVariable("us-ring"); + session.execute("set", "ringback="+us_ring); //set to ringtone + session.execute("set", "transfer_ringback="+us_ring); //set to ringtone + session.execute("set", "hangup_after_bridge=true"); + + if (predefined_destination.length == 0) { + dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request + digitmaxlength = 11; + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf"); + session.collectInput( mycb, dtmf, timeouttransfer ); + console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" ); + session.execute("transfer", dtmf.digits + " XML default"); + } + else { + session.execute("transfer", predefined_destination + " XML default"); + } + + } + else { + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf"); + console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" ); + } + + } diff --git a/config/ipblocklist/convert.pl b/config/ipblocklist/convert.pl index 44b4add2..f3e9db12 100755 --- a/config/ipblocklist/convert.pl +++ b/config/ipblocklist/convert.pl @@ -1,67 +1,67 @@ -#!/usr/bin/perl -w -use strict; - -if($#ARGV != 1) { - print("Usage: $0 \n"); - exit(1); -} - -my ($line,$title,$iprange,$cidr); -my $i = 30000; - -open(INFILE,'<',$ARGV[0]) or die("Could not open input file $ARGV[0]"); -open(OUTFILE,'>>',$ARGV[1]) or die("Could not open output file $ARGV[1]"); - -foreach $line () { - chomp($line); - $line =~ s/:((\d{1,3}[-\.]*){8})//; - $iprange = $1; - print OUTFILE "#$line\n"; - foreach $cidr (split(/\n/,range($iprange))) { - print OUTFILE "$cidr\n"; - #print OUTFILE "ipfw -q add 1000 drop ip from any to $cidr\n"; (version 0.1.4) - #$i++; - #print OUTFILE "ipfw -q add 1001 drop ip from $cidr to any\n"; (version 0.1.4) - #$i++; - } -} - -close(INFILE); -close(OUTFILE); - -sub ntoa { - return join ".",unpack("CCCC",pack("N",shift)); -} -sub aton { - return unpack 'N', pack 'C4', split/\./, shift; -} -sub deaggregate { - my $thirtytwobits = 4294967295; - my $start = shift; - my $end = shift; - my $base = $start; - my ($step,$output); - while ($base <= $end) { - $step = 0; - while (($base | (1 << $step)) != $base) { - if (($base | (((~0) & $thirtytwobits) >> (31-$step))) > $end) { - last; - } - $step++; - } - if($step == 0) { - $output .= ntoa($base); - }else{ - $output .= ntoa($base)."/" .(32-$step); - } - $output .= "\n"; - $base += 1 << $step; - } - return $output; -} -sub range { - my ($address,$address2) = split /-/, shift; - $address = aton($address); - $address2 = aton($address2); - return deaggregate($address,$address2); -} \ No newline at end of file +#!/usr/bin/perl -w +use strict; + +if($#ARGV != 1) { + print("Usage: $0 \n"); + exit(1); +} + +my ($line,$title,$iprange,$cidr); +my $i = 30000; + +open(INFILE,'<',$ARGV[0]) or die("Could not open input file $ARGV[0]"); +open(OUTFILE,'>>',$ARGV[1]) or die("Could not open output file $ARGV[1]"); + +foreach $line () { + chomp($line); + $line =~ s/:((\d{1,3}[-\.]*){8})//; + $iprange = $1; + print OUTFILE "#$line\n"; + foreach $cidr (split(/\n/,range($iprange))) { + print OUTFILE "$cidr\n"; + #print OUTFILE "ipfw -q add 1000 drop ip from any to $cidr\n"; (version 0.1.4) + #$i++; + #print OUTFILE "ipfw -q add 1001 drop ip from $cidr to any\n"; (version 0.1.4) + #$i++; + } +} + +close(INFILE); +close(OUTFILE); + +sub ntoa { + return join ".",unpack("CCCC",pack("N",shift)); +} +sub aton { + return unpack 'N', pack 'C4', split/\./, shift; +} +sub deaggregate { + my $thirtytwobits = 4294967295; + my $start = shift; + my $end = shift; + my $base = $start; + my ($step,$output); + while ($base <= $end) { + $step = 0; + while (($base | (1 << $step)) != $base) { + if (($base | (((~0) & $thirtytwobits) >> (31-$step))) > $end) { + last; + } + $step++; + } + if($step == 0) { + $output .= ntoa($base); + }else{ + $output .= ntoa($base)."/" .(32-$step); + } + $output .= "\n"; + $base += 1 << $step; + } + return $output; +} +sub range { + my ($address,$address2) = split /-/, shift; + $address = aton($address); + $address2 = aton($address2); + return deaggregate($address,$address2); +} -- cgit v1.2.3