Changeset 1690

Show
Ignore:
Timestamp:
04/21/06 16:46:22 (7 years ago)
Author:
rcourtna
Message:

read asterisk.conf entries into $asterisk_conf. This will help make us more portable.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/bin/retrieve_conf

    r1684 r1690  
    33 
    44define("AMP_CONF", "/etc/amportal.conf"); 
     5define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); 
    56 
    67function out($text) { 
     
    3940  foreach ($file as $line) { 
    4041    if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\%-]*)\"?\s*([;#].*)?/",$line,$matches)) { 
     42      $conf[ $matches[1] ] = $matches[2]; 
     43    } 
     44  } 
     45  return $conf; 
     46} 
     47 
     48function parse_asterisk_conf2($filename) { 
     49  $file = file($filename); 
     50  foreach ($file as $line) { 
     51    if (preg_match("/^\s*([a-zA-Z0-9]+)\s* => \s*(.*)\s*([;#].*)?/",$line,$matches)) {  
    4152      $conf[ $matches[1] ] = $matches[2]; 
    4253    } 
     
    123134$amp_conf = parse_amportal_conf2(AMP_CONF); 
    124135if (count($amp_conf) == 0) { 
     136  fatal("FAILED"); 
     137} 
     138out("OK"); 
     139 
     140outn("Reading ".ASTERISK_CONF.".."); 
     141$asterisk_conf = parse_asterisk_conf2(ASTERISK_CONF); 
     142if (count($asterisk_conf) == 0) { 
    125143  fatal("FAILED"); 
    126144} 
     
    300318 
    301319function write_file($filename,$contents) { 
    302   if ($fd = fopen("/etc/asterisk/".$filename, "w")) { 
     320  global $asterisk_conf; 
     321  if ($fd = fopen($asterisk_conf['astetcdir'].'/'.$filename, "w")) { 
    303322    fwrite($fd, $contents); 
    304323    fclose($fd); 
  • freepbx/trunk/amp_conf/htdocs/admin/config.php

    r1542 r1690  
    2626// get settings 
    2727$amp_conf = parse_amportal_conf("/etc/amportal.conf"); 
    28     
     28$asterisk_conf = parse_asterisk_conf("/etc/asterisk/asterisk.conf"); 
     29 
    2930include 'header_auth.php'; 
    3031