diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index 3f1a48b4..587541e2 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -46,6 +46,7 @@ # 60614-1142 - Added code to work with recycled leads, multi called_since_last_reset values # - Removed gmt lead validation because it is already done by VDhopper # 60807-1438 - Changed to DBI +# - changed to use /etc/astguiclient.conf for configs # @@ -102,13 +103,54 @@ $MT[0]=''; $RECcount=''; ### leave blank for no REC count $RECprefix='7'; ### leave blank for no REC prefix -### Make sure this file is in a libs path or put the absolute path to it -require("/home/cron/AST_SERVER_conf.pl"); # local configuration file -if (!$DB_port) {$DB_port='3306';} +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} &get_time_now; # update time/date variables +if (!$VDADLOGfile) {$VDADLOGfile = "$PATHlogs/vdautodial.$year-$mon-$mday";} + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; &event_logger; # writes to the log and if debug flag is set prints to STDOUT @@ -116,7 +158,7 @@ use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sle use DBI; ### connect to MySQL database defined in the AST_SERVER_conf.pl file - $dbhA = DBI->connect("DBI:mysql:$DB_database:$DB_server:$DB_port", "$DB_user", "$DB_pass") + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") or die "Couldn't connect to database: " . DBI->errstr; @@ -702,9 +744,9 @@ while($one_day_interval > 0) if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} ### putting a blank file called "VDAD.kill" in the directory will automatically safely kill this program - if (-e '/home/cron/VDAD.kill') + if (-e "$PATHhome/VDAD.kill") { - unlink('/home/cron/VDAD.kill'); + unlink("$PATHhome/VDAD.kill"); $endless_loop=0; $one_day_interval=0; print "\nPROCESS KILLED MANUALLY... EXITING\n\n" diff --git a/agc_2-X/trunk/bin/AST_VDremote_agents.pl b/agc_2-X/trunk/bin/AST_VDremote_agents.pl index bbb1e914..b6a0cee4 100644 --- a/agc_2-X/trunk/bin/AST_VDremote_agents.pl +++ b/agc_2-X/trunk/bin/AST_VDremote_agents.pl @@ -127,6 +127,8 @@ foreach(@conf) $server_ip = $VARserver_ip; # Asterisk server IP + &get_time_now; # update time/date variables + if (!$VDRLOGfile) {$VDRLOGfile = "$PATHlogs/remoteagent.$year-$mon-$mday";} if (!$VARDB_port) {$VARDB_port='3306';}