Changeset 3919
- Timestamp:
- 04/07/07 19:27:21 (6 years ago)
- Files:
-
- freepbx/branches/2.2/amp_conf/astetc/sip.conf (modified) (1 diff)
- freepbx/branches/2.2/amp_conf/bin/retrieve_conf (modified) (11 diffs)
- freepbx/branches/2.2/amp_conf/bin/retrieve_iax_conf_from_mysql.pl (modified) (1 diff)
- freepbx/branches/2.2/amp_conf/bin/retrieve_op_conf_from_mysql.pl (modified) (5 diffs)
- freepbx/branches/2.2/amp_conf/bin/retrieve_queues_conf_from_mysql.pl (modified) (1 diff)
- freepbx/branches/2.2/amp_conf/bin/retrieve_sip_conf_from_mysql.pl (modified) (4 diffs)
- freepbx/branches/2.2/amp_conf/bin/retrieve_zap_conf_from_mysql.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/2.2/amp_conf/astetc/sip.conf
r3691 r3919 22 22 ; how it should be. 23 23 #include sip_nat.conf 24 #include sip_registrations_custom.conf 25 #include sip_registrations.conf 24 26 #include sip_custom.conf 25 27 #include sip_additional.conf freepbx/branches/2.2/amp_conf/bin/retrieve_conf
r3776 r3919 1 #!/usr/bin/ env php1 #!/usr/bin/php -q 2 2 3 3 <?php 4 4 5 5 define("AMP_CONF", "/etc/amportal.conf"); 6 define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); 6 $amportalconf = AMP_CONF; 7 8 //define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); 7 9 define("WARNING_BANNER", "; do not edit this file, this is an auto-generated file by freepbx\n; all modifications must be done from the web gui\n\n\n" ); 8 10 … … 57 59 if ( !isset($conf["AMPENGINE"]) || ($conf["AMPENGINE"] == "")) { 58 60 $conf["AMPENGINE"] = "asterisk"; 61 } 62 63 if ( !isset($conf["ASTMANAGERPORT"]) || ($conf["ASTMANAGERPORT"] == "")) { 64 $conf["ASTMANAGERPORT"] = "5038"; 59 65 } 60 66 … … 114 120 115 121 $shortopts = "h?u:p:"; 116 $longopts = array("help","debug","dry-run","run-install" );122 $longopts = array("help","debug","dry-run","run-install","amportalconf="); 117 123 118 124 $args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); … … 145 151 out("Running module install.php and install.sql scripts"); 146 152 break; 153 case "--amportalconf": 154 $amportalconf = $arg[1]; 155 out("Using $amportalconf configuration file"); 156 break; 147 157 } 148 158 } … … 150 160 // **** Check for amportal.conf 151 161 152 outn("Checking for ". AMP_CONF."..");153 if (!file_exists( AMP_CONF)) {162 outn("Checking for ".$amportalconf.".."); 163 if (!file_exists($amportalconf)) { 154 164 fatal("Does not exist, or is inaccessible"); 155 165 } … … 158 168 // **** read amportal.conf 159 169 160 outn("Reading ". AMP_CONF."..");161 $amp_conf = parse_amportal_conf2( AMP_CONF);170 outn("Reading ".$amportalconf.".."); 171 $amp_conf = parse_amportal_conf2($amportalconf); 162 172 if (count($amp_conf) == 0) { 163 173 fatal("FAILED"); … … 165 175 out("OK"); 166 176 167 outn("Reading ".ASTERISK_CONF.".."); 168 $asterisk_conf = parse_asterisk_conf2(ASTERISK_CONF); 177 $asterisk_conf_file = rtrim($amp_conf["ASTETCDIR"],DIRECTORY_SEPARATOR)."/asterisk.conf"; 178 outn("Reading ".$asterisk_conf_file.".."); 179 $asterisk_conf = parse_asterisk_conf2($asterisk_conf_file); 169 180 if (count($asterisk_conf) == 0) { 170 181 fatal("FAILED"); … … 210 221 211 222 if (!isset($amp_conf["AMPDBFILE"])) 212 die("You must setup properly AMPDBFILE in /etc/amportal.conf");223 die("You must setup properly AMPDBFILE in $amportalconf"); 213 224 214 225 if (isset($amp_conf["AMPDBFILE"]) == "") 215 die("AMPDBFILE in /etc/amportal.conf cannot be blank");226 die("AMPDBFILE in $amportalconf cannot be blank"); 216 227 217 228 $DSN = array ( … … 226 237 case "sqlite3": 227 238 if (!isset($amp_conf["AMPDBFILE"])) 228 die("You must setup properly AMPDBFILE in /etc/amportal.conf");239 die("You must setup properly AMPDBFILE in $amportalconf"); 229 240 230 241 if (isset($amp_conf["AMPDBFILE"]) == "") 231 die("AMPDBFILE in /etc/amportal.conf cannot be blank");242 die("AMPDBFILE in $amportalconf cannot be blank"); 232 243 233 244 require_once('DB/sqlite3.php'); … … 254 265 require_once($amp_conf['AMPWEBROOT'].'/admin/common/php-asmanager.php'); 255 266 $astman = new AGI_AsteriskManager(); 256 if (! $res = $astman->connect("127.0.0.1 ", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {267 if (! $res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { 257 268 out("FAILED"); 258 269 fatal("Cannot connect to manager interface"); … … 423 434 424 435 //script to write op_server.cfg file from mysql 425 $script = $amp_conf['AMPBIN'].'/retrieve_op_conf_from_mysql.pl ';436 $script = $amp_conf['AMPBIN'].'/retrieve_op_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); 426 437 exec($script); 427 438 428 439 //script to write sip conf file from mysql 429 $script = $amp_conf['AMPBIN'].'/retrieve_sip_conf_from_mysql.pl ';440 $script = $amp_conf['AMPBIN'].'/retrieve_sip_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); 430 441 exec($script); 431 442 432 443 //script to write iax2 conf file from mysql 433 $script = $amp_conf['AMPBIN'].'/retrieve_iax_conf_from_mysql.pl ';444 $script = $amp_conf['AMPBIN'].'/retrieve_iax_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); 434 445 exec($script); 435 446 436 447 //script to write zap conf file from mysql 437 $script = $amp_conf['AMPBIN'].'/retrieve_zap_conf_from_mysql.pl ';448 $script = $amp_conf['AMPBIN'].'/retrieve_zap_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); 438 449 exec($script); 439 450 440 451 //script to write queues conf file from mysql 441 $script = $amp_conf['AMPBIN'].'/retrieve_queues_conf_from_mysql.pl ';452 $script = $amp_conf['AMPBIN'].'/retrieve_queues_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); 442 453 exec($script); 443 454 freepbx/branches/2.2/amp_conf/bin/retrieve_iax_conf_from_mysql.pl
r3776 r3919 14 14 15 15 ################### BEGIN OF CONFIGURATION #################### 16 if (scalar @ARGV == 2) 17 { 18 $amportalconf = $ARGV[0]; 19 # WARNING: this file will be substituted by the output of this program 20 $iax_conf = $ARGV[1]."/iax_additional.conf"; 21 $iax_reg = $ARGV[1]."/iax_registrations.conf"; 22 } else 23 { 24 $amportalconf = "/etc/amportal.conf"; 25 # WARNING: this file will be substituted by the output of this program 26 $iax_conf = "/etc/asterisk/iax_additional.conf"; 27 $iax_reg = "/etc/asterisk/iax_registrations.conf"; 28 } 16 29 17 30 # the name of the iax table 18 31 $table_name = "iax"; 19 32 # the path to the varous IAX conf files 20 $iax_conf = "/etc/asterisk/iax_additional.conf";21 $iax_reg = "/etc/asterisk/iax_registrations.conf";22 33 23 34 # cool hack by Julien BLACHE <jblache@debian.org> 24 $ampconf = parse_amportal_conf( "/etc/amportal.conf");35 $ampconf = parse_amportal_conf( $amportalconf ); 25 36 # username to connect to the database 26 37 $username = $ampconf->{"AMPDBUSER"}; freepbx/branches/2.2/amp_conf/bin/retrieve_op_conf_from_mysql.pl
r3776 r3919 14 14 15 15 ################### BEGIN OF CONFIGURATION #################### 16 17 if (scalar @ARGV == 2) 18 { 19 $amportalconf = $ARGV[0]; 20 $zapataconf = $ARGV[1]."/zapata.conf"; 21 $zapataautoconf = $ARGV[1]."/zapata-auto.conf"; 22 } else 23 { 24 $amportalconf = "/etc/amportal.conf"; 25 $zapataconf="/etc/asterisk/zapata.conf"; 26 $zapataautoconf="/etc/asterisk/zapata-auto.conf"; 27 } 16 28 17 29 ######## STYLE INFO ######### … … 31 43 32 44 33 $zapataconf="/etc/asterisk/zapata.conf";34 $zapataautoconf="/etc/asterisk/zapata-auto.conf";35 45 36 46 if (-e $zapataconf) { … … 136 146 137 147 # cool hack by Julien BLACHE <jblache@debian.org> 138 $ampconf = parse_amportal_conf( "/etc/amportal.conf");148 $ampconf = parse_amportal_conf( $amportalconf ); 139 149 140 150 # WARNING: this file will be substituted by the output of this program … … 172 182 elsif ( $db_engine eq "sqlite" ) { 173 183 if (!exists($ampconf->{"AMPDBFILE"})) { 174 print "No AMPDBFILE set in /etc/amportal.conf\n";184 print "No AMPDBFILE set in $amportalconf\n"; 175 185 exit; 176 186 } … … 181 191 elsif ( $db_engine eq "sqlite3" ) { 182 192 if (!exists($ampconf->{"AMPDBFILE"})) { 183 print "No AMPDBFILE set in /etc/amportal.conf\n";193 print "No AMPDBFILE set in $amportalconf\n"; 184 194 exit; 185 195 } freepbx/branches/2.2/amp_conf/bin/retrieve_queues_conf_from_mysql.pl
r3776 r3919 11 11 ################### BEGIN OF CONFIGURATION #################### 12 12 13 if (scalar @ARGV == 2) 14 { 15 $amportalconf = $ARGV[0]; 16 # WARNING: this file will be substituted by the output of this program 17 $queues_conf = $ARGV[1]."/queues_additional.conf"; 18 } else 19 { 20 $amportalconf = "/etc/amportal.conf"; 21 # WARNING: this file will be substituted by the output of this program 22 $queues_conf = "/etc/asterisk/queues_additional.conf"; 23 } 24 13 25 # the name of the extensions table 14 26 $table_name = "queues"; 15 27 # the path to the extensions.conf file 16 28 # WARNING: this file will be substituted by the output of this program 17 $queues_conf = "/etc/asterisk/queues_additional.conf";18 29 19 30 # cool hack by Julien BLACHE <jblache@debian.org> 20 $ampconf = parse_amportal_conf( "/etc/amportal.conf");31 $ampconf = parse_amportal_conf( $amportalconf ); 21 32 # username to connect to the database 22 33 $username = $ampconf->{"AMPDBUSER"}; freepbx/branches/2.2/amp_conf/bin/retrieve_sip_conf_from_mysql.pl
r3776 r3919 15 15 ################### BEGIN OF CONFIGURATION #################### 16 16 17 if (scalar @ARGV == 2) 18 { 19 $amportalconf = $ARGV[0]; 20 # WARNING: this file will be substituted by the output of this program 21 $sip_conf = $ARGV[1]."/sip_additional.conf"; 22 $sip_reg = $ARGV[1]."/sip_registrations.conf"; 23 24 } else 25 { 26 $amportalconf = "/etc/amportal.conf"; 27 # WARNING: this file will be substituted by the output of this program 28 $sip_conf = "/etc/asterisk/sip_additional.conf"; 29 $sip_reg = "/etc/asterisk/sip_registrations.conf"; 30 31 } 32 17 33 # the name of the extensions table 18 34 $table_name = "sip"; 19 35 # the path to the extensions.conf file 20 # WARNING: this file will be substituted by the output of this program21 $sip_conf = "/etc/asterisk/sip_additional.conf";22 36 23 37 # cool hack by Julien BLACHE <jblache@debian.org> 24 $ampconf = parse_amportal_conf( "/etc/amportal.conf");38 $ampconf = parse_amportal_conf( $amportalconf ); 25 39 # username to connect to the database 26 40 $username = $ampconf->{"AMPDBUSER"}; … … 81 95 } 82 96 83 open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite extensions file: $sip_conf (!$)\n"; 97 open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite SIP extensions file: $sip_conf (!$)\n"; 98 open( REG, ">$sip_reg" ) or die "Cannot create/overwrite SIP Registration file: $sip_reg (!$)\n"; 99 84 100 print EXTEN $warning_banner; 101 print REG $warning_banner; 85 102 86 103 $additional = ""; … … 109 126 $top .= $result[0]."=".$result[1]."\n"; 110 127 } 111 print EXTEN"$top\n";128 print REG "$top\n"; 112 129 } 113 130 … … 155 172 } 156 173 174 close EXTEN; 175 close REG; 157 176 exit 0; 158 177 freepbx/branches/2.2/amp_conf/bin/retrieve_zap_conf_from_mysql.pl
r3776 r3919 15 15 ################### BEGIN OF CONFIGURATION #################### 16 16 17 if (scalar @ARGV == 2) 18 { 19 $amportalconf = $ARGV[0]; 20 # WARNING: this file will be substituted by the output of this program 21 $zap_conf = $ARGV[1]."/zapata_additional.conf"; 22 } else 23 { 24 $amportalconf = "/etc/amportal.conf"; 25 # WARNING: this file will be substituted by the output of this program 26 $zap_conf = "/etc/asterisk/zapata_additional.conf"; 27 } 28 17 29 # the name of the extensions table 18 30 $table_name = "zap"; 19 31 # the path to the extensions.conf file 20 32 # WARNING: this file will be substituted by the output of this program 21 $zap_conf = "/etc/asterisk/zapata_additional.conf";22 33 23 34 # cool hack by Julien BLACHE <jblache@debian.org> 24 $ampconf = parse_amportal_conf( "/etc/amportal.conf");35 $ampconf = parse_amportal_conf( $amportalconf ); 25 36 # username to connect to the database 26 37 $username = $ampconf->{"AMPDBUSER"};
