Changeset 48
- Timestamp:
- 06/28/07 21:18:27 (1 year ago)
- Files:
-
- trunk/op_server.cfg (modified) (1 diff)
- trunk/op_server.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/op_server.cfg
r46 r48 1 1 [general] 2 ; If you want to use freepbx/trixbox conf file, set this to 1 3 use_amportal_conf=0; 4 2 5 ; host or ip address of asterisk 3 6 manager_host=192.168.0.1 trunk/op_server.pl
r47 r48 399 399 } 400 400 401 sub parse_amportal_config { 402 my $filename = shift; 403 my %ampconf; 404 405 open( AMPCONF, $filename ) || die "Cannot open $filename"; 406 407 while (<AMPCONF>) { 408 if ( $_ =~ /^\s*([a-zA-Z0-9]+)\s*=\s*(.*)\s*([;#].*)?/ ) { 409 $ampconf{$1} = $2; 410 } 411 } 412 413 close(AMPCONF); 414 return %ampconf; 415 } 416 401 417 sub read_server_config() { 402 418 my $context = ""; … … 467 483 } 468 484 close(CONFIG); 485 } 486 487 if ( defined( $config->{GENERAL}{use_amportal_conf} ) ) { 488 if ( $config->{GENERAL}{use_amportal_conf} == 1 ) { 489 my $freepbx_config = "/etc/amportal.conf"; 490 my %ampconf; 491 492 if ( -e $freepbx_config ) { 493 %ampconf = parse_amportal_config($freepbx_config); 494 $config->{"GENERAL"}{"web_hostname"} = $ampconf{"AMPWEBADDRESS"}; 495 $config->{"GENERAL"}{"security_code"} = $ampconf{"FOPPASSWORD"}; 496 $config->{"GENERAL"}{"flash_dir"} = $ampconf{"FOPWEBROOT"}; 497 $manager_user[0] = $ampconf{"AMPMGRUSER"}; 498 $manager_secret[0] = $ampconf{"AMPMGRPASS"}; 499 } 500 } 469 501 } 470 502 … … 522 554 523 555 $clid_format = $config->{GENERAL}{clid_format}; 524 556 if ( !defined($flash_dir) ) { $flash_dir = '/var/www/html' } 525 557 $flash_file = $flash_dir . "/variables.txt"; 526 558 push @all_flash_files, $flash_file;
