Code cleanup in several bin scripts
Added new output options with audio file transfer to AST_VDsales_export.pl git-svn-id: svn://192.168.202.10@1160 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+101
-101
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# ADMIN_backup.pl version 2.0.5
|
# ADMIN_backup.pl version 2.2.0
|
||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# Backs-up the asterisk database, conf/agi/sounds/bin files
|
# Backs-up the asterisk database, conf/agi/sounds/bin files
|
||||||
#
|
#
|
||||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
#
|
#
|
||||||
@@ -13,9 +13,9 @@
|
|||||||
# 80317-1609 - Added Sangoma conf file backup and changed FTP settings
|
# 80317-1609 - Added Sangoma conf file backup and changed FTP settings
|
||||||
# 80328-0135 - Do not attempt to archive /etc/my.cnf is --without-db flag is set
|
# 80328-0135 - Do not attempt to archive /etc/my.cnf is --without-db flag is set
|
||||||
# 80611-0549 - Added DB option to backup all tables except for log tables
|
# 80611-0549 - Added DB option to backup all tables except for log tables
|
||||||
|
# 90620-1851 - Moved mysqldump bin lookup to database backup section
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
$secT = time();
|
$secT = time();
|
||||||
$secX = time();
|
$secX = time();
|
||||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||||
@@ -32,93 +32,93 @@ $VDL_date = "$year-$mon-$mday 00:00:01";
|
|||||||
|
|
||||||
### begin parsing run-time options ###
|
### begin parsing run-time options ###
|
||||||
if (length($ARGV[0])>1)
|
if (length($ARGV[0])>1)
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($#ARGV >= $i)
|
while ($#ARGV >= $i)
|
||||||
{
|
{
|
||||||
$args = "$args $ARGV[$i]";
|
$args = "$args $ARGV[$i]";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args =~ /--help/i)
|
if ($args =~ /--help/i)
|
||||||
{
|
{
|
||||||
print "allowed run time options:\n";
|
print "allowed run time options:\n";
|
||||||
print " [--db-only] = only backup the database\n";
|
print " [--db-only] = only backup the database\n";
|
||||||
print " [--db-without-logs] = do not backup the log tables in the database\n";
|
print " [--db-without-logs] = do not backup the log tables in the database\n";
|
||||||
print " [--conf-only] = only backup the asterisk conf files\n";
|
print " [--conf-only] = only backup the asterisk conf files\n";
|
||||||
print " [--without-db] = do not backup the database\n";
|
print " [--without-db] = do not backup the database\n";
|
||||||
print " [--without-conf] = do not backup the conf files\n";
|
print " [--without-conf] = do not backup the conf files\n";
|
||||||
print " [--without-web] = do not backup web files\n";
|
print " [--without-web] = do not backup web files\n";
|
||||||
print " [--without-sounds] = do not backup asterisk sounds\n";
|
print " [--without-sounds] = do not backup asterisk sounds\n";
|
||||||
print " [--ftp-transfer] = Transfer backup to FTP server\n";
|
print " [--ftp-transfer] = Transfer backup to FTP server\n";
|
||||||
print " [--debugX] = super debug\n";
|
print " [--debugX] = super debug\n";
|
||||||
print " [--debug] = debug\n";
|
print " [--debug] = debug\n";
|
||||||
print " [-t] = test\n";
|
print " [-t] = test\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if ($args =~ /--debug/i)
|
|
||||||
{
|
{
|
||||||
$DB=1; $FTPdebug=1;
|
if ($args =~ /--debug/i)
|
||||||
print "\n----- DEBUG -----\n\n";
|
{
|
||||||
}
|
$DB=1; $FTPdebug=1;
|
||||||
if ($args =~ /--debugX/i)
|
print "\n----- DEBUG -----\n\n";
|
||||||
{
|
}
|
||||||
$DBX=1;
|
if ($args =~ /--debugX/i)
|
||||||
print "\n----- SUPER DEBUG -----\n\n";
|
{
|
||||||
}
|
$DBX=1;
|
||||||
if ($args =~ /-t/i)
|
print "\n----- SUPER DEBUG -----\n\n";
|
||||||
{
|
}
|
||||||
$T=1; $TEST=1;
|
if ($args =~ /-t/i)
|
||||||
print "\n-----TESTING -----\n\n";
|
{
|
||||||
}
|
$T=1; $TEST=1;
|
||||||
if ($args =~ /--db-only/i)
|
print "\n-----TESTING -----\n\n";
|
||||||
{
|
}
|
||||||
$db_only=1;
|
if ($args =~ /--db-only/i)
|
||||||
print "\n----- Backup Database Only -----\n\n";
|
{
|
||||||
}
|
$db_only=1;
|
||||||
if ($args =~ /--db-without-logs/i)
|
print "\n----- Backup Database Only -----\n\n";
|
||||||
{
|
}
|
||||||
$db_without_logs=1;
|
if ($args =~ /--db-without-logs/i)
|
||||||
print "\n----- Backup Database Without Logs -----\n\n";
|
{
|
||||||
}
|
$db_without_logs=1;
|
||||||
if ($args =~ /--conf-only/i)
|
print "\n----- Backup Database Without Logs -----\n\n";
|
||||||
{
|
}
|
||||||
$conf_only=1;
|
if ($args =~ /--conf-only/i)
|
||||||
print "\n----- Conf Files Backup Only -----\n\n";
|
{
|
||||||
}
|
$conf_only=1;
|
||||||
if ($args =~ /--without-db/i)
|
print "\n----- Conf Files Backup Only -----\n\n";
|
||||||
{
|
}
|
||||||
$without_db=1;
|
if ($args =~ /--without-db/i)
|
||||||
print "\n----- No Database Backup -----\n\n";
|
{
|
||||||
}
|
$without_db=1;
|
||||||
if ($args =~ /--without-conf/i)
|
print "\n----- No Database Backup -----\n\n";
|
||||||
{
|
}
|
||||||
$without_conf=1;
|
if ($args =~ /--without-conf/i)
|
||||||
print "\n----- No Conf Files Backup -----\n\n";
|
{
|
||||||
}
|
$without_conf=1;
|
||||||
if ($args =~ /--without-sounds/i)
|
print "\n----- No Conf Files Backup -----\n\n";
|
||||||
{
|
}
|
||||||
$without_sounds=1;
|
if ($args =~ /--without-sounds/i)
|
||||||
print "\n----- No Sounds Backup -----\n\n";
|
{
|
||||||
}
|
$without_sounds=1;
|
||||||
if ($args =~ /--without-web/i)
|
print "\n----- No Sounds Backup -----\n\n";
|
||||||
{
|
}
|
||||||
$without_web=1;
|
if ($args =~ /--without-web/i)
|
||||||
print "\n----- No web files Backup -----\n\n";
|
{
|
||||||
}
|
$without_web=1;
|
||||||
if ($args =~ /--ftp-transfer/i)
|
print "\n----- No web files Backup -----\n\n";
|
||||||
{
|
}
|
||||||
$ftp_transfer=1;
|
if ($args =~ /--ftp-transfer/i)
|
||||||
print "\n----- FTP transfer -----\n\n";
|
{
|
||||||
|
$ftp_transfer=1;
|
||||||
|
print "\n----- FTP transfer -----\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "no command line options set\n";
|
print "no command line options set\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
# default path to astguiclient configuration file:
|
# default path to astguiclient configuration file:
|
||||||
$PATHconf = '/etc/astguiclient.conf';
|
$PATHconf = '/etc/astguiclient.conf';
|
||||||
@@ -207,22 +207,6 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
### find mysqldump binary to do the database dump
|
|
||||||
$mysqldumpbin = '';
|
|
||||||
if ( -e ('/usr/bin/mysqldump')) {$mysqldumpbin = '/usr/bin/mysqldump';}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( -e ('/usr/local/mysql/bin/mysqldump')) {$mysqldumpbin = '/usr/local/mysql/bin/mysqldump';}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( -e ('/bin/mysqldump')) {$mysqldumpbin = '/bin/mysqldump';}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "Can't find mysqldump binary! MySQL backups will not work...\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$conf='_CONF_';
|
$conf='_CONF_';
|
||||||
$sangoma='_SANGOMA_';
|
$sangoma='_SANGOMA_';
|
||||||
$linux='_LINUX_';
|
$linux='_LINUX_';
|
||||||
@@ -239,6 +223,22 @@ $sgSTRING='';
|
|||||||
|
|
||||||
if ( ($without_db < 1) && ($conf_only < 1) )
|
if ( ($without_db < 1) && ($conf_only < 1) )
|
||||||
{
|
{
|
||||||
|
### find mysqldump binary to do the database dump
|
||||||
|
$mysqldumpbin = '';
|
||||||
|
if ( -e ('/usr/bin/mysqldump')) {$mysqldumpbin = '/usr/bin/mysqldump';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( -e ('/usr/local/mysql/bin/mysqldump')) {$mysqldumpbin = '/usr/local/mysql/bin/mysqldump';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( -e ('/bin/mysqldump')) {$mysqldumpbin = '/bin/mysqldump';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Can't find mysqldump binary! MySQL backups will not work...\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
### BACKUP THE MYSQL FILES ON THE DB SERVER ###
|
### BACKUP THE MYSQL FILES ON THE DB SERVER ###
|
||||||
if ($db_without_logs)
|
if ($db_without_logs)
|
||||||
{
|
{
|
||||||
@@ -257,16 +257,16 @@ if ( ($without_db < 1) && ($conf_only < 1) )
|
|||||||
$archive_tables='';
|
$archive_tables='';
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
if ($aryA[0] =~ /_log|server_performance|vicidial_ivr|vicidial_hopper|vicidial_manager|web_client_sessions|imm_outcomes/)
|
if ($aryA[0] =~ /_log|server_performance|vicidial_ivr|vicidial_hopper|vicidial_manager|web_client_sessions|imm_outcomes/)
|
||||||
{
|
{
|
||||||
$log_tables .= " $aryA[0]";
|
$log_tables .= " $aryA[0]";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$archive_tables .= " $aryA[0]";
|
$archive_tables .= " $aryA[0]";
|
||||||
}
|
}
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ sleep(5);
|
|||||||
### Loop through files a second time to gather filesizes again 5 seconds later
|
### Loop through files a second time to gather filesizes again 5 seconds later
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach(@FILES)
|
foreach(@FILES)
|
||||||
{
|
{
|
||||||
$FILEsize2[$i] = 0;
|
$FILEsize2[$i] = 0;
|
||||||
|
|
||||||
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
|
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
|
||||||
@@ -283,6 +283,10 @@ foreach(@FILES)
|
|||||||
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
|
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "ERROR: Could not ping server $VARFTP_host\n";
|
||||||
|
}
|
||||||
### END Remote file transfer
|
### END Remote file transfer
|
||||||
|
|
||||||
### sleep for twenty hundredths of a second to not flood the server with disk activity
|
### sleep for twenty hundredths of a second to not flood the server with disk activity
|
||||||
|
|||||||
@@ -421,15 +421,7 @@ while ($master_loop<$CLIloops)
|
|||||||
$differential_onemin[$i]=0;
|
$differential_onemin[$i]=0;
|
||||||
$agents_average_onemin[$i]=0;
|
$agents_average_onemin[$i]=0;
|
||||||
|
|
||||||
# ### Grab the count of agents and lines
|
&count_agents_lines;
|
||||||
# if ($campaign_id[$i] !~ /(CLOSER|BLEND|INBND|_C$|_B$|_I$)/)
|
|
||||||
# {
|
|
||||||
&count_agents_lines;
|
|
||||||
# }
|
|
||||||
# else
|
|
||||||
# {
|
|
||||||
# if ($DB) {print " CLOSER CAMPAIGN\n";}
|
|
||||||
# }
|
|
||||||
|
|
||||||
if ($total_agents_avg[$i] > 0)
|
if ($total_agents_avg[$i] > 0)
|
||||||
{
|
{
|
||||||
@@ -595,7 +587,7 @@ sub get_time_now
|
|||||||
$current_hourmin = "$hour$min";
|
$current_hourmin = "$hour$min";
|
||||||
|
|
||||||
### get date-time of one hour ago ###
|
### get date-time of one hour ago ###
|
||||||
$VDL_hour = ($secX - (60 * 60));
|
$VDL_hour = ($secX - (60 * 60));
|
||||||
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_hour);
|
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_hour);
|
||||||
$Vyear = ($Vyear + 1900);
|
$Vyear = ($Vyear + 1900);
|
||||||
$Vmon++;
|
$Vmon++;
|
||||||
@@ -604,7 +596,7 @@ sub get_time_now
|
|||||||
$VDL_hour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
|
$VDL_hour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
|
||||||
|
|
||||||
### get date-time of half hour ago ###
|
### get date-time of half hour ago ###
|
||||||
$VDL_halfhour = ($secX - (30 * 60));
|
$VDL_halfhour = ($secX - (30 * 60));
|
||||||
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_halfhour);
|
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_halfhour);
|
||||||
$Vyear = ($Vyear + 1900);
|
$Vyear = ($Vyear + 1900);
|
||||||
$Vmon++;
|
$Vmon++;
|
||||||
@@ -613,7 +605,7 @@ sub get_time_now
|
|||||||
$VDL_halfhour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
|
$VDL_halfhour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
|
||||||
|
|
||||||
### get date-time of five minutes ago ###
|
### get date-time of five minutes ago ###
|
||||||
$VDL_five = ($secX - (5 * 60));
|
$VDL_five = ($secX - (5 * 60));
|
||||||
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_five);
|
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_five);
|
||||||
$Vyear = ($Vyear + 1900);
|
$Vyear = ($Vyear + 1900);
|
||||||
$Vmon++;
|
$Vmon++;
|
||||||
@@ -622,10 +614,10 @@ sub get_time_now
|
|||||||
$VDL_five = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
|
$VDL_five = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
|
||||||
|
|
||||||
### get epoch of ninty seconds ago ###
|
### get epoch of ninty seconds ago ###
|
||||||
$VDL_ninty = ($secX - (1 * 90));
|
$VDL_ninty = ($secX - (1 * 90));
|
||||||
|
|
||||||
### get date-time of one minute ago ###
|
### get date-time of one minute ago ###
|
||||||
$VDL_one = ($secX - (1 * 60));
|
$VDL_one = ($secX - (1 * 60));
|
||||||
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_one);
|
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_one);
|
||||||
$Vyear = ($Vyear + 1900);
|
$Vyear = ($Vyear + 1900);
|
||||||
$Vmon++;
|
$Vmon++;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# AST_VDauto_dial.pl version 2.0.5 *DBI-version*
|
# AST_VDauto_dial.pl version 2.2.0 *DBI-version*
|
||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# Places auto_dial calls on the VICIDIAL dialer system
|
# Places auto_dial calls on the VICIDIAL dialer system
|
||||||
@@ -76,53 +76,54 @@
|
|||||||
# 90202-0203 - Added outbound_autodial_active option to halt all dialing
|
# 90202-0203 - Added outbound_autodial_active option to halt all dialing
|
||||||
# 90306-1845 - Added configurable calls-per-second option
|
# 90306-1845 - Added configurable calls-per-second option
|
||||||
# 90611-0554 - Bug fix for Manual dial calls and logging
|
# 90611-0554 - Bug fix for Manual dial calls and logging
|
||||||
|
# 90619-1948 - format fixing
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
### begin parsing run-time options ###
|
### begin parsing run-time options ###
|
||||||
if (length($ARGV[0])>1)
|
if (length($ARGV[0])>1)
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($#ARGV >= $i)
|
while ($#ARGV >= $i)
|
||||||
{
|
{
|
||||||
$args = "$args $ARGV[$i]";
|
$args = "$args $ARGV[$i]";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args =~ /--help/i)
|
if ($args =~ /--help/i)
|
||||||
{
|
|
||||||
print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($args =~ /--delay=/i)
|
|
||||||
{
|
{
|
||||||
@data_in = split(/--delay=/,$args);
|
print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($args =~ /--delay=/i)
|
||||||
|
{
|
||||||
|
@data_in = split(/--delay=/,$args);
|
||||||
$loop_delay = $data_in[1];
|
$loop_delay = $data_in[1];
|
||||||
print " LOOP DELAY OVERRIDE!!!!! = $loop_delay seconds\n\n";
|
print " LOOP DELAY OVERRIDE!!!!! = $loop_delay seconds\n\n";
|
||||||
$loop_delay = ($loop_delay * 1000);
|
$loop_delay = ($loop_delay * 1000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$loop_delay = '2500';
|
$loop_delay = '2500';
|
||||||
}
|
}
|
||||||
if ($args =~ /-debug/i)
|
if ($args =~ /-debug/i)
|
||||||
{
|
{
|
||||||
$DB=1; # Debug flag, set to 0 for no debug messages, On an active system this will generate hundreds of lines of output per minute
|
$DB=1; # Debug flag, set to 0 for no debug messages, On an active system this will generate hundreds of lines of output per minute
|
||||||
}
|
}
|
||||||
if ($args =~ /-t/i)
|
if ($args =~ /-t/i)
|
||||||
{
|
{
|
||||||
$TEST=1;
|
$TEST=1;
|
||||||
$T=1;
|
$T=1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "no command line options set\n";
|
print "no command line options set\n";
|
||||||
$loop_delay = '2500';
|
$loop_delay = '2500';
|
||||||
$DB=1;
|
$DB=1;
|
||||||
}
|
}
|
||||||
### end parsing run-time options ###
|
### end parsing run-time options ###
|
||||||
|
|
||||||
|
|
||||||
@@ -185,9 +186,9 @@ if (!$JAMdebugFILE) {$JAMdebugFILE = "$PATHlogs/vdad-JAM.$year-$mon-$mday";}
|
|||||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||||
use DBI;
|
use DBI;
|
||||||
|
|
||||||
### connect to MySQL database defined in the conf file
|
### connect to MySQL database defined in the conf file
|
||||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_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;
|
or die "Couldn't connect to database: " . DBI->errstr;
|
||||||
|
|
||||||
### Grab Server values from the database
|
### Grab Server values from the database
|
||||||
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vd_server_logs FROM servers where server_ip = '$server_ip';";
|
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vd_server_logs FROM servers where server_ip = '$server_ip';";
|
||||||
@@ -197,33 +198,33 @@ $sthArows=$sthA->rows;
|
|||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBtelnet_host = "$aryA[0]";
|
$DBtelnet_host = "$aryA[0]";
|
||||||
$DBtelnet_port = "$aryA[1]";
|
$DBtelnet_port = "$aryA[1]";
|
||||||
$DBASTmgrUSERNAME = "$aryA[2]";
|
$DBASTmgrUSERNAME = "$aryA[2]";
|
||||||
$DBASTmgrSECRET = "$aryA[3]";
|
$DBASTmgrSECRET = "$aryA[3]";
|
||||||
$DBASTmgrUSERNAMEupdate = "$aryA[4]";
|
$DBASTmgrUSERNAMEupdate = "$aryA[4]";
|
||||||
$DBASTmgrUSERNAMElisten = "$aryA[5]";
|
$DBASTmgrUSERNAMElisten = "$aryA[5]";
|
||||||
$DBASTmgrUSERNAMEsend = "$aryA[6]";
|
$DBASTmgrUSERNAMEsend = "$aryA[6]";
|
||||||
$DBmax_vicidial_trunks = "$aryA[7]";
|
$DBmax_vicidial_trunks = "$aryA[7]";
|
||||||
$DBanswer_transfer_agent= "$aryA[8]";
|
$DBanswer_transfer_agent= "$aryA[8]";
|
||||||
$DBSERVER_GMT = "$aryA[9]";
|
$DBSERVER_GMT = "$aryA[9]";
|
||||||
$DBext_context = "$aryA[10]";
|
$DBext_context = "$aryA[10]";
|
||||||
$DBvd_server_logs = "$aryA[11]";
|
$DBvd_server_logs = "$aryA[11]";
|
||||||
if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;}
|
if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;}
|
||||||
if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;}
|
if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;}
|
||||||
if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;}
|
if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;}
|
||||||
if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;}
|
if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;}
|
||||||
if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;}
|
if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;}
|
||||||
if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;}
|
if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;}
|
||||||
if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;}
|
if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;}
|
||||||
$max_vicidial_trunks = $DBmax_vicidial_trunks;
|
$max_vicidial_trunks = $DBmax_vicidial_trunks;
|
||||||
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
|
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
|
||||||
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
|
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
|
||||||
if ($DBext_context) {$ext_context = $DBext_context;}
|
if ($DBext_context) {$ext_context = $DBext_context;}
|
||||||
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
|
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
|
||||||
else {$SYSLOG = '0';}
|
else {$SYSLOG = '0';}
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
@@ -256,13 +257,12 @@ $sthA->finish();
|
|||||||
|
|
||||||
$one_day_interval = 12; # 1 month loops for one year
|
$one_day_interval = 12; # 1 month loops for one year
|
||||||
while($one_day_interval > 0)
|
while($one_day_interval > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$endless_loop=5760000; # 30 days minutes at XXX seconds per loop
|
$endless_loop=5760000; # 30 days minutes at XXX seconds per loop
|
||||||
$stat_count=1;
|
$stat_count=1;
|
||||||
|
|
||||||
while($endless_loop > 0)
|
while($endless_loop > 0)
|
||||||
{
|
{
|
||||||
&get_time_now;
|
&get_time_now;
|
||||||
|
|
||||||
$VDADLOGfile = "$PATHlogs/vdautodial.$year-$mon-$mday";
|
$VDADLOGfile = "$PATHlogs/vdautodial.$year-$mon-$mday";
|
||||||
@@ -358,28 +358,28 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBlive_user[$user_counter] = "$aryA[0]";
|
$DBlive_user[$user_counter] = "$aryA[0]";
|
||||||
$DBlive_server_ip[$user_counter] = "$aryA[1]";
|
$DBlive_server_ip[$user_counter] = "$aryA[1]";
|
||||||
$DBlive_campaign[$user_counter] = "$aryA[2]";
|
$DBlive_campaign[$user_counter] = "$aryA[2]";
|
||||||
$DBlive_conf_exten[$user_counter] = "$aryA[3]";
|
$DBlive_conf_exten[$user_counter] = "$aryA[3]";
|
||||||
$DBlive_status[$user_counter] = "$aryA[4]";
|
$DBlive_status[$user_counter] = "$aryA[4]";
|
||||||
|
|
||||||
if ($user_campaigns !~ /\|$DBlive_campaign[$user_counter]\|/i)
|
if ($user_campaigns !~ /\|$DBlive_campaign[$user_counter]\|/i)
|
||||||
{
|
{
|
||||||
if ($campaigns_update !~ /'$DBlive_campaign[$user_counter]'/) {$campaigns_update .= "'$DBlive_campaign[$user_counter]',"; $CPcount++;}
|
if ($campaigns_update !~ /'$DBlive_campaign[$user_counter]'/) {$campaigns_update .= "'$DBlive_campaign[$user_counter]',"; $CPcount++;}
|
||||||
$user_campaigns .= "$DBlive_campaign[$user_counter]|";
|
$user_campaigns .= "$DBlive_campaign[$user_counter]|";
|
||||||
$user_campaignsSQL .= ",'$DBlive_campaign[$user_counter]'";
|
$user_campaignsSQL .= ",'$DBlive_campaign[$user_counter]'";
|
||||||
$DBcampaigns[$user_campaigns_counter] = $DBlive_campaign[$user_counter];
|
$DBcampaigns[$user_campaigns_counter] = $DBlive_campaign[$user_counter];
|
||||||
$user_campaigns_counter++;
|
$user_campaigns_counter++;
|
||||||
}
|
}
|
||||||
if ($user_campaignIP !~ /\|$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]\|/i)
|
if ($user_campaignIP !~ /\|$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]\|/i)
|
||||||
{
|
{
|
||||||
$user_campaignIP .= "$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]|";
|
$user_campaignIP .= "$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]|";
|
||||||
$DBIPcampaign[$user_CIPct] = "$DBlive_campaign[$user_counter]";
|
$DBIPcampaign[$user_CIPct] = "$DBlive_campaign[$user_counter]";
|
||||||
$DBIPaddress[$user_CIPct] = "$DBlive_server_ip[$user_counter]";
|
$DBIPaddress[$user_CIPct] = "$DBlive_server_ip[$user_counter]";
|
||||||
$user_CIPct++;
|
$user_CIPct++;
|
||||||
}
|
}
|
||||||
$user_counter++;
|
$user_counter++;
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -393,7 +393,7 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$active_line_counter = "$aryA[0]";
|
$active_line_counter = "$aryA[0]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -440,7 +440,7 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBIPold_trunk_shortage[$user_CIPct] = "$aryA[0]";
|
$DBIPold_trunk_shortage[$user_CIPct] = "$aryA[0]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
if ($rec_count < 1)
|
if ($rec_count < 1)
|
||||||
@@ -466,7 +466,7 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBIPserver_trunks_limit[$user_CIPct] = "$aryA[0]";
|
$DBIPserver_trunks_limit[$user_CIPct] = "$aryA[0]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$stmtA = "SELECT sum(dedicated_trunks) FROM vicidial_server_trunks where campaign_id NOT IN('$DBIPcampaign[$user_CIPct]') and server_ip='$server_ip';";
|
$stmtA = "SELECT sum(dedicated_trunks) FROM vicidial_server_trunks where campaign_id NOT IN('$DBIPcampaign[$user_CIPct]') and server_ip='$server_ip';";
|
||||||
@@ -477,7 +477,7 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBIPserver_trunks_other[$user_CIPct] = "$aryA[0]";
|
$DBIPserver_trunks_other[$user_CIPct] = "$aryA[0]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,27 +495,27 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBIPadlevel[$user_CIPct] = "$aryA[0]";
|
$DBIPadlevel[$user_CIPct] = "$aryA[0]";
|
||||||
$DBIPcalltime[$user_CIPct] = "$aryA[1]";
|
$DBIPcalltime[$user_CIPct] = "$aryA[1]";
|
||||||
$DBIPdialtimeout[$user_CIPct] = "$aryA[2]";
|
$DBIPdialtimeout[$user_CIPct] = "$aryA[2]";
|
||||||
$DBIPdialprefix[$user_CIPct] = "$aryA[3]";
|
$DBIPdialprefix[$user_CIPct] = "$aryA[3]";
|
||||||
$DBIPcampaigncid[$user_CIPct] = "$aryA[4]";
|
$DBIPcampaigncid[$user_CIPct] = "$aryA[4]";
|
||||||
$DBIPactive[$user_CIPct] = "$aryA[5]";
|
$DBIPactive[$user_CIPct] = "$aryA[5]";
|
||||||
$DBIPvdadexten[$user_CIPct] = "$aryA[6]";
|
$DBIPvdadexten[$user_CIPct] = "$aryA[6]";
|
||||||
$DBIPclosercamp[$user_CIPct] = "$aryA[7]";
|
$DBIPclosercamp[$user_CIPct] = "$aryA[7]";
|
||||||
$omit_phone_code = "$aryA[8]";
|
$omit_phone_code = "$aryA[8]";
|
||||||
if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$user_CIPct] = 1;}
|
if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$user_CIPct] = 1;}
|
||||||
else {$DBIPomitcode[$user_CIPct] = 0;}
|
else {$DBIPomitcode[$user_CIPct] = 0;}
|
||||||
$available_only_ratio_tally = "$aryA[9]";
|
$available_only_ratio_tally = "$aryA[9]";
|
||||||
if ($available_only_ratio_tally =~ /Y/)
|
if ($available_only_ratio_tally =~ /Y/)
|
||||||
{
|
{
|
||||||
$DBIPcount[$user_CIPct] = $DBIPACTIVEcount[$user_CIPct];
|
$DBIPcount[$user_CIPct] = $DBIPACTIVEcount[$user_CIPct];
|
||||||
$active_only=1;
|
$active_only=1;
|
||||||
}
|
}
|
||||||
$DBIPautoaltdial[$user_CIPct] = "$aryA[10]";
|
$DBIPautoaltdial[$user_CIPct] = "$aryA[10]";
|
||||||
$DBIPcampaign_allow_inbound[$user_CIPct] = "$aryA[11]";
|
$DBIPcampaign_allow_inbound[$user_CIPct] = "$aryA[11]";
|
||||||
$DBIPqueue_priority[$user_CIPct] = "$aryA[12]";
|
$DBIPqueue_priority[$user_CIPct] = "$aryA[12]";
|
||||||
$DBIPdial_method[$user_CIPct] = "$aryA[13]";
|
$DBIPdial_method[$user_CIPct] = "$aryA[13]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -533,7 +533,7 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$tally_xfer_line_counter = "$aryA[0]";
|
$tally_xfer_line_counter = "$aryA[0]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -551,15 +551,15 @@ while($one_day_interval > 0)
|
|||||||
### subtract that number from goalcalls to determine how many new
|
### subtract that number from goalcalls to determine how many new
|
||||||
### calls need to be placed in this loop
|
### calls need to be placed in this loop
|
||||||
if ($DBIPcampaign_allow_inbound[$user_CIPct] =~ /Y/)
|
if ($DBIPcampaign_allow_inbound[$user_CIPct] =~ /Y/)
|
||||||
{
|
{
|
||||||
if (length($DBIPclosercamp[$user_CIPct]) > 2)
|
if (length($DBIPclosercamp[$user_CIPct]) > 2)
|
||||||
{
|
{
|
||||||
$DBIPclosercamp[$user_CIPct] =~ s/^ | -$//gi;
|
$DBIPclosercamp[$user_CIPct] =~ s/^ | -$//gi;
|
||||||
$DBIPclosercamp[$user_CIPct] =~ s/ /','/gi;
|
$DBIPclosercamp[$user_CIPct] =~ s/ /','/gi;
|
||||||
$DBIPclosercamp[$user_CIPct] = "'$DBIPclosercamp[$user_CIPct]'";
|
$DBIPclosercamp[$user_CIPct] = "'$DBIPclosercamp[$user_CIPct]'";
|
||||||
}
|
}
|
||||||
else {$DBIPclosercamp[$user_CIPct]="''";}
|
else {$DBIPclosercamp[$user_CIPct]="''";}
|
||||||
|
|
||||||
$campaign_query = "( (call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct])) or (campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE')) )";
|
$campaign_query = "( (call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct])) or (campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE')) )";
|
||||||
}
|
}
|
||||||
else {$campaign_query = "(campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE'))";}
|
else {$campaign_query = "(campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE'))";}
|
||||||
@@ -571,7 +571,7 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBIPexistcalls[$user_CIPct] = "$aryA[0]";
|
$DBIPexistcalls[$user_CIPct] = "$aryA[0]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -657,7 +657,7 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$waiting_calls = "$aryA[0]";
|
$waiting_calls = "$aryA[0]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -752,26 +752,26 @@ while($one_day_interval > 0)
|
|||||||
{
|
{
|
||||||
$stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$server_ip' where campaign_id='$DBIPcampaign[$user_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DBIPmakecalls[$user_CIPct]";
|
$stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$server_ip' where campaign_id='$DBIPcampaign[$user_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DBIPmakecalls[$user_CIPct]";
|
||||||
print "|$stmtA|\n";
|
print "|$stmtA|\n";
|
||||||
$UDaffected_rows = $dbhA->do($stmtA);
|
$UDaffected_rows = $dbhA->do($stmtA);
|
||||||
print "hopper rows updated to QUEUE: |$UDaffected_rows|\n";
|
print "hopper rows updated to QUEUE: |$UDaffected_rows|\n";
|
||||||
|
|
||||||
if ($UDaffected_rows)
|
if ($UDaffected_rows)
|
||||||
{
|
|
||||||
$lead_id=''; $phone_code=''; $phone_number=''; $called_count='';
|
|
||||||
while ($call_CMPIPct < $UDaffected_rows)
|
|
||||||
{
|
{
|
||||||
$stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBIPcampaign[$user_CIPct]' and status='QUEUE' and user='VDAD_$server_ip' order by priority desc,hopper_id LIMIT 1";
|
$lead_id=''; $phone_code=''; $phone_number=''; $called_count='';
|
||||||
print "|$stmtA|\n";
|
while ($call_CMPIPct < $UDaffected_rows)
|
||||||
|
{
|
||||||
|
$stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBIPcampaign[$user_CIPct]' and status='QUEUE' and user='VDAD_$server_ip' order by priority desc,hopper_id LIMIT 1";
|
||||||
|
print "|$stmtA|\n";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
$rec_countCUSTDATA=0;
|
$rec_countCUSTDATA=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$lead_id = "$aryA[0]";
|
$lead_id = "$aryA[0]";
|
||||||
$alt_dial = "$aryA[1]";
|
$alt_dial = "$aryA[1]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -791,7 +791,7 @@ while($one_day_interval > 0)
|
|||||||
{
|
{
|
||||||
$stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id'";
|
$stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id'";
|
||||||
print "|$stmtA|\n";
|
print "|$stmtA|\n";
|
||||||
$UQaffected_rows = $dbhA->do($stmtA);
|
$UQaffected_rows = $dbhA->do($stmtA);
|
||||||
print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n";
|
print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n";
|
||||||
|
|
||||||
$stmtA = "SELECT * FROM vicidial_list where lead_id='$lead_id';";
|
$stmtA = "SELECT * FROM vicidial_list where lead_id='$lead_id';";
|
||||||
@@ -799,20 +799,20 @@ while($one_day_interval > 0)
|
|||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
$rec_countCUSTDATA=0;
|
$rec_countCUSTDATA=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$list_id = "$aryA[7]";
|
$list_id = "$aryA[7]";
|
||||||
$gmt_offset_now = "$aryA[8]";
|
$gmt_offset_now = "$aryA[8]";
|
||||||
$called_since_last_reset = "$aryA[9]";
|
$called_since_last_reset = "$aryA[9]";
|
||||||
$phone_code = "$aryA[10]";
|
$phone_code = "$aryA[10]";
|
||||||
$phone_number = "$aryA[11]";
|
$phone_number = "$aryA[11]";
|
||||||
$address3 = "$aryA[18]";
|
$address3 = "$aryA[18]";
|
||||||
$alt_phone = "$aryA[26]";
|
$alt_phone = "$aryA[26]";
|
||||||
$called_count = "$aryA[30]";
|
$called_count = "$aryA[30]";
|
||||||
|
|
||||||
$rec_countCUSTDATA++;
|
$rec_countCUSTDATA++;
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -898,14 +898,14 @@ while($one_day_interval > 0)
|
|||||||
$local_AMP = '@';
|
$local_AMP = '@';
|
||||||
$Local_out_prefix = '9';
|
$Local_out_prefix = '9';
|
||||||
$Local_dial_timeout = '60';
|
$Local_dial_timeout = '60';
|
||||||
if ($DBIPdialtimeout[$user_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$user_CIPct];}
|
if ($DBIPdialtimeout[$user_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$user_CIPct];}
|
||||||
$Local_dial_timeout = ($Local_dial_timeout * 1000);
|
$Local_dial_timeout = ($Local_dial_timeout * 1000);
|
||||||
if (length($DBIPdialprefix[$user_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$user_CIPct]";}
|
if (length($DBIPdialprefix[$user_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$user_CIPct]";}
|
||||||
if (length($DBIPvdadexten[$user_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$user_CIPct]";}
|
if (length($DBIPvdadexten[$user_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$user_CIPct]";}
|
||||||
else {$VDAD_dial_exten = "$answer_transfer_agent";}
|
else {$VDAD_dial_exten = "$answer_transfer_agent";}
|
||||||
|
|
||||||
if (length($DBIPcampaigncid[$user_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$user_CIPct]"; $CCID_on++;}
|
if (length($DBIPcampaigncid[$user_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$user_CIPct]"; $CCID_on++;}
|
||||||
if ($DBIPdialprefix[$user_CIPct] =~ /x/i) {$Local_out_prefix = '';}
|
if ($DBIPdialprefix[$user_CIPct] =~ /x/i) {$Local_out_prefix = '';}
|
||||||
|
|
||||||
if ($RECcount)
|
if ($RECcount)
|
||||||
{
|
{
|
||||||
@@ -916,7 +916,7 @@ while($one_day_interval > 0)
|
|||||||
|
|
||||||
if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;}
|
if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;}
|
||||||
|
|
||||||
$lead_id_call_list .= "$lead_id|";
|
$lead_id_call_list .= "$lead_id|";
|
||||||
|
|
||||||
if (length($alt_dial)<1) {$alt_dial='MAIN';}
|
if (length($alt_dial)<1) {$alt_dial='MAIN';}
|
||||||
|
|
||||||
@@ -942,20 +942,18 @@ while($one_day_interval > 0)
|
|||||||
$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial','$DBIPqueue_priority[$user_CIPct]')";
|
$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial','$DBIPqueue_priority[$user_CIPct]')";
|
||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rows = $dbhA->do($stmtA);
|
||||||
|
|
||||||
### sleep for a five hundredths of a second to not flood the server with new calls
|
### sleep for a five hundredths of a second to not flood the server with new calls
|
||||||
# usleep(1*50*1000);
|
# usleep(1*50*1000);
|
||||||
usleep(1*$per_call_delay*1000);
|
usleep(1*$per_call_delay*1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$call_CMPIPct++;
|
||||||
}
|
}
|
||||||
$call_CMPIPct++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$user_CIPct++;
|
||||||
}
|
}
|
||||||
$user_CIPct++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -979,16 +977,16 @@ while($one_day_interval > 0)
|
|||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
$rec_countCUSTDATA=0;
|
$rec_countCUSTDATA=0;
|
||||||
$kill_vac=0;
|
$kill_vac=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$KLcallerid[$kill_vac] = "$aryA[0]";
|
$KLcallerid[$kill_vac] = "$aryA[0]";
|
||||||
$KLserver_ip[$kill_vac] = "$aryA[1]";
|
$KLserver_ip[$kill_vac] = "$aryA[1]";
|
||||||
$KLchannel[$kill_vac] = "$aryA[2]";
|
$KLchannel[$kill_vac] = "$aryA[2]";
|
||||||
$KLuniqueid[$kill_vac] = "$aryA[3]";
|
$KLuniqueid[$kill_vac] = "$aryA[3]";
|
||||||
$KLstatus[$kill_vac] = "$aryA[4]";
|
$KLstatus[$kill_vac] = "$aryA[4]";
|
||||||
$kill_vac++;
|
$kill_vac++;
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
@@ -1010,13 +1008,13 @@ while($one_day_interval > 0)
|
|||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
$rec_countCUSTDATA=0;
|
$rec_countCUSTDATA=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$end_epoch = "$aryA[0]";
|
$end_epoch = "$aryA[0]";
|
||||||
$CLuniqueid = "$aryA[1]";
|
$CLuniqueid = "$aryA[1]";
|
||||||
$start_epoch = "$aryA[2]";
|
$start_epoch = "$aryA[2]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -1029,13 +1027,13 @@ while($one_day_interval > 0)
|
|||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
$rec_countCUSTDATA=0;
|
$rec_countCUSTDATA=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$end_epoch = "$aryA[0]";
|
$end_epoch = "$aryA[0]";
|
||||||
$CLuniqueid = "$aryA[1]";
|
$CLuniqueid = "$aryA[1]";
|
||||||
$start_epoch = "$aryA[2]";
|
$start_epoch = "$aryA[2]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -1048,7 +1046,7 @@ while($one_day_interval > 0)
|
|||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
$rec_countCUSTDATA=0;
|
$rec_countCUSTDATA=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
@@ -1237,7 +1235,7 @@ while($one_day_interval > 0)
|
|||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$epc_countCAMPDATA=0;
|
$epc_countCAMPDATA=0;
|
||||||
while ($sthArows > $epc_countCAMPDATA)
|
while ($sthArows > $epc_countCAMPDATA)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
@@ -1246,7 +1244,7 @@ while($one_day_interval > 0)
|
|||||||
$VD_gmt_offset_now = "$aryA[1]";
|
$VD_gmt_offset_now = "$aryA[1]";
|
||||||
$VD_state = "$aryA[2]";
|
$VD_state = "$aryA[2]";
|
||||||
$VD_list_id = "$aryA[3]";
|
$VD_list_id = "$aryA[3]";
|
||||||
$epc_countCAMPDATA++;
|
$epc_countCAMPDATA++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
if (length($VD_alt_phone)>5)
|
if (length($VD_alt_phone)>5)
|
||||||
@@ -1303,7 +1301,7 @@ while($one_day_interval > 0)
|
|||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$epc_countCAMPDATA=0;
|
$epc_countCAMPDATA=0;
|
||||||
while ($sthArows > $epc_countCAMPDATA)
|
while ($sthArows > $epc_countCAMPDATA)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
@@ -1312,7 +1310,7 @@ while($one_day_interval > 0)
|
|||||||
$VD_gmt_offset_now = "$aryA[1]";
|
$VD_gmt_offset_now = "$aryA[1]";
|
||||||
$VD_state = "$aryA[2]";
|
$VD_state = "$aryA[2]";
|
||||||
$VD_list_id = "$aryA[3]";
|
$VD_list_id = "$aryA[3]";
|
||||||
$epc_countCAMPDATA++;
|
$epc_countCAMPDATA++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
if (length($VD_address3)>5)
|
if (length($VD_address3)>5)
|
||||||
@@ -1374,14 +1372,14 @@ while($one_day_interval > 0)
|
|||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$epc_countCAMPDATA=0;
|
$epc_countCAMPDATA=0;
|
||||||
while ($sthArows > $epc_countCAMPDATA)
|
while ($sthArows > $epc_countCAMPDATA)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$VD_gmt_offset_now = "$aryA[1]";
|
$VD_gmt_offset_now = "$aryA[1]";
|
||||||
$VD_state = "$aryA[2]";
|
$VD_state = "$aryA[2]";
|
||||||
$VD_list_id = "$aryA[3]";
|
$VD_list_id = "$aryA[3]";
|
||||||
$epc_countCAMPDATA++;
|
$epc_countCAMPDATA++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
$alt_dial_phones_count=0;
|
$alt_dial_phones_count=0;
|
||||||
@@ -1514,34 +1512,34 @@ while($one_day_interval > 0)
|
|||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
$rec_countCUSTDATA=0;
|
$rec_countCUSTDATA=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$VALOuser[$logcount] = "$aryA[0]";
|
$VALOuser[$logcount] = "$aryA[0]";
|
||||||
$VALOcampaign[$logcount] = "$aryA[1]";
|
$VALOcampaign[$logcount] = "$aryA[1]";
|
||||||
$VALOtimelog[$logcount] = "$aryA[2]";
|
$VALOtimelog[$logcount] = "$aryA[2]";
|
||||||
$VALOextension[$logcount] = "$aryA[3]";
|
$VALOextension[$logcount] = "$aryA[3]";
|
||||||
$logcount++;
|
$logcount++;
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
$logrun=0;
|
$logrun=0;
|
||||||
foreach(@VALOuser)
|
foreach(@VALOuser)
|
||||||
{
|
{
|
||||||
$VALOuser_group='';
|
$VALOuser_group='';
|
||||||
$stmtA = "SELECT user_group FROM vicidial_users where user='$VALOuser[$logrun]';";
|
$stmtA = "SELECT user_group FROM vicidial_users where user='$VALOuser[$logrun]';";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
$UGrec_count=0;
|
$UGrec_count=0;
|
||||||
while ($sthArows > $UGrec_count)
|
while ($sthArows > $UGrec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$VALOuser_group = "$aryA[0]";
|
$VALOuser_group = "$aryA[0]";
|
||||||
$UGrec_count++;
|
$UGrec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
$stmtA = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VALOuser[$logrun]','LOGOUT','$VALOcampaign[$logrun]','$SQLdate','$now_date_epoch','$VALOuser_group');";
|
$stmtA = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VALOuser[$logrun]','LOGOUT','$VALOcampaign[$logrun]','$SQLdate','$now_date_epoch','$VALOuser_group');";
|
||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rows = $dbhA->do($stmtA);
|
||||||
|
|
||||||
@@ -1589,16 +1587,16 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$auto_call_id = "$aryA[0]";
|
$auto_call_id = "$aryA[0]";
|
||||||
$CLlead_id = "$aryA[1]";
|
$CLlead_id = "$aryA[1]";
|
||||||
$CLphone_number = "$aryA[2]";
|
$CLphone_number = "$aryA[2]";
|
||||||
$CLstatus = "$aryA[3]";
|
$CLstatus = "$aryA[3]";
|
||||||
$CLcampaign_id = "$aryA[4]";
|
$CLcampaign_id = "$aryA[4]";
|
||||||
$CLphone_code = "$aryA[5]";
|
$CLphone_code = "$aryA[5]";
|
||||||
$CLalt_dial = "$aryA[6]";
|
$CLalt_dial = "$aryA[6]";
|
||||||
$CLstage = "$aryA[7]";
|
$CLstage = "$aryA[7]";
|
||||||
$CLcallerid = "$aryA[8]";
|
$CLcallerid = "$aryA[8]";
|
||||||
$CLuniqueid = "$aryA[9]";
|
$CLuniqueid = "$aryA[9]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
@@ -1675,7 +1673,7 @@ while($one_day_interval > 0)
|
|||||||
### sleep for 2 and a half seconds before beginning the loop again
|
### sleep for 2 and a half seconds before beginning the loop again
|
||||||
usleep(1*$loop_delay*1000);
|
usleep(1*$loop_delay*1000);
|
||||||
|
|
||||||
$endless_loop--;
|
$endless_loop--;
|
||||||
if($DB){print STDERR "\nloop counter: |$endless_loop|\n";}
|
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
|
### putting a blank file called "VDAD.kill" in the directory will automatically safely kill this program
|
||||||
@@ -1696,11 +1694,11 @@ while($one_day_interval > 0)
|
|||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBvd_server_logs = "$aryA[0]";
|
$DBvd_server_logs = "$aryA[0]";
|
||||||
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
|
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
|
||||||
else {$SYSLOG = '0';}
|
else {$SYSLOG = '0';}
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
@@ -1713,14 +1711,14 @@ while($one_day_interval > 0)
|
|||||||
$rec_count=0;
|
$rec_count=0;
|
||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$enable_queuemetrics_logging = "$aryA[0]";
|
$enable_queuemetrics_logging = "$aryA[0]";
|
||||||
$queuemetrics_server_ip = "$aryA[1]";
|
$queuemetrics_server_ip = "$aryA[1]";
|
||||||
$queuemetrics_dbname = "$aryA[2]";
|
$queuemetrics_dbname = "$aryA[2]";
|
||||||
$queuemetrics_login= "$aryA[3]";
|
$queuemetrics_login= "$aryA[3]";
|
||||||
$queuemetrics_pass = "$aryA[4]";
|
$queuemetrics_pass = "$aryA[4]";
|
||||||
$queuemetrics_log_id = "$aryA[5]";
|
$queuemetrics_log_id = "$aryA[5]";
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
@@ -1742,20 +1740,20 @@ while($one_day_interval > 0)
|
|||||||
while ($sthArows > $rec_count)
|
while ($sthArows > $rec_count)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$DBmax_vicidial_trunks = "$aryA[0]";
|
$DBmax_vicidial_trunks = "$aryA[0]";
|
||||||
$DBanswer_transfer_agent= "$aryA[1]";
|
$DBanswer_transfer_agent= "$aryA[1]";
|
||||||
$DBSERVER_GMT = "$aryA[2]";
|
$DBSERVER_GMT = "$aryA[2]";
|
||||||
$DBext_context = "$aryA[3]";
|
$DBext_context = "$aryA[3]";
|
||||||
$max_vicidial_trunks = $DBmax_vicidial_trunks;
|
$max_vicidial_trunks = $DBmax_vicidial_trunks;
|
||||||
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
|
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
|
||||||
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
|
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
|
||||||
if ($DBext_context) {$ext_context = $DBext_context;}
|
if ($DBext_context) {$ext_context = $DBext_context;}
|
||||||
$rec_count++;
|
$rec_count++;
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
$event_string = "| updating server parameters $max_vicidial_trunks|$answer_transfer_agent|$SERVER_GMT|$ext_context|";
|
$event_string = "| updating server parameters $max_vicidial_trunks|$answer_transfer_agent|$SERVER_GMT|$ext_context|";
|
||||||
&event_logger;
|
&event_logger;
|
||||||
|
|
||||||
&get_time_now;
|
&get_time_now;
|
||||||
|
|
||||||
@@ -1767,7 +1765,7 @@ while($one_day_interval > 0)
|
|||||||
$i=0;
|
$i=0;
|
||||||
foreach (@psoutput)
|
foreach (@psoutput)
|
||||||
{
|
{
|
||||||
chomp($psoutput[$i]);
|
chomp($psoutput[$i]);
|
||||||
|
|
||||||
@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]);
|
@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]);
|
||||||
|
|
||||||
@@ -1788,27 +1786,27 @@ while($one_day_interval > 0)
|
|||||||
|
|
||||||
$bad_grabber_counter=0;
|
$bad_grabber_counter=0;
|
||||||
|
|
||||||
$stat_count++;
|
$stat_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";}
|
if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";}
|
||||||
|
|
||||||
$event_string='HANGING UP|';
|
$event_string='HANGING UP|';
|
||||||
&event_logger;
|
&event_logger;
|
||||||
|
|
||||||
$one_day_interval--;
|
$one_day_interval--;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$event_string='CLOSING DB CONNECTION|';
|
$event_string='CLOSING DB CONNECTION|';
|
||||||
&event_logger;
|
&event_logger;
|
||||||
|
|
||||||
|
|
||||||
$dbhA->disconnect();
|
$dbhA->disconnect();
|
||||||
|
|
||||||
|
|
||||||
if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";}
|
if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";}
|
||||||
|
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
@@ -1826,113 +1824,109 @@ exit;
|
|||||||
|
|
||||||
|
|
||||||
sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes
|
sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes
|
||||||
{
|
{
|
||||||
$secX = time();
|
$secX = time();
|
||||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX);
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX);
|
||||||
$LOCAL_GMT_OFF = $SERVER_GMT;
|
$LOCAL_GMT_OFF = $SERVER_GMT;
|
||||||
$LOCAL_GMT_OFF_STD = $SERVER_GMT;
|
$LOCAL_GMT_OFF_STD = $SERVER_GMT;
|
||||||
if ($isdst) {$LOCAL_GMT_OFF++;}
|
if ($isdst) {$LOCAL_GMT_OFF++;}
|
||||||
|
|
||||||
$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600));
|
$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600));
|
||||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now);
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now);
|
||||||
if ($hour < 10) {$hour = "0$hour";}
|
if ($hour < 10) {$hour = "0$hour";}
|
||||||
if ($min < 10) {$min = "0$min";}
|
if ($min < 10) {$min = "0$min";}
|
||||||
|
|
||||||
if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";}
|
if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";}
|
||||||
|
|
||||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||||
$year = ($year + 1900);
|
$year = ($year + 1900);
|
||||||
$mon++;
|
$mon++;
|
||||||
if ($mon < 10) {$mon = "0$mon";}
|
if ($mon < 10) {$mon = "0$mon";}
|
||||||
if ($mday < 10) {$mday = "0$mday";}
|
if ($mday < 10) {$mday = "0$mday";}
|
||||||
if ($hour < 10) {$hour = "0$hour";}
|
if ($hour < 10) {$hour = "0$hour";}
|
||||||
if ($min < 10) {$min = "0$min";}
|
if ($min < 10) {$min = "0$min";}
|
||||||
if ($sec < 10) {$sec = "0$sec";}
|
if ($sec < 10) {$sec = "0$sec";}
|
||||||
|
|
||||||
$now_date_epoch = time();
|
$now_date_epoch = time();
|
||||||
$now_date = "$year-$mon-$mday $hour:$min:$sec";
|
$now_date = "$year-$mon-$mday $hour:$min:$sec";
|
||||||
$file_date = "$year-$mon-$mday";
|
$file_date = "$year-$mon-$mday";
|
||||||
$CIDdate = "$mon$mday$hour$min$sec";
|
$CIDdate = "$mon$mday$hour$min$sec";
|
||||||
$tsSQLdate = "$year$mon$mday$hour$min$sec";
|
$tsSQLdate = "$year$mon$mday$hour$min$sec";
|
||||||
$SQLdate = "$year-$mon-$mday $hour:$min:$sec";
|
$SQLdate = "$year-$mon-$mday $hour:$min:$sec";
|
||||||
|
|
||||||
$BDtarget = ($secX - 10);
|
$BDtarget = ($secX - 10);
|
||||||
($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget);
|
($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget);
|
||||||
$Byear = ($Byear + 1900);
|
$Byear = ($Byear + 1900);
|
||||||
$Bmon++;
|
$Bmon++;
|
||||||
if ($Bmon < 10) {$Bmon = "0$Bmon";}
|
if ($Bmon < 10) {$Bmon = "0$Bmon";}
|
||||||
if ($Bmday < 10) {$Bmday = "0$Bmday";}
|
if ($Bmday < 10) {$Bmday = "0$Bmday";}
|
||||||
if ($Bhour < 10) {$Bhour = "0$Bhour";}
|
if ($Bhour < 10) {$Bhour = "0$Bhour";}
|
||||||
if ($Bmin < 10) {$Bmin = "0$Bmin";}
|
if ($Bmin < 10) {$Bmin = "0$Bmin";}
|
||||||
if ($Bsec < 10) {$Bsec = "0$Bsec";}
|
if ($Bsec < 10) {$Bsec = "0$Bsec";}
|
||||||
$BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec";
|
$BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec";
|
||||||
|
|
||||||
$PDtarget = ($secX - 30);
|
$PDtarget = ($secX - 30);
|
||||||
($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget);
|
($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget);
|
||||||
$Pyear = ($Pyear + 1900);
|
$Pyear = ($Pyear + 1900);
|
||||||
$Pmon++;
|
$Pmon++;
|
||||||
if ($Pmon < 10) {$Pmon = "0$Pmon";}
|
if ($Pmon < 10) {$Pmon = "0$Pmon";}
|
||||||
if ($Pmday < 10) {$Pmday = "0$Pmday";}
|
if ($Pmday < 10) {$Pmday = "0$Pmday";}
|
||||||
if ($Phour < 10) {$Phour = "0$Phour";}
|
if ($Phour < 10) {$Phour = "0$Phour";}
|
||||||
if ($Pmin < 10) {$Pmin = "0$Pmin";}
|
if ($Pmin < 10) {$Pmin = "0$Pmin";}
|
||||||
if ($Psec < 10) {$Psec = "0$Psec";}
|
if ($Psec < 10) {$Psec = "0$Psec";}
|
||||||
$PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec";
|
$PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec";
|
||||||
$halfminSQLdate = "$Pyear-$Pmon-$Pmday $Phour:$Pmin:$Psec";
|
$halfminSQLdate = "$Pyear-$Pmon-$Pmday $Phour:$Pmin:$Psec";
|
||||||
|
|
||||||
$XDtarget = ($secX - 120);
|
$XDtarget = ($secX - 120);
|
||||||
($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget);
|
($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget);
|
||||||
$Xyear = ($Xyear + 1900);
|
$Xyear = ($Xyear + 1900);
|
||||||
$Xmon++;
|
$Xmon++;
|
||||||
if ($Xmon < 10) {$Xmon = "0$Xmon";}
|
if ($Xmon < 10) {$Xmon = "0$Xmon";}
|
||||||
if ($Xmday < 10) {$Xmday = "0$Xmday";}
|
if ($Xmday < 10) {$Xmday = "0$Xmday";}
|
||||||
if ($Xhour < 10) {$Xhour = "0$Xhour";}
|
if ($Xhour < 10) {$Xhour = "0$Xhour";}
|
||||||
if ($Xmin < 10) {$Xmin = "0$Xmin";}
|
if ($Xmin < 10) {$Xmin = "0$Xmin";}
|
||||||
if ($Xsec < 10) {$Xsec = "0$Xsec";}
|
if ($Xsec < 10) {$Xsec = "0$Xsec";}
|
||||||
$XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec";
|
$XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec";
|
||||||
|
|
||||||
$TDtarget = ($secX - 6000);
|
$TDtarget = ($secX - 6000);
|
||||||
($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget);
|
($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget);
|
||||||
$Tyear = ($Tyear + 1900);
|
$Tyear = ($Tyear + 1900);
|
||||||
$Tmon++;
|
$Tmon++;
|
||||||
if ($Tmon < 10) {$Tmon = "0$Tmon";}
|
if ($Tmon < 10) {$Tmon = "0$Tmon";}
|
||||||
if ($Tmday < 10) {$Tmday = "0$Tmday";}
|
if ($Tmday < 10) {$Tmday = "0$Tmday";}
|
||||||
if ($Thour < 10) {$Thour = "0$Thour";}
|
if ($Thour < 10) {$Thour = "0$Thour";}
|
||||||
if ($Tmin < 10) {$Tmin = "0$Tmin";}
|
if ($Tmin < 10) {$Tmin = "0$Tmin";}
|
||||||
if ($Tsec < 10) {$Tsec = "0$Tsec";}
|
if ($Tsec < 10) {$Tsec = "0$Tsec";}
|
||||||
$TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec";
|
$TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec";
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sub event_logger
|
sub event_logger
|
||||||
{
|
|
||||||
if ($DB) {print "$now_date|$event_string|\n";}
|
|
||||||
if ($SYSLOG)
|
|
||||||
{
|
{
|
||||||
### open the log file for writing ###
|
if ($DB) {print "$now_date|$event_string|\n";}
|
||||||
open(Lout, ">>$VDADLOGfile")
|
if ($SYSLOG)
|
||||||
|| die "Can't open $VDADLOGfile: $!\n";
|
{
|
||||||
print Lout "$now_date|$event_string|\n";
|
### open the log file for writing ###
|
||||||
close(Lout);
|
open(Lout, ">>$VDADLOGfile")
|
||||||
|
|| die "Can't open $VDADLOGfile: $!\n";
|
||||||
|
print Lout "$now_date|$event_string|\n";
|
||||||
|
close(Lout);
|
||||||
|
}
|
||||||
|
$event_string='';
|
||||||
}
|
}
|
||||||
$event_string='';
|
|
||||||
}
|
|
||||||
|
|
||||||
sub jam_event_logger
|
sub jam_event_logger
|
||||||
{
|
|
||||||
if ($DB) {print "$now_date|$jam_string|\n";}
|
|
||||||
if ($useJAMdebugFILE)
|
|
||||||
{
|
{
|
||||||
### open the log file for writing ###
|
if ($DB) {print "$now_date|$jam_string|\n";}
|
||||||
open(Jout, ">>$JAMdebugFILE")
|
if ($useJAMdebugFILE)
|
||||||
|| die "Can't open $JAMdebugFILE: $!\n";
|
{
|
||||||
print Jout "$now_date|$jam_string|\n";
|
### open the log file for writing ###
|
||||||
close(Jout);
|
open(Jout, ">>$JAMdebugFILE")
|
||||||
|
|| die "Can't open $JAMdebugFILE: $!\n";
|
||||||
|
print Jout "$now_date|$jam_string|\n";
|
||||||
|
close(Jout);
|
||||||
|
}
|
||||||
|
$jam_string='';
|
||||||
}
|
}
|
||||||
$jam_string='';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# AST_VDsales_export.pl version: 2.0.5
|
# AST_VDsales_export.pl version: 2.2.0
|
||||||
#
|
#
|
||||||
# This script is designed to gather sales for a VICIDIAL Outbound-only campaign and
|
# This script is designed to gather sales for a VICIDIAL Outbound-only campaign and
|
||||||
# post them to a directory
|
# post them to a directory
|
||||||
@@ -17,11 +17,14 @@
|
|||||||
# 71005-0054 - Altered script to use astguiclient.conf for settings
|
# 71005-0054 - Altered script to use astguiclient.conf for settings
|
||||||
# 90105-1155 - Added AS400 export formats and changed around date override
|
# 90105-1155 - Added AS400 export formats and changed around date override
|
||||||
# 90106-2309 - Added email sending
|
# 90106-2309 - Added email sending
|
||||||
#
|
# 90620-0900 - Formatting fixes
|
||||||
|
#
|
||||||
|
|
||||||
$txt = '.txt';
|
$txt = '.txt';
|
||||||
$US = '_';
|
$US = '_';
|
||||||
$MT[0] = '';
|
$MT[0] = '';
|
||||||
|
$Q=0;
|
||||||
|
$DB=0;
|
||||||
|
|
||||||
# Default FTP account variables
|
# Default FTP account variables
|
||||||
$VARREPORT_host = '10.0.0.4';
|
$VARREPORT_host = '10.0.0.4';
|
||||||
@@ -50,6 +53,7 @@ $timestamp = "$year-$mon-$mday $hour:$min:$sec";
|
|||||||
$filedate = "$year$mon$mday";
|
$filedate = "$year$mon$mday";
|
||||||
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
||||||
$shipdate = "$year-$mon-$mday";
|
$shipdate = "$year-$mon-$mday";
|
||||||
|
$start_date = "$year$mon$mday";
|
||||||
$datestamp = "$year/$mon/$mday $hour:$min";
|
$datestamp = "$year/$mon/$mday $hour:$min";
|
||||||
|
|
||||||
|
|
||||||
@@ -91,10 +95,13 @@ if (length($ARGV[0])>1)
|
|||||||
print " [--output-format=XXX] = Format of file. Default \"pipe-standard\"\n";
|
print " [--output-format=XXX] = Format of file. Default \"pipe-standard\"\n";
|
||||||
print " [--with-inbound=XXX-XXY] = include the following inbound groups\n";
|
print " [--with-inbound=XXX-XXY] = include the following inbound groups\n";
|
||||||
print " [--ftp-transfer] = Send results file by FTP to another server\n";
|
print " [--ftp-transfer] = Send results file by FTP to another server\n";
|
||||||
|
print " [--ftp-audio-transfer] = Send associated audio files to FTP server, dated directories\n";
|
||||||
|
print " [--with-transfer-audio] = Different method for finding audio, also grabs transfer audio filenames\n";
|
||||||
|
print " [--with-did-lookup] = Looks up the DID pattern and name the call came in on if possible\n";
|
||||||
print " [--email-list=test@test.com:test2@test.com] = send email results to these addresses\n";
|
print " [--email-list=test@test.com:test2@test.com] = send email results to these addresses\n";
|
||||||
print " [--email-sender=vicidial@localhost] = sender for the email results\n";
|
print " [--email-sender=vicidial@localhost] = sender for the email results\n";
|
||||||
print " [-q] = quiet\n";
|
print " [--quiet] = quiet\n";
|
||||||
print " [-t] = test\n";
|
print " [--test] = test\n";
|
||||||
print " [--debug] = debugging messages\n";
|
print " [--debug] = debugging messages\n";
|
||||||
print " [--debugX] = Super debugging messages\n";
|
print " [--debugX] = Super debugging messages\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
@@ -113,7 +120,7 @@ if (length($ARGV[0])>1)
|
|||||||
$DBX=1;
|
$DBX=1;
|
||||||
print "\n----- SUPER DEBUG MODE -----\n\n";
|
print "\n----- SUPER DEBUG MODE -----\n\n";
|
||||||
}
|
}
|
||||||
if ($args =~ /-q/i)
|
if ($args =~ /-quiet/i)
|
||||||
{
|
{
|
||||||
$q=1; $Q=1;
|
$q=1; $Q=1;
|
||||||
}
|
}
|
||||||
@@ -173,32 +180,32 @@ if (length($ARGV[0])>1)
|
|||||||
{
|
{
|
||||||
# print "\n|$ARGS|\n\n";
|
# print "\n|$ARGS|\n\n";
|
||||||
@data_in = split(/--filename=/,$args);
|
@data_in = split(/--filename=/,$args);
|
||||||
$filename = $data_in[1];
|
$filename = $data_in[1];
|
||||||
$filename =~ s/ .*$//gi;
|
$filename =~ s/ .*$//gi;
|
||||||
$filename =~ s/YYYY/$year/gi;
|
$filename =~ s/YYYY/$year/gi;
|
||||||
$filename =~ s/MM/$mon/gi;
|
$filename =~ s/MM/$mon/gi;
|
||||||
$filename =~ s/DD/$mday/gi;
|
$filename =~ s/DD/$mday/gi;
|
||||||
$filename_override=1;
|
$filename_override=1;
|
||||||
}
|
}
|
||||||
if ($args =~ /--sale-statuses=/i)
|
if ($args =~ /--sale-statuses=/i)
|
||||||
{
|
{
|
||||||
@data_in = split(/--sale-statuses=/,$args);
|
@data_in = split(/--sale-statuses=/,$args);
|
||||||
$sale_statuses = $data_in[1];
|
$sale_statuses = $data_in[1];
|
||||||
$sale_statuses =~ s/ .*$//gi;
|
$sale_statuses =~ s/ .*$//gi;
|
||||||
if ($sale_statuses =~ /---ALL---/)
|
if ($sale_statuses =~ /---ALL---/)
|
||||||
{if (!$Q) {print "\n----- EXPORT ALL STATUSES -----\n\n";} }
|
{if (!$Q) {print "\n----- EXPORT ALL STATUSES -----\n\n";} }
|
||||||
}
|
}
|
||||||
if ($args =~ /--output-format=/i)
|
if ($args =~ /--output-format=/i)
|
||||||
{
|
{
|
||||||
@data_in = split(/--output-format=/,$args);
|
@data_in = split(/--output-format=/,$args);
|
||||||
$output_format = $data_in[1];
|
$output_format = $data_in[1];
|
||||||
$output_format =~ s/ .*$//gi;
|
$output_format =~ s/ .*$//gi;
|
||||||
}
|
}
|
||||||
if ($args =~ /--with-inbound=/i)
|
if ($args =~ /--with-inbound=/i)
|
||||||
{
|
{
|
||||||
@data_in = split(/--with-inbound=/,$args);
|
@data_in = split(/--with-inbound=/,$args);
|
||||||
$with_inbound = $data_in[1];
|
$with_inbound = $data_in[1];
|
||||||
$with_inbound =~ s/ .*$//gi;
|
$with_inbound =~ s/ .*$//gi;
|
||||||
}
|
}
|
||||||
if ($args =~ /-ftp-transfer/i)
|
if ($args =~ /-ftp-transfer/i)
|
||||||
{
|
{
|
||||||
@@ -206,6 +213,62 @@ if (length($ARGV[0])>1)
|
|||||||
{print "\n----- FTP TRANSFER MODE -----\n\n";}
|
{print "\n----- FTP TRANSFER MODE -----\n\n";}
|
||||||
$ftp_transfer=1;
|
$ftp_transfer=1;
|
||||||
}
|
}
|
||||||
|
if ($args =~ /-ftp-audio-transfer/i)
|
||||||
|
{
|
||||||
|
if (!$Q)
|
||||||
|
{print "\n----- FTP AUDIO TRANSFER MODE -----\n\n";}
|
||||||
|
$ftp_audio_transfer=1;
|
||||||
|
|
||||||
|
### find wget binary
|
||||||
|
$wgetbin = '';
|
||||||
|
if ( -e ('/bin/wget')) {$wgetbin = '/bin/wget';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( -e ('/usr/bin/wget')) {$wgetbin = '/usr/bin/wget';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( -e ('/usr/local/bin/wget')) {$wgetbin = '/usr/local/bin/wget';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Can't find wget binary! Exiting...\n";
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### find find binary
|
||||||
|
$findbin = '';
|
||||||
|
if ( -e ('/bin/find')) {$findbin = '/bin/find';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( -e ('/usr/bin/find')) {$findbin = '/usr/bin/find';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( -e ('/usr/local/bin/find')) {$findbin = '/usr/local/bin/find';}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Can't find find binary! Exiting...\n";
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tempdir = '/root/tempaudioexport';
|
||||||
|
if (!-e "$tempdir")
|
||||||
|
{`mkdir -p $tempdir`;}
|
||||||
|
## remove old audio files from directory
|
||||||
|
`$findbin $tempdir/ -maxdepth 1 -type f -mtime +0 -print | xargs rm -f`;
|
||||||
|
}
|
||||||
|
if ($args =~ /-with-transfer-audio/i)
|
||||||
|
{
|
||||||
|
if (!$Q)
|
||||||
|
{print "\n----- AUDIO TRANSFER LOOKUP MODE -----\n\n";}
|
||||||
|
$with_transfer_audio=1;
|
||||||
|
}
|
||||||
|
if ($args =~ /-with-did-lookup/i)
|
||||||
|
{
|
||||||
|
if (!$Q)
|
||||||
|
{print "\n----- DID LOOKUP ENABLED -----\n\n";}
|
||||||
|
$with_did_lookup=1;
|
||||||
|
}
|
||||||
if ($args =~ /--test/i)
|
if ($args =~ /--test/i)
|
||||||
{
|
{
|
||||||
$T=1; $TEST=1;
|
$T=1; $TEST=1;
|
||||||
@@ -214,9 +277,9 @@ if (length($ARGV[0])>1)
|
|||||||
if ($args =~ /--email-list=/i)
|
if ($args =~ /--email-list=/i)
|
||||||
{
|
{
|
||||||
@data_in = split(/--email-list=/,$args);
|
@data_in = split(/--email-list=/,$args);
|
||||||
$email_list = $data_in[1];
|
$email_list = $data_in[1];
|
||||||
$email_list =~ s/ .*//gi;
|
$email_list =~ s/ .*//gi;
|
||||||
$email_list =~ s/:/,/gi;
|
$email_list =~ s/:/,/gi;
|
||||||
print "\n----- EMAIL NOTIFICATION: $email_list -----\n\n";
|
print "\n----- EMAIL NOTIFICATION: $email_list -----\n\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -225,9 +288,9 @@ if (length($ARGV[0])>1)
|
|||||||
if ($args =~ /--email-sender=/i)
|
if ($args =~ /--email-sender=/i)
|
||||||
{
|
{
|
||||||
@data_in = split(/--email-sender=/,$args);
|
@data_in = split(/--email-sender=/,$args);
|
||||||
$email_sender = $data_in[1];
|
$email_sender = $data_in[1];
|
||||||
$email_sender =~ s/ .*//gi;
|
$email_sender =~ s/ .*//gi;
|
||||||
$email_sender =~ s/:/,/gi;
|
$email_sender =~ s/:/,/gi;
|
||||||
print "\n----- EMAIL NOTIFICATION SENDER: $email_sender -----\n\n";
|
print "\n----- EMAIL NOTIFICATION SENDER: $email_sender -----\n\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -235,9 +298,9 @@ if (length($ARGV[0])>1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "no command line options set, using defaults.\n";
|
print "no command line options set, using defaults.\n";
|
||||||
}
|
}
|
||||||
### end parsing run-time options ###
|
### end parsing run-time options ###
|
||||||
|
|
||||||
# default path to astguiclient configuration file:
|
# default path to astguiclient configuration file:
|
||||||
@@ -306,24 +369,24 @@ if ($output_format =~ /^html-rec$/)
|
|||||||
if ($output_format =~ /^fixed-as400$/)
|
if ($output_format =~ /^fixed-as400$/)
|
||||||
{$DLT = ''; $txt='.txt'; print "---- fixed-as400 ----\n";}
|
{$DLT = ''; $txt='.txt'; print "---- fixed-as400 ----\n";}
|
||||||
|
|
||||||
if ($sale_statuses =~ /---ALL---/)
|
if ($sale_statuses =~ /---ALL---/)
|
||||||
{
|
{
|
||||||
$sale_statusesSQL='';
|
$sale_statusesSQL='';
|
||||||
$close_statusesSQL='';
|
$close_statusesSQL='';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sale_statusesSQL = $sale_statuses;
|
$sale_statusesSQL = $sale_statuses;
|
||||||
$sale_statusesSQL =~ s/-/','/gi;
|
$sale_statusesSQL =~ s/-/','/gi;
|
||||||
$sale_statusesSQL = "'$sale_statusesSQL'";
|
$sale_statusesSQL = "'$sale_statusesSQL'";
|
||||||
$close_statusesSQL = $sale_statusesSQL;
|
$close_statusesSQL = $sale_statusesSQL;
|
||||||
$sale_statusesSQL = " and vicidial_log.status IN($sale_statusesSQL)";
|
$sale_statusesSQL = " and vicidial_log.status IN($sale_statusesSQL)";
|
||||||
$close_statusesSQL = " and vicidial_closer_log.status IN($close_statusesSQL)";
|
$close_statusesSQL = " and vicidial_closer_log.status IN($close_statusesSQL)";
|
||||||
}
|
}
|
||||||
|
|
||||||
$with_inboundSQL = $with_inbound;
|
$with_inboundSQL = $with_inbound;
|
||||||
$with_inboundSQL =~ s/-/','/gi;
|
$with_inboundSQL =~ s/-/','/gi;
|
||||||
$with_inboundSQL = "'$with_inboundSQL'";
|
$with_inboundSQL = "'$with_inboundSQL'";
|
||||||
|
|
||||||
if (!$Q)
|
if (!$Q)
|
||||||
{
|
{
|
||||||
@@ -362,7 +425,7 @@ $TOTAL_SALES=0;
|
|||||||
###########################################################################
|
###########################################################################
|
||||||
########### CURRENT DAY SALES GATHERING outbound-only: vicidial_log ######
|
########### CURRENT DAY SALES GATHERING outbound-only: vicidial_log ######
|
||||||
###########################################################################
|
###########################################################################
|
||||||
$stmtA = "select vicidial_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_log.list_id,title,address3,last_local_call_time from vicidial_list,vicidial_log,vicidial_users where campaign_id IN($campaignSQL) $sale_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_log.user;";
|
$stmtA = "select vicidial_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,vicidial_list.email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_log.list_id,title,address3,last_local_call_time,uniqueid,length_in_sec from vicidial_list,vicidial_log,vicidial_users where campaign_id IN($campaignSQL) $sale_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_log.user;";
|
||||||
#$stmtA = "select vicidial_users.user,first_name,last_name,address1,address2,city,state,postal_code,phone_number,email,security_phrase,comments,last_local_call_time,lead_id,vicidial_users.full_name,status,vendor_lead_code,source_id,list_id,title,address3,last_local_call_time from vicidial_list,vicidial_users where list_id NOT IN('999','998') $sale_statusesSQL and called_count > 0 and vicidial_users.user=vicidial_list.user;";
|
#$stmtA = "select vicidial_users.user,first_name,last_name,address1,address2,city,state,postal_code,phone_number,email,security_phrase,comments,last_local_call_time,lead_id,vicidial_users.full_name,status,vendor_lead_code,source_id,list_id,title,address3,last_local_call_time from vicidial_list,vicidial_users where list_id NOT IN('999','998') $sale_statusesSQL and called_count > 0 and vicidial_users.user=vicidial_list.user;";
|
||||||
if ($DB) {print "|$stmtA|\n";}
|
if ($DB) {print "|$stmtA|\n";}
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
@@ -394,6 +457,12 @@ while ($sthArows > $rec_count)
|
|||||||
$title = $aryA[19];
|
$title = $aryA[19];
|
||||||
$address3 = $aryA[20];
|
$address3 = $aryA[20];
|
||||||
$last_local_call_time = $aryA[21];
|
$last_local_call_time = $aryA[21];
|
||||||
|
$vicidial_id = $aryA[22];
|
||||||
|
$uniqueid = $aryA[22];
|
||||||
|
$length_in_sec = $aryA[23];
|
||||||
|
|
||||||
|
$queue_seconds = '0';
|
||||||
|
$closer='';
|
||||||
|
|
||||||
&select_format_loop;
|
&select_format_loop;
|
||||||
|
|
||||||
@@ -406,7 +475,7 @@ if (length($with_inboundSQL)>3)
|
|||||||
###########################################################################
|
###########################################################################
|
||||||
########### CURRENT DAY SALES GATHERING inbound-only: vicidial_closer_log ######
|
########### CURRENT DAY SALES GATHERING inbound-only: vicidial_closer_log ######
|
||||||
###########################################################################
|
###########################################################################
|
||||||
$stmtA = "select vicidial_closer_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_closer_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_closer_log.list_id,campaign_id,title,address3,last_local_call_time from vicidial_list,vicidial_closer_log,vicidial_users where campaign_id IN($with_inboundSQL) $close_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_closer_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_closer_log.user;";
|
$stmtA = "select vicidial_closer_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,vicidial_list.email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_closer_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_closer_log.list_id,campaign_id,title,address3,last_local_call_time,xfercallid,closecallid,uniqueid,length_in_sec,queue_seconds from vicidial_list,vicidial_closer_log,vicidial_users where campaign_id IN($with_inboundSQL) $close_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_closer_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_closer_log.user;";
|
||||||
if ($DB) {print "|$stmtA|\n";}
|
if ($DB) {print "|$stmtA|\n";}
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
@@ -438,21 +507,24 @@ if (length($with_inboundSQL)>3)
|
|||||||
$title = $aryA[20];
|
$title = $aryA[20];
|
||||||
$address3 = $aryA[21];
|
$address3 = $aryA[21];
|
||||||
$last_local_call_time = $aryA[22];
|
$last_local_call_time = $aryA[22];
|
||||||
|
$xfercallid = $aryA[23];
|
||||||
|
$vicidial_id = $aryA[24];
|
||||||
|
$uniqueid = $aryA[25];
|
||||||
|
$length_in_sec = $aryA[26];
|
||||||
|
$queue_seconds = $aryA[27];
|
||||||
|
|
||||||
$user = '';
|
$user = '';
|
||||||
$agent_name='';
|
$agent_name='';
|
||||||
|
|
||||||
$stmtB = "select vicidial_xfer_log.user,full_name from vicidial_xfer_log,vicidial_users where lead_id='$lead_id' and closer='$closer' and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_users.user=vicidial_xfer_log.user order by call_date desc limit 1;";
|
$stmtB = "select vicidial_xfer_log.user,full_name from vicidial_xfer_log,vicidial_users where lead_id='$lead_id' and closer='$closer' and xfercallid='$xfercallid' and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_users.user=vicidial_xfer_log.user order by call_date desc limit 1;";
|
||||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
$sthBrows=$sthB->rows;
|
$sthBrows=$sthB->rows;
|
||||||
$rec_countB=0;
|
if ($sthBrows > 0)
|
||||||
while ($sthBrows > $rec_countB)
|
|
||||||
{
|
{
|
||||||
@aryB = $sthB->fetchrow_array;
|
@aryB = $sthB->fetchrow_array;
|
||||||
$user = $aryB[0];
|
$user = $aryB[0];
|
||||||
$agent_name = $aryB[1];
|
$agent_name = $aryB[1];
|
||||||
$rec_countB++;
|
|
||||||
}
|
}
|
||||||
$sthB->finish();
|
$sthB->finish();
|
||||||
|
|
||||||
@@ -463,7 +535,6 @@ if (length($with_inboundSQL)>3)
|
|||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
close(out);
|
close(out);
|
||||||
|
|
||||||
|
|
||||||
@@ -479,43 +550,53 @@ if ( (length($Ealert)>5) && (length($email_list) > 3) )
|
|||||||
|
|
||||||
$mailsubject = "VICIDIAL Lead Export $outfile";
|
$mailsubject = "VICIDIAL Lead Export $outfile";
|
||||||
|
|
||||||
%mail = ( To => "$email_list",
|
%mail = ( To => "$email_list",
|
||||||
From => "$email_sender",
|
From => "$email_sender",
|
||||||
Subject => "$mailsubject",
|
Subject => "$mailsubject",
|
||||||
);
|
);
|
||||||
$boundary = "====" . time() . "====";
|
$boundary = "====" . time() . "====";
|
||||||
$mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\"";
|
$mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\"";
|
||||||
|
|
||||||
$message = encode_qp( "VICIDIAL Lead Export:\n\n Attachment: $outfile\n Total Records: $TOTAL_SALES\n" );
|
$message = encode_qp( "VICIDIAL Lead Export:\n\n Attachment: $outfile\n Total Records: $TOTAL_SALES\n" );
|
||||||
|
|
||||||
$Zfile = "$PATHoutfile";
|
$Zfile = "$PATHoutfile";
|
||||||
|
|
||||||
open (F, $Zfile) or die "Cannot read $Zfile: $!";
|
open (F, $Zfile) or die "Cannot read $Zfile: $!";
|
||||||
binmode F; undef $/;
|
binmode F; undef $/;
|
||||||
$attachment = encode_base64(<F>);
|
$attachment = encode_base64(<F>);
|
||||||
close F;
|
close F;
|
||||||
|
|
||||||
$boundary = '--'.$boundary;
|
$boundary = '--'.$boundary;
|
||||||
$mail{body} .= "$boundary\n";
|
$mail{body} .= "$boundary\n";
|
||||||
$mail{body} .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
|
$mail{body} .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
|
||||||
$mail{body} .= "Content-Transfer-Encoding: quoted-printable\n\n";
|
$mail{body} .= "Content-Transfer-Encoding: quoted-printable\n\n";
|
||||||
$mail{body} .= "$message\n";
|
$mail{body} .= "$message\n";
|
||||||
$mail{body} .= "$boundary\n";
|
$mail{body} .= "$boundary\n";
|
||||||
$mail{body} .= "Content-Type: application/octet-stream; name=\"$outfile\"\n";
|
$mail{body} .= "Content-Type: application/octet-stream; name=\"$outfile\"\n";
|
||||||
$mail{body} .= "Content-Transfer-Encoding: base64\n";
|
$mail{body} .= "Content-Transfer-Encoding: base64\n";
|
||||||
$mail{body} .= "Content-Disposition: attachment; filename=\"$outfile\"\n\n";
|
$mail{body} .= "Content-Disposition: attachment; filename=\"$outfile\"\n\n";
|
||||||
$mail{body} .= "$attachment\n";
|
$mail{body} .= "$attachment\n";
|
||||||
$mail{body} .= "$boundary";
|
$mail{body} .= "$boundary";
|
||||||
$mail{body} .= "--\n";
|
$mail{body} .= "--\n";
|
||||||
|
|
||||||
sendmail(%mail) or die $mail::Sendmail::error;
|
sendmail(%mail) or die $mail::Sendmail::error;
|
||||||
print "ok. log says:\n", $mail::sendmail::log; ### print mail log for status
|
print "ok. log says:\n", $mail::sendmail::log; ### print mail log for status
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# FTP overrides-
|
||||||
|
# $VARREPORT_host = '10.0.0.4';
|
||||||
|
# $VARREPORT_port = '21';
|
||||||
|
# $VARREPORT_user = 'cron';
|
||||||
|
# $VARREPORT_pass = 'test';
|
||||||
|
# $VARREPORT_dir = '';
|
||||||
|
$NODATEDIR = 0; # Don't use dated directories for audio
|
||||||
|
$YEARDIR = 1; # put dated directories in a year directory first
|
||||||
|
|
||||||
if ($ftp_transfer > 0)
|
if ($ftp_transfer > 0)
|
||||||
{
|
{
|
||||||
use Net::FTP;
|
use Net::FTP;
|
||||||
|
|
||||||
if (!$Q) {print "Sending File Over FTP: $outfile\n";}
|
if (!$Q) {print "Sending File Over FTP: $outfile\n";}
|
||||||
@@ -524,7 +605,44 @@ if ($ftp_transfer > 0)
|
|||||||
$ftp->cwd("$VARREPORT_dir");
|
$ftp->cwd("$VARREPORT_dir");
|
||||||
$ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile");
|
$ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile");
|
||||||
$ftp->quit;
|
$ftp->quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ftp_audio_transfer > 0)
|
||||||
|
{
|
||||||
|
use Net::FTP;
|
||||||
|
if (!$Q) {print "Sending File Over FTP: $outfile\n";}
|
||||||
|
|
||||||
|
opendir(FILE, "$tempdir/");
|
||||||
|
@FILES = readdir(FILE);
|
||||||
|
|
||||||
|
$i=0;
|
||||||
|
foreach(@FILES)
|
||||||
|
{
|
||||||
|
if ( (length($FILES[$i]) > 4) && (!-d "$tempdir/$FILES[$i]") )
|
||||||
|
{
|
||||||
|
$ftp = Net::FTP->new("$VARREPORT_host", Port => "$VARREPORT_port", Debug => "$DB", Passive => "1");
|
||||||
|
$ftp->login("$VARREPORT_user","$VARREPORT_pass");
|
||||||
|
if (length($VARREPORT_dir) > 0)
|
||||||
|
{$ftp->cwd("$VARREPORT_dir");}
|
||||||
|
if ($NODATEDIR < 1)
|
||||||
|
{
|
||||||
|
if ($YEARDIR > 0)
|
||||||
|
{
|
||||||
|
$ftp->mkdir("$year");
|
||||||
|
$ftp->cwd("$year");
|
||||||
|
}
|
||||||
|
$ftp->mkdir("$start_date");
|
||||||
|
$ftp->cwd("$start_date");
|
||||||
|
}
|
||||||
|
$start_date_PATH = "$start_date/";
|
||||||
|
$ftp->binary();
|
||||||
|
$ftp->put("$tempdir/$FILES[$i]", "$FILES[$i]");
|
||||||
|
$ftp->quit;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
### calculate time to run script ###
|
### calculate time to run script ###
|
||||||
$secY = time();
|
$secY = time();
|
||||||
@@ -543,57 +661,26 @@ exit;
|
|||||||
|
|
||||||
### Subroutine for formatting of the output ###
|
### Subroutine for formatting of the output ###
|
||||||
sub select_format_loop
|
sub select_format_loop
|
||||||
{
|
|
||||||
|
|
||||||
if ($T)
|
|
||||||
{
|
{
|
||||||
# $user = '1234';
|
if ($T)
|
||||||
$agent_name = 'Joe Agent';
|
|
||||||
# $closer = '4321';
|
|
||||||
$closer_name = 'Jane Closer';
|
|
||||||
$security = '4111111111111111';
|
|
||||||
$comments = 'VISA';
|
|
||||||
$phone_number =~ s/^\d\d\d\d\d/23456/gi;
|
|
||||||
$address1 =~ s/^..../1234 /gi
|
|
||||||
}
|
|
||||||
$ivr_id = '0';
|
|
||||||
$ivr_filename = '';
|
|
||||||
|
|
||||||
|
|
||||||
$stmtB = "select recording_id,filename,location from recording_log where lead_id='$lead_id' and start_time > '$shipdate 00:00:01' and start_time < '$shipdate 23:59:59' order by length_in_sec desc limit 1;";
|
|
||||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
|
||||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
|
||||||
$sthBrows=$sthB->rows;
|
|
||||||
$rec_countB=0;
|
|
||||||
while ($sthBrows > $rec_countB)
|
|
||||||
{
|
|
||||||
@aryB = $sthB->fetchrow_array;
|
|
||||||
$ivr_id = $aryB[0];
|
|
||||||
$ivr_filename = $aryB[1];
|
|
||||||
$ivr_location = $aryB[2];
|
|
||||||
$rec_countB++;
|
|
||||||
}
|
|
||||||
$sthB->finish();
|
|
||||||
|
|
||||||
if (length($ivr_id)<3)
|
|
||||||
{
|
|
||||||
$stmtB = "select recording_id,filename from recording_log where lead_id='$lead_id' order by length_in_sec desc limit 1;";
|
|
||||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
|
||||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
|
||||||
$sthBrows=$sthB->rows;
|
|
||||||
$rec_countB=0;
|
|
||||||
while ($sthBrows > $rec_countB)
|
|
||||||
{
|
{
|
||||||
@aryB = $sthB->fetchrow_array;
|
# $user = '1234';
|
||||||
$ivr_id = $aryB[0];
|
$agent_name = 'Joe Agent';
|
||||||
$ivr_filename = $aryB[1];
|
# $closer = '4321';
|
||||||
$rec_countB++;
|
$closer_name = 'Jane Closer';
|
||||||
|
$security = '4111111111111111';
|
||||||
|
$comments = 'VISA';
|
||||||
|
$phone_number =~ s/^\d\d\d\d\d/23456/gi;
|
||||||
|
$address1 =~ s/^..../1234 /gi
|
||||||
}
|
}
|
||||||
$sthB->finish();
|
|
||||||
|
|
||||||
if (length($ivr_id)<3)
|
##### BEGIN standard audio lookup #####
|
||||||
|
if ($with_transfer_audio < 1)
|
||||||
{
|
{
|
||||||
$stmtB = "select recording_id,filename from recording_log where filename LIKE \"%$phone_number%\" order by length_in_sec desc limit 1;";
|
$ivr_id = '0';
|
||||||
|
$ivr_filename = '';
|
||||||
|
|
||||||
|
$stmtB = "select recording_id,filename,location from recording_log where lead_id='$lead_id' and start_time > '$shipdate 00:00:01' and start_time < '$shipdate 23:59:59' order by length_in_sec desc limit 1;";
|
||||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
$sthBrows=$sthB->rows;
|
$sthBrows=$sthB->rows;
|
||||||
@@ -601,103 +688,286 @@ if (length($ivr_id)<3)
|
|||||||
while ($sthBrows > $rec_countB)
|
while ($sthBrows > $rec_countB)
|
||||||
{
|
{
|
||||||
@aryB = $sthB->fetchrow_array;
|
@aryB = $sthB->fetchrow_array;
|
||||||
$ivr_id = $aryB[0];
|
$ivr_id = $aryB[0];
|
||||||
$ivr_filename = $aryB[1];
|
$ivr_filename = $aryB[1];
|
||||||
|
$ivr_location = $aryB[2];
|
||||||
$rec_countB++;
|
$rec_countB++;
|
||||||
}
|
}
|
||||||
$sthB->finish();
|
$sthB->finish();
|
||||||
|
|
||||||
|
if (length($ivr_id)<3)
|
||||||
|
{
|
||||||
|
$stmtB = "select recording_id,filename,location from recording_log where lead_id='$lead_id' order by length_in_sec desc limit 1;";
|
||||||
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
|
$sthBrows=$sthB->rows;
|
||||||
|
$rec_countB=0;
|
||||||
|
while ($sthBrows > $rec_countB)
|
||||||
|
{
|
||||||
|
@aryB = $sthB->fetchrow_array;
|
||||||
|
$ivr_id = $aryB[0];
|
||||||
|
$ivr_filename = $aryB[1];
|
||||||
|
$ivr_location = $aryB[2];
|
||||||
|
$rec_countB++;
|
||||||
|
}
|
||||||
|
$sthB->finish();
|
||||||
|
|
||||||
|
if (length($ivr_id)<3)
|
||||||
|
{
|
||||||
|
$stmtB = "select recording_id,filename,location from recording_log where filename LIKE \"%$phone_number%\" order by length_in_sec desc limit 1;";
|
||||||
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
|
$sthBrows=$sthB->rows;
|
||||||
|
$rec_countB=0;
|
||||||
|
while ($sthBrows > $rec_countB)
|
||||||
|
{
|
||||||
|
@aryB = $sthB->fetchrow_array;
|
||||||
|
$ivr_id = $aryB[0];
|
||||||
|
$ivr_filename = $aryB[1];
|
||||||
|
$ivr_location = $aryB[2];
|
||||||
|
$rec_countB++;
|
||||||
|
}
|
||||||
|
$sthB->finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($ftp_audio_transfer > 0) && (length($ivr_filename) > 3) && (length($ivr_location) > 5) )
|
||||||
|
{
|
||||||
|
@ivr_path = split(/\//,$ivr_location);
|
||||||
|
$path_file = $ivr_path[$#ivr_path];
|
||||||
|
`$wgetbin --output-document=$tempdir/$path_file $ivr_location `;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
##### END standard audio lookup #####
|
||||||
if ($status =~ /UPSELL/) {$UPSELL='L5';}
|
|
||||||
else {$UPSELL='N';}
|
##### BEGIN transfer audio lookup #####
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ivr_id = '0';
|
||||||
|
$ivr_filename = '';
|
||||||
|
|
||||||
|
$stmtB = "select recording_id,filename,location from recording_log where vicidial_id='$vicidial_id' and start_time > '$shipdate 00:00:01' and start_time < '$shipdate 23:59:59' order by start_time limit 10;";
|
||||||
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
|
$sthBrows=$sthB->rows;
|
||||||
|
$rec_countB=0;
|
||||||
|
while ($sthBrows > $rec_countB)
|
||||||
|
{
|
||||||
|
@aryB = $sthB->fetchrow_array;
|
||||||
|
if ($rec_countB > 0)
|
||||||
|
{
|
||||||
|
$ivr_id .= "|";
|
||||||
|
$ivr_filename .= "|";
|
||||||
|
$ivr_location .= "|";
|
||||||
|
}
|
||||||
|
$ivr_id .= "$aryB[0]";
|
||||||
|
$ivr_filename .= "$aryB[1]";
|
||||||
|
$ivr_location .= "$aryB[2]";
|
||||||
|
@ivr_path = split(/\//,$ivr_location);
|
||||||
|
$path_file = $ivr_path[$#ivr_path];
|
||||||
|
$rec_countB++;
|
||||||
|
if ($ftp_audio_transfer > 0)
|
||||||
|
{
|
||||||
|
`$wgetbin --output-document=$tempdir/$path_file $aryB[2] `;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sthB->finish();
|
||||||
|
|
||||||
|
### Look for other closer calls after this call
|
||||||
|
$more_calls[0]='';
|
||||||
|
$stmtB = "select closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > '$call_date' and call_date < '$shipdate 23:59:59' order by call_date limit 10;";
|
||||||
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
|
$sthBrows=$sthB->rows;
|
||||||
|
$rec_countB=0;
|
||||||
|
while ($sthBrows > $rec_countB)
|
||||||
|
{
|
||||||
|
@aryB = $sthB->fetchrow_array;
|
||||||
|
$more_calls[$rec_countB] = "$aryB[0]";
|
||||||
|
$rec_countB++;
|
||||||
|
}
|
||||||
|
$sthB->finish();
|
||||||
|
|
||||||
|
$u=0;
|
||||||
|
while ($sthBrows > $u)
|
||||||
|
{
|
||||||
|
$closecallid = $more_calls[$u];
|
||||||
|
|
||||||
|
$stmtB = "select recording_id,filename,location from recording_log where vicidial_id='$closecallid' and start_time > '$shipdate 00:00:01' and start_time < '$shipdate 23:59:59' order by start_time limit 10;";
|
||||||
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
|
$sthBrows=$sthB->rows;
|
||||||
|
$rec_countB=0;
|
||||||
|
while ($sthBrows > $rec_countB)
|
||||||
|
{
|
||||||
|
@aryB = $sthB->fetchrow_array;
|
||||||
|
if (length($ivr_id) > 1)
|
||||||
|
{
|
||||||
|
$ivr_id .= "|";
|
||||||
|
$ivr_filename .= "|";
|
||||||
|
$ivr_location .= "|";
|
||||||
|
}
|
||||||
|
$ivr_id .= "$aryB[0]";
|
||||||
|
$ivr_filename .= "$aryB[1]";
|
||||||
|
$ivr_location .= "$aryB[2]";
|
||||||
|
@ivr_path = split(/\//,$ivr_location);
|
||||||
|
$path_file = $ivr_path[$#ivr_path];
|
||||||
|
$rec_countB++;
|
||||||
|
if ($ftp_audio_transfer > 0)
|
||||||
|
{
|
||||||
|
`$wgetbin --output-document=$tempdir/$path_file $aryB[2] `;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sthB->finish();
|
||||||
|
|
||||||
|
$u++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
##### END transfer audio lookup #####
|
||||||
|
|
||||||
|
##### BEGIN DID lookup #####
|
||||||
|
if ($with_did_lookup > 0)
|
||||||
|
{
|
||||||
|
$did_pattern = '';
|
||||||
|
$did_name = '';
|
||||||
|
$did_date = '';
|
||||||
|
|
||||||
|
$stmtB = "select did_pattern,did_description,call_date from vicidial_inbound_dids vid,vicidial_did_log vdl where uniqueid='$uniqueid' and call_date > '$shipdate 00:00:01' and call_date <= '$call_date' and vid.did_id=vdl.did_id order by call_date desc limit 1;";
|
||||||
|
if ($DB > 0) {print "$stmtB\n";}
|
||||||
|
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||||
|
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||||
|
$sthBrows=$sthB->rows;
|
||||||
|
if ($sthBrows > 0)
|
||||||
|
{
|
||||||
|
@aryB = $sthB->fetchrow_array;
|
||||||
|
$did_pattern = "$aryB[0]";
|
||||||
|
$did_name = "$aryB[1]";
|
||||||
|
$did_date = "$aryB[2]";
|
||||||
|
}
|
||||||
|
$sthB->finish();
|
||||||
|
}
|
||||||
|
##### BEGIN DID lookup #####
|
||||||
|
|
||||||
|
if ($status =~ /UPSELL/) {$UPSELL='L5';}
|
||||||
|
else {$UPSELL='N';}
|
||||||
|
|
||||||
|
if ($output_format =~ /^pipe-standard$/)
|
||||||
|
{
|
||||||
|
$str = "$first_name|$last_name|$address1|$address2|$city|$state|$postal_code|$phone_number|$email|$security|$comments|$call_date|$lead_id|$list_id|$user|$agent_name|$status|$vendor_id|$source_id|$campaign|$campaign_id|$ivr_id|$closer|$closer_name|\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output_format =~ /^csv-standard$/)
|
||||||
|
{
|
||||||
|
$str = "\"$first_name\",\"$last_name\",\"$address1\",\"$address2\",\"$city\",\"$state\",\"$postal_code\",\"$phone_number\",\"$email\",\"$security\",\"$comments\",\"$call_date\",\"$lead_id\",\"$list_id\",\"$user\",\"$agent_name\",\"$status\",\"$vendor_id\",\"$source_id\",\"$campaign\",\"$campaign_id\",\"$ivr_id\",\"$closer\",\"$closer_name\"\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output_format =~ /^tab-standard$/)
|
||||||
|
{
|
||||||
|
$str = "$first_name\t$last_name\t$address1\t$address2\t$city\t$state\t$postal_code\t$phone_number\t$email\t$security\t$comments\t$call_date\t$lead_id\t$list_id\t$user\t$agent_name\t$status\t$vendor_id\t$source_id\t$campaign\t$campaign_id\t$ivr_id\t$closer\t$closer_name\t\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output_format =~ /^pipe-triplep$/)
|
||||||
|
{
|
||||||
|
$str = "$user|$agent_name|$closer|$closer_name|$call_date|$status|$first_name|$last_name|$phone_number|$address1|$address2|$city|$state|$postal_code|$comments|$security|$email|$vendor_id|$source_id|$lead_id|$list_id|$campaign|$campaign_id|$ivr_id|\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output_format =~ /^pipe-vici$/)
|
||||||
|
{
|
||||||
|
$str = "VDAD|$agent_name|$first_name|$last_name|$address1|$address2|$city|$state|$postal_code|$phone_number|$ivr_id|DU|$UPSELL|N|||$security|$comments||||||$call_date|CBDISC|$email\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output_format =~ /^html-rec$/)
|
||||||
|
{
|
||||||
|
$str = "$user|$agent_name|$closer|$closer_name|$call_date|$status|$first_name|$last_name|$phone_number|$address1|$address2|$city|$state|$postal_code|$comments|$security|$email|$vendor_id|$source_id|$lead_id|$list_id|$campaign|$campaign_id|<a href=\"$ivr_location\">$ivr_id</a>|\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output_format =~ /^fixed-as400$/)
|
||||||
|
{
|
||||||
|
# 16884259 MRS. JEAN BROWN RISALPUR BROMSBERROW HEATYH LEDBURY HEREFORDSHIRE ENGLAND HR8 1PQ 01531650052 1209200809:52NI 3205UK
|
||||||
|
$vendor_id = sprintf("%-10s",$vendor_id); while(length($vendor_id)>10) {$vendor_id =~ s/.$//gi;}
|
||||||
|
$title = sprintf("%-10s",$title); while(length($title)>10) {$title =~ s/.$//gi;}
|
||||||
|
$first_name = sprintf("%-15s",$first_name); while(length($first_name)>15) {$first_name =~ s/.$//gi;}
|
||||||
|
$last_name = sprintf("%-20s",$last_name); while(length($last_name)>20) {$last_name =~ s/.$//gi;}
|
||||||
|
$address1 = sprintf("%-30s",$address1); while(length($address1)>30) {$address1 =~ s/.$//gi;}
|
||||||
|
$address2 = sprintf("%-30s",$address2); while(length($address2)>30) {$address2 =~ s/.$//gi;}
|
||||||
|
$address3 = sprintf("%-30s",$address3); while(length($address3)>30) {$address3 =~ s/.$//gi;}
|
||||||
|
$city = sprintf("%-50s",$city); while(length($city)>50) {$city =~ s/.$//gi;}
|
||||||
|
$postal_code = sprintf("%-9s",$postal_code); while(length($postal_code)>9) {$postal_code =~ s/.$//gi;}
|
||||||
|
$phone_number = sprintf("%-20s",$phone_number); while(length($phone_number)>20) {$phone_number =~ s/.$//gi;}
|
||||||
|
@dtsplit = split(" ",$last_local_call_time);
|
||||||
|
@datesplit = split("-",$dtsplit[0]);
|
||||||
|
$timesplit = substr($dtsplit[1], 0, 5);
|
||||||
|
$formatted_date = "$datesplit[1]$datesplit[2]$datesplit[0]$timesplit";
|
||||||
|
$user = sprintf("%-4s",$user);
|
||||||
|
if ($status =~ /^AA$/) {$status = 'A';}
|
||||||
|
if ($status =~ /^A$/) {$status = 'A';}
|
||||||
|
if ($status =~ /^B$/) {$status = 'B';}
|
||||||
|
if ($status =~ /^N$/) {$status = 'N';}
|
||||||
|
if ($status =~ /^NA$/) {$status = 'N';}
|
||||||
|
if ($status =~ /^NP$/) {$status = 'N';}
|
||||||
|
if ($status =~ /^PU$/) {$status = 'N';}
|
||||||
|
if ($status =~ /^DROP$/) {$status = 'N';}
|
||||||
|
if ($status =~ /^SALE$/) {$status = 'AP';}
|
||||||
|
if ($status =~ /^A6$/) {$status = 'A6';}
|
||||||
|
if ($status =~ /^DC$/) {$status = 'D';}
|
||||||
|
if ($status =~ /^DNC$/) {$status = 'DC';}
|
||||||
|
if ($status =~ /^DNCL$/) {$status = 'DC';}
|
||||||
|
if ($status =~ /^DIED$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^COMP$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^DEC$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^ERI$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^INCALL$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^SP$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^WRON$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^HBED$/) {$status = 'DD';}
|
||||||
|
if ($status =~ /^CALLBK$/) {$status = 'A6';}
|
||||||
|
if ($status =~ /^HAP1$/) {$status = 'NI';}
|
||||||
|
if ($status =~ /^HAP2$/) {$status = 'NI';}
|
||||||
|
if ($status =~ /^NI$/) {$status = 'NI';}
|
||||||
|
|
||||||
|
$status = sprintf("%-16s",$status); while(length($status)>16) {$status =~ s/.$//gi;}
|
||||||
|
$user =~ s/VDAD/ /gi;
|
||||||
|
$UK = 'UK';
|
||||||
|
|
||||||
|
$str = "$vendor_id$title$first_name$last_name$address1$address2$address3$city$postal_code$phone_number$formatted_date$status$user$UK\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output_format =~ /^tab-QMcustomUSA$/)
|
||||||
|
{
|
||||||
|
# 1245328655100219 2009-06-18 05:37:35 937 9375551212 8185551223 8106 35 255 0 DSAW - q8187-20090618-053939-1245328655.100219.WAV|q8186-20090618-053735-1245328655.100219.WAV
|
||||||
|
# 1- unique number (digits only)
|
||||||
|
# 2- date
|
||||||
|
# 3- time
|
||||||
|
# 4- CID arecode
|
||||||
|
# 5- CID full
|
||||||
|
# 6- DID
|
||||||
|
# 7- user
|
||||||
|
# 8- hold time (seconds)
|
||||||
|
# 9- talk time (seconds)
|
||||||
|
# 10- after call work time (seconds)
|
||||||
|
# 11- application name, 4 characters
|
||||||
|
# 12- order number (just a dash for now '-')
|
||||||
|
# 13- call recording filenames
|
||||||
|
|
||||||
|
$uniqueid =~ s/\D//gi;
|
||||||
|
@call_date_array = split(/ /,$call_date);
|
||||||
|
$phone_areacode = substr($phone_number, 0, 3);
|
||||||
|
if (length($closer) < 1) {$closer = $user;}
|
||||||
|
$application = substr($did_name, 0, 4);
|
||||||
|
$talk_seconds = ($length_in_sec - $queue_seconds);
|
||||||
|
$queue_seconds =~ s/\..*//gi;
|
||||||
|
$dispo_time = 0;
|
||||||
|
|
||||||
|
$str = "$uniqueid\t$call_date_array[0]\t$call_date_array[1]\t$phone_areacode\t$phone_number\t$did_pattern\t$closer\t$queue_seconds\t$talk_seconds\t$dispo_time\t$application\t-\t$ivr_filename\t\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$Ealert .= "$str";
|
||||||
|
|
||||||
|
print out "$str";
|
||||||
|
if ($DBX) {print "$str\n";}
|
||||||
|
|
||||||
|
$rec_count++;
|
||||||
|
|
||||||
if ($output_format =~ /^pipe-standard$/)
|
|
||||||
{
|
|
||||||
$str = "$first_name|$last_name|$address1|$address2|$city|$state|$postal_code|$phone_number|$email|$security|$comments|$call_date|$lead_id|$list_id|$user|$agent_name|$status|$vendor_id|$source_id|$campaign|$campaign_id|$ivr_id|$closer|$closer_name|\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($output_format =~ /^csv-standard$/)
|
|
||||||
{
|
|
||||||
$str = "\"$first_name\",\"$last_name\",\"$address1\",\"$address2\",\"$city\",\"$state\",\"$postal_code\",\"$phone_number\",\"$email\",\"$security\",\"$comments\",\"$call_date\",\"$lead_id\",\"$list_id\",\"$user\",\"$agent_name\",\"$status\",\"$vendor_id\",\"$source_id\",\"$campaign\",\"$campaign_id\",\"$ivr_id\",\"$closer\",\"$closer_name\"\r\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output_format =~ /^tab-standard$/)
|
|
||||||
{
|
|
||||||
$str = "$first_name\t$last_name\t$address1\t$address2\t$city\t$state\t$postal_code\t$phone_number\t$email\t$security\t$comments\t$call_date\t$lead_id\t$list_id\t$user\t$agent_name\t$status\t$vendor_id\t$source_id\t$campaign\t$campaign_id\t$ivr_id\t$closer\t$closer_name\t\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output_format =~ /^pipe-triplep$/)
|
|
||||||
{
|
|
||||||
$str = "$user|$agent_name|$closer|$closer_name|$call_date|$status|$first_name|$last_name|$phone_number|$address1|$address2|$city|$state|$postal_code|$comments|$security|$email|$vendor_id|$source_id|$lead_id|$list_id|$campaign|$campaign_id|$ivr_id|\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output_format =~ /^pipe-vici$/)
|
|
||||||
{
|
|
||||||
$str = "VDAD|$agent_name|$first_name|$last_name|$address1|$address2|$city|$state|$postal_code|$phone_number|$ivr_id|DU|$UPSELL|N|||$security|$comments||||||$call_date|CBDISC|$email\r\n";
|
|
||||||
}
|
|
||||||
if ($output_format =~ /^html-rec$/)
|
|
||||||
{
|
|
||||||
$str = "$user|$agent_name|$closer|$closer_name|$call_date|$status|$first_name|$last_name|$phone_number|$address1|$address2|$city|$state|$postal_code|$comments|$security|$email|$vendor_id|$source_id|$lead_id|$list_id|$campaign|$campaign_id|<a href=\"$ivr_location\">$ivr_id</a>|\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output_format =~ /^fixed-as400$/)
|
|
||||||
{
|
|
||||||
# 16884259 MRS. JEAN BROWN RISALPUR BROMSBERROW HEATYH LEDBURY HEREFORDSHIRE ENGLAND HR8 1PQ 01531650052 1209200809:52NI 3205UK
|
|
||||||
$vendor_id = sprintf("%-10s",$vendor_id); while(length($vendor_id)>10) {$vendor_id =~ s/.$//gi;}
|
|
||||||
$title = sprintf("%-10s",$title); while(length($title)>10) {$title =~ s/.$//gi;}
|
|
||||||
$first_name = sprintf("%-15s",$first_name); while(length($first_name)>15) {$first_name =~ s/.$//gi;}
|
|
||||||
$last_name = sprintf("%-20s",$last_name); while(length($last_name)>20) {$last_name =~ s/.$//gi;}
|
|
||||||
$address1 = sprintf("%-30s",$address1); while(length($address1)>30) {$address1 =~ s/.$//gi;}
|
|
||||||
$address2 = sprintf("%-30s",$address2); while(length($address2)>30) {$address2 =~ s/.$//gi;}
|
|
||||||
$address3 = sprintf("%-30s",$address3); while(length($address3)>30) {$address3 =~ s/.$//gi;}
|
|
||||||
$city = sprintf("%-50s",$city); while(length($city)>50) {$city =~ s/.$//gi;}
|
|
||||||
$postal_code = sprintf("%-9s",$postal_code); while(length($postal_code)>9) {$postal_code =~ s/.$//gi;}
|
|
||||||
$phone_number = sprintf("%-20s",$phone_number); while(length($phone_number)>20) {$phone_number =~ s/.$//gi;}
|
|
||||||
@dtsplit = split(" ",$last_local_call_time);
|
|
||||||
@datesplit = split("-",$dtsplit[0]);
|
|
||||||
$timesplit = substr($dtsplit[1], 0, 5);
|
|
||||||
$formatted_date = "$datesplit[1]$datesplit[2]$datesplit[0]$timesplit";
|
|
||||||
$user = sprintf("%-4s",$user);
|
|
||||||
if ($status =~ /^AA$/) {$status = 'A';}
|
|
||||||
if ($status =~ /^A$/) {$status = 'A';}
|
|
||||||
if ($status =~ /^B$/) {$status = 'B';}
|
|
||||||
if ($status =~ /^N$/) {$status = 'N';}
|
|
||||||
if ($status =~ /^NA$/) {$status = 'N';}
|
|
||||||
if ($status =~ /^NP$/) {$status = 'N';}
|
|
||||||
if ($status =~ /^PU$/) {$status = 'N';}
|
|
||||||
if ($status =~ /^DROP$/) {$status = 'N';}
|
|
||||||
if ($status =~ /^SALE$/) {$status = 'AP';}
|
|
||||||
if ($status =~ /^A6$/) {$status = 'A6';}
|
|
||||||
if ($status =~ /^DC$/) {$status = 'D';}
|
|
||||||
if ($status =~ /^DNC$/) {$status = 'DC';}
|
|
||||||
if ($status =~ /^DNCL$/) {$status = 'DC';}
|
|
||||||
if ($status =~ /^DIED$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^COMP$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^DEC$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^ERI$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^INCALL$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^SP$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^WRON$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^HBED$/) {$status = 'DD';}
|
|
||||||
if ($status =~ /^CALLBK$/) {$status = 'A6';}
|
|
||||||
if ($status =~ /^HAP1$/) {$status = 'NI';}
|
|
||||||
if ($status =~ /^HAP2$/) {$status = 'NI';}
|
|
||||||
if ($status =~ /^NI$/) {$status = 'NI';}
|
|
||||||
|
|
||||||
$status = sprintf("%-16s",$status); while(length($status)>16) {$status =~ s/.$//gi;}
|
|
||||||
$user =~ s/VDAD/ /gi;
|
|
||||||
$UK = 'UK';
|
|
||||||
|
|
||||||
$str = "$vendor_id$title$first_name$last_name$address1$address2$address3$city$postal_code$phone_number$formatted_date$status$user$UK\r\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$Ealert .= "$str";
|
|
||||||
|
|
||||||
print out "$str";
|
|
||||||
if ($DBX) {print "$str\n";}
|
|
||||||
|
|
||||||
$rec_count++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# AST_sourceID_summary_export.pl version: 2.0.5
|
# AST_sourceID_summary_export.pl version: 2.2.0
|
||||||
#
|
#
|
||||||
# This script is designed to gather stats for all leads by source_id and
|
# This script is designed to gather stats for all leads by source_id and
|
||||||
# post them to a directory
|
# post them to a directory
|
||||||
#
|
#
|
||||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGES
|
# CHANGES
|
||||||
# 70905-1409 - First version
|
# 70905-1409 - First version
|
||||||
# 71005-0054 - Altered script to use astguiclient.conf for settings
|
# 71005-0054 - Altered script to use astguiclient.conf for settings
|
||||||
#
|
# 90620-0856 - Formatting fixes
|
||||||
|
#
|
||||||
|
|
||||||
$txt = '.txt';
|
$txt = '.txt';
|
||||||
$US = '_';
|
$US = '_';
|
||||||
@@ -30,70 +31,70 @@ $np_statuses = 'NP';
|
|||||||
|
|
||||||
### begin parsing run-time options ###
|
### begin parsing run-time options ###
|
||||||
if (length($ARGV[0])>1)
|
if (length($ARGV[0])>1)
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($#ARGV >= $i)
|
while ($#ARGV >= $i)
|
||||||
{
|
{
|
||||||
$args = "$args $ARGV[$i]";
|
$args = "$args $ARGV[$i]";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args =~ /--help/i)
|
if ($args =~ /--help/i)
|
||||||
{
|
{
|
||||||
print "allowed run time options:\n";
|
print "allowed run time options:\n";
|
||||||
print " [--sale-statuses=XXX-XXY] = Statuses that are deemed to be \"Sales\". Default SALE\n";
|
print " [--sale-statuses=XXX-XXY] = Statuses that are deemed to be \"Sales\". Default SALE\n";
|
||||||
print " [--NI-statuses=XXX-XXY] = Statuses that are deemed to be \"Not Interested\". Default NI\n";
|
print " [--NI-statuses=XXX-XXY] = Statuses that are deemed to be \"Not Interested\". Default NI\n";
|
||||||
print " [--NP-statuses=XXX-XXY] = Statuses that are deemed to be \"No Pitch\". Default NP\n";
|
print " [--NP-statuses=XXX-XXY] = Statuses that are deemed to be \"No Pitch\". Default NP\n";
|
||||||
print " [--ignore-lists=XXX-XXY] = lists that should be ignored in summary\n";
|
print " [--ignore-lists=XXX-XXY] = lists that should be ignored in summary\n";
|
||||||
print " [--ftp-transfer] = Send results file by FTP to another server\n";
|
print " [--ftp-transfer] = Send results file by FTP to another server\n";
|
||||||
print " [-q] = quiet\n";
|
print " [-q] = quiet\n";
|
||||||
print " [-t] = test\n";
|
print " [-t] = test\n";
|
||||||
print " [--debug] = debugging messages\n";
|
print " [--debug] = debugging messages\n";
|
||||||
print " [--debugX] = Super debugging messages\n";
|
print " [--debugX] = Super debugging messages\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($args =~ /--debug/i)
|
if ($args =~ /--debug/i)
|
||||||
{
|
{
|
||||||
$DB=1;
|
$DB=1;
|
||||||
print "\n----- DEBUG MODE -----\n\n";
|
print "\n----- DEBUG MODE -----\n\n";
|
||||||
}
|
}
|
||||||
if ($args =~ /--debugX/i)
|
if ($args =~ /--debugX/i)
|
||||||
{
|
{
|
||||||
$DBX=1;
|
$DBX=1;
|
||||||
print "\n----- SUPER DEBUG MODE -----\n\n";
|
print "\n----- SUPER DEBUG MODE -----\n\n";
|
||||||
}
|
}
|
||||||
if ($args =~ /-q/i)
|
if ($args =~ /-q/i)
|
||||||
{
|
{
|
||||||
$q=1; $Q=1;
|
$q=1; $Q=1;
|
||||||
}
|
}
|
||||||
if ($args =~ /--sale-statuses=/i)
|
if ($args =~ /--sale-statuses=/i)
|
||||||
{
|
{
|
||||||
@data_in = split(/--sale-statuses=/,$args);
|
@data_in = split(/--sale-statuses=/,$args);
|
||||||
$sale_statuses = $data_in[1];
|
$sale_statuses = $data_in[1];
|
||||||
$sale_statuses =~ s/ .*$//gi;
|
$sale_statuses =~ s/ .*$//gi;
|
||||||
}
|
}
|
||||||
if ($args =~ /--NI-statuses=/)
|
if ($args =~ /--NI-statuses=/)
|
||||||
{
|
{
|
||||||
@data_in = split(/--NI-statuses=/,$args);
|
@data_in = split(/--NI-statuses=/,$args);
|
||||||
$ni_statuses = $data_in[1];
|
$ni_statuses = $data_in[1];
|
||||||
$ni_statuses =~ s/ .*$//gi;
|
$ni_statuses =~ s/ .*$//gi;
|
||||||
}
|
}
|
||||||
if ($args =~ /--NP-statuses=/)
|
if ($args =~ /--NP-statuses=/)
|
||||||
{
|
{
|
||||||
@data_in = split(/--NP-statuses=/,$args);
|
@data_in = split(/--NP-statuses=/,$args);
|
||||||
$np_statuses = $data_in[1];
|
$np_statuses = $data_in[1];
|
||||||
$np_statuses =~ s/ .*$//gi;
|
$np_statuses =~ s/ .*$//gi;
|
||||||
}
|
}
|
||||||
if ($args =~ /--ignore-lists=/)
|
if ($args =~ /--ignore-lists=/)
|
||||||
{
|
{
|
||||||
@data_in = split(/--ignore-lists=/,$args);
|
@data_in = split(/--ignore-lists=/,$args);
|
||||||
$ignore_lists = $data_in[1];
|
$ignore_lists = $data_in[1];
|
||||||
$ignore_lists =~ s/ .*$//gi;
|
$ignore_lists =~ s/ .*$//gi;
|
||||||
}
|
}
|
||||||
if ($args =~ /-ftp-transfer/i)
|
if ($args =~ /-ftp-transfer/i)
|
||||||
{
|
{
|
||||||
if (!$Q)
|
if (!$Q)
|
||||||
@@ -101,39 +102,39 @@ if (length($ARGV[0])>1)
|
|||||||
$ftp_transfer=1;
|
$ftp_transfer=1;
|
||||||
}
|
}
|
||||||
if ($args =~ /--test/i)
|
if ($args =~ /--test/i)
|
||||||
{
|
{
|
||||||
$T=1; $TEST=1;
|
$T=1; $TEST=1;
|
||||||
print "\n----- TESTING -----\n\n";
|
print "\n----- TESTING -----\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "no command line options set, using defaults.\n";
|
print "no command line options set, using defaults.\n";
|
||||||
}
|
}
|
||||||
### end parsing run-time options ###
|
### end parsing run-time options ###
|
||||||
|
|
||||||
|
|
||||||
$secX = time();
|
$secX = time();
|
||||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||||
$year = ($year + 1900);
|
$year = ($year + 1900);
|
||||||
$mon++;
|
$mon++;
|
||||||
|
|
||||||
# # rerun override - Use this to override the day manually
|
# # rerun override - Use this to override the day manually
|
||||||
# $year='2007';
|
# $year='2007';
|
||||||
# $mon='5';
|
# $mon='5';
|
||||||
# $mday='18';
|
# $mday='18';
|
||||||
|
|
||||||
if ($mon < 10) {$mon = "0$mon";}
|
if ($mon < 10) {$mon = "0$mon";}
|
||||||
if ($mday < 10) {$mday = "0$mday";}
|
if ($mday < 10) {$mday = "0$mday";}
|
||||||
if ($hour < 10) {$hour = "0$hour";}
|
if ($hour < 10) {$hour = "0$hour";}
|
||||||
if ($min < 10) {$min = "0$min";}
|
if ($min < 10) {$min = "0$min";}
|
||||||
if ($sec < 10) {$sec = "0$sec";}
|
if ($sec < 10) {$sec = "0$sec";}
|
||||||
$timestamp = "$year-$mon-$mday $hour:$min:$sec";
|
$timestamp = "$year-$mon-$mday $hour:$min:$sec";
|
||||||
$filedate = "$year$mon$mday";
|
$filedate = "$year$mon$mday";
|
||||||
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
||||||
$shipdate = "$year-$mon-$mday";
|
$shipdate = "$year-$mon-$mday";
|
||||||
$datestamp = "$year/$mon/$mday $hour:$min";
|
$datestamp = "$year/$mon/$mday $hour:$min";
|
||||||
|
|
||||||
# default path to astguiclient configuration file:
|
# default path to astguiclient configuration file:
|
||||||
$PATHconf = '/etc/astguiclient.conf';
|
$PATHconf = '/etc/astguiclient.conf';
|
||||||
@@ -323,7 +324,7 @@ close(out);
|
|||||||
|
|
||||||
|
|
||||||
if ($ftp_transfer > 0)
|
if ($ftp_transfer > 0)
|
||||||
{
|
{
|
||||||
use Net::FTP;
|
use Net::FTP;
|
||||||
|
|
||||||
if (!$Q) {print "Sending File Over FTP: $outfile\n";}
|
if (!$Q) {print "Sending File Over FTP: $outfile\n";}
|
||||||
@@ -332,7 +333,7 @@ if ($ftp_transfer > 0)
|
|||||||
$ftp->cwd("$VARREPORT_dir");
|
$ftp->cwd("$VARREPORT_dir");
|
||||||
$ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile");
|
$ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile");
|
||||||
$ftp->quit;
|
$ftp->quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
### calculate time to run script ###
|
### calculate time to run script ###
|
||||||
$secY = time();
|
$secY = time();
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ cd ntp-4.2.2p3
|
|||||||
./configure
|
./configure
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
/usr/local/bin/ntpdate -u ntp.myfloridacity.us
|
/usr/local/bin/ntpdate -u pool.ntp.org
|
||||||
|
|
||||||
|
|
||||||
cd /usr/local
|
cd /usr/local
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ the time is the same on our client computers and our servers.
|
|||||||
- make install
|
- make install
|
||||||
- vi /etc/ntp.conf (change to just 1 line: "server ntp.myfloridacity.us")
|
- vi /etc/ntp.conf (change to just 1 line: "server ntp.myfloridacity.us")
|
||||||
- cp /etc/ntp.conf /etc/ntpd.conf # just to be sure
|
- cp /etc/ntp.conf /etc/ntpd.conf # just to be sure
|
||||||
- /usr/local/bin/ntpdate -u ntp.myfloridacity.us # initial sync
|
- /usr/local/bin/ntpdate -u pool.ntp.org # initial sync
|
||||||
- /usr/sbin/ntpd # run it
|
- /usr/sbin/ntpd # run it
|
||||||
- you are done
|
- you are done
|
||||||
|
|
||||||
@@ -2604,7 +2604,7 @@ SUBPHASE 6.4: setting up asterisk and helper applications for startup
|
|||||||
/usr/bin/setterm -powerdown
|
/usr/bin/setterm -powerdown
|
||||||
|
|
||||||
### start time server
|
### start time server
|
||||||
/usr/local/bin/ntpdate -u ntp.myfloridacity.us
|
/usr/local/bin/ntpdate -u pool.ntp.org
|
||||||
/usr/sbin/ntpd
|
/usr/sbin/ntpd
|
||||||
|
|
||||||
### start up the MySQL server
|
### start up the MySQL server
|
||||||
@@ -2686,7 +2686,7 @@ SUBPHASE 6.5: setting up astguiclient scripts for continuous running
|
|||||||
3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl
|
3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl
|
||||||
|
|
||||||
## adjust time on the server with ntp
|
## adjust time on the server with ntp
|
||||||
30 * * * * /usr/local/bin/ntpdate -u ntp.myfloridacity.us 2>/dev/null 1>&2
|
30 * * * * /usr/local/bin/ntpdate -u pool.ntp.org 2>/dev/null 1>&2
|
||||||
|
|
||||||
### VICIDIAL agent time log weekly and daily summary report generation
|
### VICIDIAL agent time log weekly and daily summary report generation
|
||||||
2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl
|
2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ INSERT INTO phones (extension, dialplan_number, voicemail_id, phone_ip, computer
|
|||||||
|
|
||||||
INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,load_leads,campaign_detail,ast_admin_access,modify_users) values('6666','1234','Admin','9','ADMIN','1','1','1','1');
|
INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,load_leads,campaign_detail,ast_admin_access,modify_users) values('6666','1234','Admin','9','ADMIN','1','1','1','1');
|
||||||
INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,active) values('VDAD','donotedit','Outbound Auto Dial','1','ADMIN','N');
|
INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,active) values('VDAD','donotedit','Outbound Auto Dial','1','ADMIN','N');
|
||||||
|
INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,active) values('VDCL','donotedit','Inbound No Agent','1','ADMIN','N');
|
||||||
|
|
||||||
INSERT INTO conferences values('8600001','10.10.10.15','');
|
INSERT INTO conferences values('8600001','10.10.10.15','');
|
||||||
INSERT INTO conferences values('8600002','10.10.10.15','');
|
INSERT INTO conferences values('8600002','10.10.10.15','');
|
||||||
|
|||||||
+653
-643
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user