Changeset 3919

Show
Ignore:
Timestamp:
04/07/07 19:27:21 (6 years ago)
Author:
p_lindheimer
Message:

#1881 create sip_registrations.conf, change hardcoded paths in all the retrieve_conf* scripts, add amportalconf= option to retrieve_conf to use other than /etc/amportal.conf

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.2/amp_conf/astetc/sip.conf

    r3691 r3919  
    2222; how it should be. 
    2323#include sip_nat.conf 
     24#include sip_registrations_custom.conf 
     25#include sip_registrations.conf 
    2426#include sip_custom.conf 
    2527#include sip_additional.conf 
  • freepbx/branches/2.2/amp_conf/bin/retrieve_conf

    r3776 r3919  
    1 #!/usr/bin/env php 
     1#!/usr/bin/php -q 
    22 
    33<?php 
    44 
    55define("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"); 
    79define("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" ); 
    810 
     
    5759  if ( !isset($conf["AMPENGINE"]) || ($conf["AMPENGINE"] == "")) { 
    5860    $conf["AMPENGINE"] = "asterisk"; 
     61  } 
     62 
     63  if ( !isset($conf["ASTMANAGERPORT"]) || ($conf["ASTMANAGERPORT"] == "")) { 
     64    $conf["ASTMANAGERPORT"] = "5038"; 
    5965  } 
    6066 
     
    114120 
    115121$shortopts = "h?u:p:"; 
    116 $longopts = array("help","debug","dry-run","run-install"); 
     122$longopts = array("help","debug","dry-run","run-install","amportalconf="); 
    117123 
    118124$args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); 
     
    145151      out("Running module install.php and install.sql scripts"); 
    146152    break; 
     153    case "--amportalconf": 
     154      $amportalconf = $arg[1]; 
     155      out("Using $amportalconf configuration file"); 
     156    break; 
    147157  } 
    148158} 
     
    150160// **** Check for amportal.conf 
    151161 
    152 outn("Checking for ".AMP_CONF.".."); 
    153 if (!file_exists(AMP_CONF)) { 
     162outn("Checking for ".$amportalconf.".."); 
     163if (!file_exists($amportalconf)) { 
    154164  fatal("Does not exist, or is inaccessible"); 
    155165} 
     
    158168// **** read amportal.conf 
    159169 
    160 outn("Reading ".AMP_CONF.".."); 
    161 $amp_conf = parse_amportal_conf2(AMP_CONF); 
     170outn("Reading ".$amportalconf.".."); 
     171$amp_conf = parse_amportal_conf2($amportalconf); 
    162172if (count($amp_conf) == 0) { 
    163173  fatal("FAILED"); 
     
    165175out("OK"); 
    166176 
    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"; 
     178outn("Reading ".$asterisk_conf_file.".."); 
     179$asterisk_conf = parse_asterisk_conf2($asterisk_conf_file); 
    169180if (count($asterisk_conf) == 0) { 
    170181  fatal("FAILED"); 
     
    210221   
    211222    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"); 
    213224   
    214225    if (isset($amp_conf["AMPDBFILE"]) == "") 
    215       die("AMPDBFILE in /etc/amportal.conf cannot be blank"); 
     226      die("AMPDBFILE in $amportalconf cannot be blank"); 
    216227   
    217228    $DSN = array ( 
     
    226237  case "sqlite3": 
    227238    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"); 
    229240       
    230241    if (isset($amp_conf["AMPDBFILE"]) == "") 
    231       die("AMPDBFILE in /etc/amportal.conf cannot be blank"); 
     242      die("AMPDBFILE in $amportalconf cannot be blank"); 
    232243 
    233244    require_once('DB/sqlite3.php'); 
     
    254265require_once($amp_conf['AMPWEBROOT'].'/admin/common/php-asmanager.php'); 
    255266$astman = new AGI_AsteriskManager();  
    256 if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {  
     267if (! $res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { 
    257268  out("FAILED"); 
    258269  fatal("Cannot connect to manager interface"); 
     
    423434 
    424435//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)
    426437exec($script); 
    427438 
    428439//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)
    430441exec($script); 
    431442 
    432443//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)
    434445exec($script); 
    435446 
    436447//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)
    438449exec($script); 
    439450 
    440451//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)
    442453exec($script); 
    443454   
  • freepbx/branches/2.2/amp_conf/bin/retrieve_iax_conf_from_mysql.pl

    r3776 r3919  
    1414 
    1515################### BEGIN OF CONFIGURATION #################### 
     16if (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} 
    1629 
    1730# the name of the iax table 
    1831$table_name = "iax"; 
    1932# the path to the varous IAX conf files 
    20 $iax_conf = "/etc/asterisk/iax_additional.conf"; 
    21 $iax_reg = "/etc/asterisk/iax_registrations.conf"; 
    2233 
    2334# cool hack by Julien BLACHE <jblache@debian.org> 
    24 $ampconf = parse_amportal_conf( "/etc/amportal.conf" ); 
     35$ampconf = parse_amportal_conf( $amportalconf ); 
    2536# username to connect to the database 
    2637$username = $ampconf->{"AMPDBUSER"}; 
  • freepbx/branches/2.2/amp_conf/bin/retrieve_op_conf_from_mysql.pl

    r3776 r3919  
    1414 
    1515################### BEGIN OF CONFIGURATION #################### 
     16 
     17if (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} 
    1628 
    1729######## STYLE INFO ######### 
     
    3143 
    3244 
    33 $zapataconf="/etc/asterisk/zapata.conf"; 
    34 $zapataautoconf="/etc/asterisk/zapata-auto.conf"; 
    3545 
    3646if (-e $zapataconf) { 
     
    136146 
    137147# cool hack by Julien BLACHE <jblache@debian.org> 
    138 $ampconf = parse_amportal_conf( "/etc/amportal.conf" ); 
     148$ampconf = parse_amportal_conf( $amportalconf ); 
    139149 
    140150# WARNING: this file will be substituted by the output of this program 
     
    172182elsif ( $db_engine eq "sqlite" ) { 
    173183  if (!exists($ampconf->{"AMPDBFILE"})) { 
    174     print "No AMPDBFILE set in /etc/amportal.conf\n"; 
     184    print "No AMPDBFILE set in $amportalconf\n"; 
    175185    exit; 
    176186  } 
     
    181191elsif ( $db_engine eq "sqlite3" ) { 
    182192  if (!exists($ampconf->{"AMPDBFILE"})) { 
    183     print "No AMPDBFILE set in /etc/amportal.conf\n"; 
     193    print "No AMPDBFILE set in $amportalconf\n"; 
    184194    exit; 
    185195  } 
  • freepbx/branches/2.2/amp_conf/bin/retrieve_queues_conf_from_mysql.pl

    r3776 r3919  
    1111################### BEGIN OF CONFIGURATION #################### 
    1212 
     13if (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 
    1325# the name of the extensions table 
    1426$table_name = "queues"; 
    1527# the path to the extensions.conf file 
    1628# WARNING: this file will be substituted by the output of this program 
    17 $queues_conf = "/etc/asterisk/queues_additional.conf"; 
    1829 
    1930# cool hack by Julien BLACHE <jblache@debian.org> 
    20 $ampconf = parse_amportal_conf( "/etc/amportal.conf" ); 
     31$ampconf = parse_amportal_conf( $amportalconf ); 
    2132# username to connect to the database 
    2233$username = $ampconf->{"AMPDBUSER"}; 
  • freepbx/branches/2.2/amp_conf/bin/retrieve_sip_conf_from_mysql.pl

    r3776 r3919  
    1515################### BEGIN OF CONFIGURATION #################### 
    1616 
     17if (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 
    1733# the name of the extensions table 
    1834$table_name = "sip"; 
    1935# the path to the extensions.conf file 
    20 # WARNING: this file will be substituted by the output of this program 
    21 $sip_conf = "/etc/asterisk/sip_additional.conf"; 
    2236 
    2337# cool hack by Julien BLACHE <jblache@debian.org> 
    24 $ampconf = parse_amportal_conf( "/etc/amportal.conf" ); 
     38$ampconf = parse_amportal_conf( $amportalconf ); 
    2539# username to connect to the database 
    2640$username = $ampconf->{"AMPDBUSER"}; 
     
    8195} 
    8296 
    83 open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite extensions file: $sip_conf (!$)\n"; 
     97open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite SIP extensions file: $sip_conf (!$)\n"; 
     98open( REG, ">$sip_reg" ) or die "Cannot create/overwrite SIP Registration file: $sip_reg (!$)\n"; 
     99 
    84100print EXTEN $warning_banner; 
     101print REG   $warning_banner; 
    85102 
    86103$additional = ""; 
     
    109126    $top .= $result[0]."=".$result[1]."\n"; 
    110127  } 
    111   print EXTEN "$top\n"; 
     128  print REG "$top\n"; 
    112129} 
    113130 
     
    155172} 
    156173 
     174close EXTEN;                                                                                                                                 
     175close REG;                                                                                                                                   
    157176exit 0; 
    158177 
  • freepbx/branches/2.2/amp_conf/bin/retrieve_zap_conf_from_mysql.pl

    r3776 r3919  
    1515################### BEGIN OF CONFIGURATION #################### 
    1616 
     17if (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 
    1729# the name of the extensions table 
    1830$table_name = "zap"; 
    1931# the path to the extensions.conf file 
    2032# WARNING: this file will be substituted by the output of this program 
    21 $zap_conf = "/etc/asterisk/zapata_additional.conf"; 
    2233 
    2334# cool hack by Julien BLACHE <jblache@debian.org> 
    24 $ampconf = parse_amportal_conf( "/etc/amportal.conf" ); 
     35$ampconf = parse_amportal_conf( $amportalconf ); 
    2536# username to connect to the database 
    2637$username = $ampconf->{"AMPDBUSER"};