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:
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# ADMIN_backup.pl version 2.0.5
|
||||
# ADMIN_backup.pl version 2.2.0
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# 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
|
||||
#
|
||||
@@ -13,9 +13,9 @@
|
||||
# 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
|
||||
# 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();
|
||||
$secX = time();
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
@@ -32,7 +32,7 @@ $VDL_date = "$year-$mon-$mday 00:00:01";
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
@@ -114,11 +114,11 @@ if (length($ARGV[0])>1)
|
||||
print "\n----- FTP transfer -----\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set\n";
|
||||
}
|
||||
{
|
||||
print "no command line options set\n";
|
||||
}
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
$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_';
|
||||
$sangoma='_SANGOMA_';
|
||||
$linux='_LINUX_';
|
||||
@@ -239,6 +223,22 @@ $sgSTRING='';
|
||||
|
||||
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 ###
|
||||
if ($db_without_logs)
|
||||
{
|
||||
|
||||
@@ -283,6 +283,10 @@ foreach(@FILES)
|
||||
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "ERROR: Could not ping server $VARFTP_host\n";
|
||||
}
|
||||
### END Remote file transfer
|
||||
|
||||
### 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;
|
||||
$agents_average_onemin[$i]=0;
|
||||
|
||||
# ### Grab the count of agents and 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)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_VDauto_dial.pl version 2.0.5 *DBI-version*
|
||||
# AST_VDauto_dial.pl version 2.2.0 *DBI-version*
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Places auto_dial calls on the VICIDIAL dialer system
|
||||
@@ -76,12 +76,13 @@
|
||||
# 90202-0203 - Added outbound_autodial_active option to halt all dialing
|
||||
# 90306-1845 - Added configurable calls-per-second option
|
||||
# 90611-0554 - Bug fix for Manual dial calls and logging
|
||||
# 90619-1948 - format fixing
|
||||
#
|
||||
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
@@ -116,13 +117,13 @@ if (length($ARGV[0])>1)
|
||||
$T=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set\n";
|
||||
{
|
||||
print "no command line options set\n";
|
||||
$loop_delay = '2500';
|
||||
$DB=1;
|
||||
}
|
||||
}
|
||||
### 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 DBI;
|
||||
|
||||
### connect to MySQL database defined in the conf file
|
||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
### connect to MySQL database defined in the conf file
|
||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
### 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';";
|
||||
@@ -256,8 +257,7 @@ $sthA->finish();
|
||||
|
||||
$one_day_interval = 12; # 1 month loops for one year
|
||||
while($one_day_interval > 0)
|
||||
{
|
||||
|
||||
{
|
||||
$endless_loop=5760000; # 30 days minutes at XXX seconds per loop
|
||||
$stat_count=1;
|
||||
|
||||
@@ -959,8 +959,6 @@ while($one_day_interval > 0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
&get_time_now;
|
||||
|
||||
###############################################################################
|
||||
@@ -1799,16 +1797,16 @@ while($one_day_interval > 0)
|
||||
|
||||
$one_day_interval--;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$event_string='CLOSING DB CONNECTION|';
|
||||
&event_logger;
|
||||
$event_string='CLOSING DB CONNECTION|';
|
||||
&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;
|
||||
@@ -1826,91 +1824,88 @@ exit;
|
||||
|
||||
|
||||
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);
|
||||
$LOCAL_GMT_OFF = $SERVER_GMT;
|
||||
$LOCAL_GMT_OFF_STD = $SERVER_GMT;
|
||||
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);
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
|
||||
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);
|
||||
$year = ($year + 1900);
|
||||
$mon++;
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year = ($year + 1900);
|
||||
$mon++;
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
|
||||
$now_date_epoch = time();
|
||||
$now_date = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$file_date = "$year-$mon-$mday";
|
||||
$now_date_epoch = time();
|
||||
$now_date = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$file_date = "$year-$mon-$mday";
|
||||
$CIDdate = "$mon$mday$hour$min$sec";
|
||||
$tsSQLdate = "$year$mon$mday$hour$min$sec";
|
||||
$SQLdate = "$year-$mon-$mday $hour:$min:$sec";
|
||||
|
||||
$BDtarget = ($secX - 10);
|
||||
($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget);
|
||||
$Byear = ($Byear + 1900);
|
||||
$Bmon++;
|
||||
if ($Bmon < 10) {$Bmon = "0$Bmon";}
|
||||
if ($Bmday < 10) {$Bmday = "0$Bmday";}
|
||||
if ($Bhour < 10) {$Bhour = "0$Bhour";}
|
||||
if ($Bmin < 10) {$Bmin = "0$Bmin";}
|
||||
if ($Bsec < 10) {$Bsec = "0$Bsec";}
|
||||
$BDtarget = ($secX - 10);
|
||||
($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget);
|
||||
$Byear = ($Byear + 1900);
|
||||
$Bmon++;
|
||||
if ($Bmon < 10) {$Bmon = "0$Bmon";}
|
||||
if ($Bmday < 10) {$Bmday = "0$Bmday";}
|
||||
if ($Bhour < 10) {$Bhour = "0$Bhour";}
|
||||
if ($Bmin < 10) {$Bmin = "0$Bmin";}
|
||||
if ($Bsec < 10) {$Bsec = "0$Bsec";}
|
||||
$BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec";
|
||||
|
||||
$PDtarget = ($secX - 30);
|
||||
($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget);
|
||||
$Pyear = ($Pyear + 1900);
|
||||
$Pmon++;
|
||||
if ($Pmon < 10) {$Pmon = "0$Pmon";}
|
||||
if ($Pmday < 10) {$Pmday = "0$Pmday";}
|
||||
if ($Phour < 10) {$Phour = "0$Phour";}
|
||||
if ($Pmin < 10) {$Pmin = "0$Pmin";}
|
||||
if ($Psec < 10) {$Psec = "0$Psec";}
|
||||
$PDtarget = ($secX - 30);
|
||||
($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget);
|
||||
$Pyear = ($Pyear + 1900);
|
||||
$Pmon++;
|
||||
if ($Pmon < 10) {$Pmon = "0$Pmon";}
|
||||
if ($Pmday < 10) {$Pmday = "0$Pmday";}
|
||||
if ($Phour < 10) {$Phour = "0$Phour";}
|
||||
if ($Pmin < 10) {$Pmin = "0$Pmin";}
|
||||
if ($Psec < 10) {$Psec = "0$Psec";}
|
||||
$PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec";
|
||||
$halfminSQLdate = "$Pyear-$Pmon-$Pmday $Phour:$Pmin:$Psec";
|
||||
|
||||
$XDtarget = ($secX - 120);
|
||||
($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget);
|
||||
$Xyear = ($Xyear + 1900);
|
||||
$Xmon++;
|
||||
if ($Xmon < 10) {$Xmon = "0$Xmon";}
|
||||
if ($Xmday < 10) {$Xmday = "0$Xmday";}
|
||||
if ($Xhour < 10) {$Xhour = "0$Xhour";}
|
||||
if ($Xmin < 10) {$Xmin = "0$Xmin";}
|
||||
if ($Xsec < 10) {$Xsec = "0$Xsec";}
|
||||
$XDtarget = ($secX - 120);
|
||||
($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget);
|
||||
$Xyear = ($Xyear + 1900);
|
||||
$Xmon++;
|
||||
if ($Xmon < 10) {$Xmon = "0$Xmon";}
|
||||
if ($Xmday < 10) {$Xmday = "0$Xmday";}
|
||||
if ($Xhour < 10) {$Xhour = "0$Xhour";}
|
||||
if ($Xmin < 10) {$Xmin = "0$Xmin";}
|
||||
if ($Xsec < 10) {$Xsec = "0$Xsec";}
|
||||
$XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec";
|
||||
|
||||
$TDtarget = ($secX - 6000);
|
||||
($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget);
|
||||
$Tyear = ($Tyear + 1900);
|
||||
$Tmon++;
|
||||
if ($Tmon < 10) {$Tmon = "0$Tmon";}
|
||||
if ($Tmday < 10) {$Tmday = "0$Tmday";}
|
||||
if ($Thour < 10) {$Thour = "0$Thour";}
|
||||
if ($Tmin < 10) {$Tmin = "0$Tmin";}
|
||||
if ($Tsec < 10) {$Tsec = "0$Tsec";}
|
||||
$TDtarget = ($secX - 6000);
|
||||
($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget);
|
||||
$Tyear = ($Tyear + 1900);
|
||||
$Tmon++;
|
||||
if ($Tmon < 10) {$Tmon = "0$Tmon";}
|
||||
if ($Tmday < 10) {$Tmday = "0$Tmday";}
|
||||
if ($Thour < 10) {$Thour = "0$Thour";}
|
||||
if ($Tmin < 10) {$Tmin = "0$Tmin";}
|
||||
if ($Tsec < 10) {$Tsec = "0$Tsec";}
|
||||
$TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub event_logger
|
||||
{
|
||||
if ($DB) {print "$now_date|$event_string|\n";}
|
||||
if ($SYSLOG)
|
||||
{
|
||||
if ($DB) {print "$now_date|$event_string|\n";}
|
||||
if ($SYSLOG)
|
||||
{
|
||||
### open the log file for writing ###
|
||||
open(Lout, ">>$VDADLOGfile")
|
||||
@@ -1918,13 +1913,13 @@ if ($SYSLOG)
|
||||
print Lout "$now_date|$event_string|\n";
|
||||
close(Lout);
|
||||
}
|
||||
$event_string='';
|
||||
}
|
||||
$event_string='';
|
||||
}
|
||||
|
||||
sub jam_event_logger
|
||||
{
|
||||
if ($DB) {print "$now_date|$jam_string|\n";}
|
||||
if ($useJAMdebugFILE)
|
||||
{
|
||||
if ($DB) {print "$now_date|$jam_string|\n";}
|
||||
if ($useJAMdebugFILE)
|
||||
{
|
||||
### open the log file for writing ###
|
||||
open(Jout, ">>$JAMdebugFILE")
|
||||
@@ -1932,7 +1927,6 @@ if ($useJAMdebugFILE)
|
||||
print Jout "$now_date|$jam_string|\n";
|
||||
close(Jout);
|
||||
}
|
||||
$jam_string='';
|
||||
}
|
||||
|
||||
$jam_string='';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/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
|
||||
# post them to a directory
|
||||
@@ -17,11 +17,14 @@
|
||||
# 71005-0054 - Altered script to use astguiclient.conf for settings
|
||||
# 90105-1155 - Added AS400 export formats and changed around date override
|
||||
# 90106-2309 - Added email sending
|
||||
# 90620-0900 - Formatting fixes
|
||||
#
|
||||
|
||||
$txt = '.txt';
|
||||
$US = '_';
|
||||
$MT[0] = '';
|
||||
$Q=0;
|
||||
$DB=0;
|
||||
|
||||
# Default FTP account variables
|
||||
$VARREPORT_host = '10.0.0.4';
|
||||
@@ -50,6 +53,7 @@ $timestamp = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$filedate = "$year$mon$mday";
|
||||
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
||||
$shipdate = "$year-$mon-$mday";
|
||||
$start_date = "$year$mon$mday";
|
||||
$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 " [--with-inbound=XXX-XXY] = include the following inbound groups\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-sender=vicidial@localhost] = sender for the email results\n";
|
||||
print " [-q] = quiet\n";
|
||||
print " [-t] = test\n";
|
||||
print " [--quiet] = quiet\n";
|
||||
print " [--test] = test\n";
|
||||
print " [--debug] = debugging messages\n";
|
||||
print " [--debugX] = Super debugging messages\n";
|
||||
print "\n";
|
||||
@@ -113,7 +120,7 @@ if (length($ARGV[0])>1)
|
||||
$DBX=1;
|
||||
print "\n----- SUPER DEBUG MODE -----\n\n";
|
||||
}
|
||||
if ($args =~ /-q/i)
|
||||
if ($args =~ /-quiet/i)
|
||||
{
|
||||
$q=1; $Q=1;
|
||||
}
|
||||
@@ -206,6 +213,62 @@ if (length($ARGV[0])>1)
|
||||
{print "\n----- FTP TRANSFER MODE -----\n\n";}
|
||||
$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)
|
||||
{
|
||||
$T=1; $TEST=1;
|
||||
@@ -235,9 +298,9 @@ if (length($ARGV[0])>1)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set, using defaults.\n";
|
||||
}
|
||||
{
|
||||
print "no command line options set, using defaults.\n";
|
||||
}
|
||||
### end parsing run-time options ###
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
@@ -306,12 +369,12 @@ if ($output_format =~ /^html-rec$/)
|
||||
if ($output_format =~ /^fixed-as400$/)
|
||||
{$DLT = ''; $txt='.txt'; print "---- fixed-as400 ----\n";}
|
||||
|
||||
if ($sale_statuses =~ /---ALL---/)
|
||||
if ($sale_statuses =~ /---ALL---/)
|
||||
{
|
||||
$sale_statusesSQL='';
|
||||
$close_statusesSQL='';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$sale_statusesSQL = $sale_statuses;
|
||||
$sale_statusesSQL =~ s/-/','/gi;
|
||||
@@ -321,9 +384,9 @@ if ($output_format =~ /^fixed-as400$/)
|
||||
$close_statusesSQL = " and vicidial_closer_log.status IN($close_statusesSQL)";
|
||||
}
|
||||
|
||||
$with_inboundSQL = $with_inbound;
|
||||
$with_inboundSQL =~ s/-/','/gi;
|
||||
$with_inboundSQL = "'$with_inboundSQL'";
|
||||
$with_inboundSQL = $with_inbound;
|
||||
$with_inboundSQL =~ s/-/','/gi;
|
||||
$with_inboundSQL = "'$with_inboundSQL'";
|
||||
|
||||
if (!$Q)
|
||||
{
|
||||
@@ -362,7 +425,7 @@ $TOTAL_SALES=0;
|
||||
###########################################################################
|
||||
########### 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;";
|
||||
if ($DB) {print "|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -394,6 +457,12 @@ while ($sthArows > $rec_count)
|
||||
$title = $aryA[19];
|
||||
$address3 = $aryA[20];
|
||||
$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;
|
||||
|
||||
@@ -406,7 +475,7 @@ if (length($with_inboundSQL)>3)
|
||||
###########################################################################
|
||||
########### 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";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -438,21 +507,24 @@ if (length($with_inboundSQL)>3)
|
||||
$title = $aryA[20];
|
||||
$address3 = $aryA[21];
|
||||
$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 = '';
|
||||
$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->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$sthBrows=$sthB->rows;
|
||||
$rec_countB=0;
|
||||
while ($sthBrows > $rec_countB)
|
||||
if ($sthBrows > 0)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$user = $aryB[0];
|
||||
$agent_name = $aryB[1];
|
||||
$rec_countB++;
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
@@ -463,7 +535,6 @@ if (length($with_inboundSQL)>3)
|
||||
$sthA->finish();
|
||||
}
|
||||
|
||||
|
||||
close(out);
|
||||
|
||||
|
||||
@@ -514,8 +585,18 @@ if ( (length($Ealert)>5) && (length($email_list) > 3) )
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 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)
|
||||
{
|
||||
{
|
||||
use Net::FTP;
|
||||
|
||||
if (!$Q) {print "Sending File Over FTP: $outfile\n";}
|
||||
@@ -524,7 +605,44 @@ if ($ftp_transfer > 0)
|
||||
$ftp->cwd("$VARREPORT_dir");
|
||||
$ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile");
|
||||
$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 ###
|
||||
$secY = time();
|
||||
@@ -543,29 +661,31 @@ exit;
|
||||
|
||||
### Subroutine for formatting of the output ###
|
||||
sub select_format_loop
|
||||
{
|
||||
|
||||
if ($T)
|
||||
{
|
||||
# $user = '1234';
|
||||
if ($T)
|
||||
{
|
||||
# $user = '1234';
|
||||
$agent_name = 'Joe Agent';
|
||||
# $closer = '4321';
|
||||
# $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 = '';
|
||||
|
||||
##### BEGIN standard audio lookup #####
|
||||
if ($with_transfer_audio < 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->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$sthBrows=$sthB->rows;
|
||||
$rec_countB=0;
|
||||
while ($sthBrows > $rec_countB)
|
||||
$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];
|
||||
@@ -573,11 +693,11 @@ while ($sthBrows > $rec_countB)
|
||||
$ivr_location = $aryB[2];
|
||||
$rec_countB++;
|
||||
}
|
||||
$sthB->finish();
|
||||
$sthB->finish();
|
||||
|
||||
if (length($ivr_id)<3)
|
||||
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;";
|
||||
$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;
|
||||
@@ -587,13 +707,14 @@ if (length($ivr_id)<3)
|
||||
@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 filename LIKE \"%$phone_number%\" order by length_in_sec desc limit 1;";
|
||||
$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;
|
||||
@@ -603,44 +724,164 @@ if (length($ivr_id)<3)
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$ivr_id = $aryB[0];
|
||||
$ivr_filename = $aryB[1];
|
||||
$ivr_location = $aryB[2];
|
||||
$rec_countB++;
|
||||
}
|
||||
$sthB->finish();
|
||||
}
|
||||
}
|
||||
if ($status =~ /UPSELL/) {$UPSELL='L5';}
|
||||
else {$UPSELL='N';}
|
||||
|
||||
if ($output_format =~ /^pipe-standard$/)
|
||||
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 #####
|
||||
|
||||
##### 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$/)
|
||||
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$/)
|
||||
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$/)
|
||||
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$/)
|
||||
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$/)
|
||||
|
||||
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$/)
|
||||
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;}
|
||||
@@ -691,13 +932,42 @@ if ($output_format =~ /^fixed-as400$/)
|
||||
$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
|
||||
|
||||
$Ealert .= "$str";
|
||||
$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;
|
||||
|
||||
print out "$str";
|
||||
if ($DBX) {print "$str\n";}
|
||||
$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";
|
||||
|
||||
$rec_count++;
|
||||
}
|
||||
|
||||
}
|
||||
$Ealert .= "$str";
|
||||
|
||||
print out "$str";
|
||||
if ($DBX) {print "$str\n";}
|
||||
|
||||
$rec_count++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#!/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
|
||||
# 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
|
||||
# 70905-1409 - First version
|
||||
# 71005-0054 - Altered script to use astguiclient.conf for settings
|
||||
# 90620-0856 - Formatting fixes
|
||||
#
|
||||
|
||||
$txt = '.txt';
|
||||
@@ -30,7 +31,7 @@ $np_statuses = 'NP';
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
@@ -106,34 +107,34 @@ if (length($ARGV[0])>1)
|
||||
print "\n----- TESTING -----\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set, using defaults.\n";
|
||||
}
|
||||
{
|
||||
print "no command line options set, using defaults.\n";
|
||||
}
|
||||
### end parsing run-time options ###
|
||||
|
||||
|
||||
$secX = time();
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year = ($year + 1900);
|
||||
$mon++;
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year = ($year + 1900);
|
||||
$mon++;
|
||||
|
||||
# # rerun override - Use this to override the day manually
|
||||
# $year='2007';
|
||||
# $mon='5';
|
||||
# $mday='18';
|
||||
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$timestamp = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$filedate = "$year$mon$mday";
|
||||
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
||||
$shipdate = "$year-$mon-$mday";
|
||||
$datestamp = "$year/$mon/$mday $hour:$min";
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$timestamp = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$filedate = "$year$mon$mday";
|
||||
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
||||
$shipdate = "$year-$mon-$mday";
|
||||
$datestamp = "$year/$mon/$mday $hour:$min";
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
@@ -323,7 +324,7 @@ close(out);
|
||||
|
||||
|
||||
if ($ftp_transfer > 0)
|
||||
{
|
||||
{
|
||||
use Net::FTP;
|
||||
|
||||
if (!$Q) {print "Sending File Over FTP: $outfile\n";}
|
||||
@@ -332,7 +333,7 @@ if ($ftp_transfer > 0)
|
||||
$ftp->cwd("$VARREPORT_dir");
|
||||
$ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile");
|
||||
$ftp->quit;
|
||||
}
|
||||
}
|
||||
|
||||
### calculate time to run script ###
|
||||
$secY = time();
|
||||
|
||||
@@ -122,7 +122,7 @@ cd ntp-4.2.2p3
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
/usr/local/bin/ntpdate -u ntp.myfloridacity.us
|
||||
/usr/local/bin/ntpdate -u pool.ntp.org
|
||||
|
||||
|
||||
cd /usr/local
|
||||
|
||||
@@ -589,7 +589,7 @@ the time is the same on our client computers and our servers.
|
||||
- make install
|
||||
- vi /etc/ntp.conf (change to just 1 line: "server ntp.myfloridacity.us")
|
||||
- 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
|
||||
- you are done
|
||||
|
||||
@@ -2604,7 +2604,7 @@ SUBPHASE 6.4: setting up asterisk and helper applications for startup
|
||||
/usr/bin/setterm -powerdown
|
||||
|
||||
### start time server
|
||||
/usr/local/bin/ntpdate -u ntp.myfloridacity.us
|
||||
/usr/local/bin/ntpdate -u pool.ntp.org
|
||||
/usr/sbin/ntpd
|
||||
|
||||
### 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
|
||||
|
||||
## 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
|
||||
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,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('8600002','10.10.10.15','');
|
||||
|
||||
+39
-29
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# install.pl version 2.0.5
|
||||
# install.pl version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
|
||||
# CHANGES
|
||||
@@ -17,6 +17,7 @@
|
||||
# 80526-1345 - Added Timeclock auto-logout option 9
|
||||
# 90210-0319 - Added option to prompt for Asterisk version
|
||||
# 90312-1256 - Added CLI flag for automatic configuration
|
||||
# 90620-1910 - Added check before creating directories and formatting changes
|
||||
#
|
||||
|
||||
############################################
|
||||
@@ -125,7 +126,7 @@ $MT[0]='';
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
@@ -901,17 +902,16 @@ if (length($ARGV[0])>1)
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
print "$ext\n$sip\n$iax\n$vm\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# print "no command line options set\n";
|
||||
$CLIcopy_conf_files='n';
|
||||
}
|
||||
{
|
||||
# print "no command line options set\n";
|
||||
$CLIcopy_conf_files='n';
|
||||
}
|
||||
### end parsing run-time options ###
|
||||
|
||||
if (-e "$PATHconf")
|
||||
@@ -2147,29 +2147,38 @@ print "\nSTARTING ASTGUICLIENT INSTALLATION PHASE...\n";
|
||||
|
||||
if ($WEBONLY < 1)
|
||||
{
|
||||
print "Creating $PATHhome/LEADS_IN/DONE directories...\n";
|
||||
`mkdir -p $PATHhome/libs`;
|
||||
`mkdir -p $PATHhome/libs/Asterisk`;
|
||||
`mkdir -p $PATHhome/LEADS_IN`;
|
||||
print "Creating $PATHhome/LEADS_IN directories...\n";
|
||||
if (!-e "$PATHhome/libs/Asterisk") {`mkdir -p $PATHhome/libs/Asterisk`;}
|
||||
if (!-e "$PATHhome/LEADS_IN/DONE")
|
||||
{
|
||||
`mkdir -p $PATHhome/LEADS_IN/DONE`;
|
||||
`chmod -R 0766 $PATHhome/LEADS_IN`;
|
||||
`mkdir -p $PATHhome/VTIGER_IN`;
|
||||
}
|
||||
if (!-e "$PATHhome/VTIGER_IN/DONE")
|
||||
{
|
||||
`mkdir -p $PATHhome/VTIGER_IN/DONE`;
|
||||
`chmod -R 0766 $PATHhome/VTIGER_IN`;
|
||||
}
|
||||
|
||||
print "Creating $PATHmonitor directories...\n";
|
||||
if (!-e "$PATHmonitor")
|
||||
{
|
||||
`mkdir -p $PATHmonitor`;
|
||||
`mkdir -p $PATHDONEmonitor`;
|
||||
`mkdir -p $PATHDONEmonitor/ORIG`;
|
||||
`mkdir -p $PATHDONEmonitor/GSM`;
|
||||
`mkdir -p $PATHDONEmonitor/MP3`;
|
||||
`mkdir -p $PATHDONEmonitor/OGG`;
|
||||
`mkdir -p $PATHDONEmonitor/FTP`;
|
||||
`chmod -R 0766 $PATHmonitor`;
|
||||
}
|
||||
if (!-e "$PATHDONEmonitor")
|
||||
{
|
||||
`mkdir -p $PATHDONEmonitor`;
|
||||
`chmod -R 0766 $PATHDONEmonitor`;
|
||||
}
|
||||
if (!-e "$PATHDONEmonitor/ORIG") {`mkdir -p $PATHDONEmonitor/ORIG`;}
|
||||
if (!-e "$PATHDONEmonitor/GSM") {`mkdir -p $PATHDONEmonitor/GSM`;}
|
||||
if (!-e "$PATHDONEmonitor/MP3") {`mkdir -p $PATHDONEmonitor/MP3`;}
|
||||
if (!-e "$PATHDONEmonitor/OGG") {`mkdir -p $PATHDONEmonitor/OGG`;}
|
||||
if (!-e "$PATHDONEmonitor/FTP") {`mkdir -p $PATHDONEmonitor/FTP`;}
|
||||
|
||||
print "Creating $PATHlogs/archive directory for backups...\n";
|
||||
`mkdir -p $PATHlogs/archive`;
|
||||
if (!-e "$PATHlogs/archive") {`mkdir -p $PATHlogs/archive`;}
|
||||
|
||||
print "Copying bin scripts to $PATHhome ...\n";
|
||||
`cp -f ./bin/* $PATHhome/`;
|
||||
@@ -2212,12 +2221,13 @@ if ($WEBONLY < 1)
|
||||
if ($NOWEB < 1)
|
||||
{
|
||||
print "Creating $PATHweb web directories...\n";
|
||||
`mkdir -p $PATHweb/agc/`;
|
||||
`mkdir -p $PATHweb/astguiclient/`;
|
||||
`mkdir -p $PATHweb/vicidial/`;
|
||||
`mkdir -p $PATHweb/vicidial/ploticus/`;
|
||||
`mkdir -p $PATHweb/vicidial/agent_reports/`;
|
||||
`mkdir -p $PATHweb/vicidial/server_reports/`;
|
||||
|
||||
if (!-e "$PATHweb/agc/") {`mkdir -p $PATHweb/agc/`;}
|
||||
if (!-e "$PATHweb/astguiclient/") {`mkdir -p $PATHweb/astguiclient/`;}
|
||||
if (!-e "$PATHweb/vicidial/") {`mkdir -p $PATHweb/vicidial/`;}
|
||||
if (!-e "$PATHweb/vicidial/ploticus/") {`mkdir -p $PATHweb/vicidial/ploticus/`;}
|
||||
if (!-e "$PATHweb/vicidial/agent_reports/") {`mkdir -p $PATHweb/vicidial/agent_reports/`;}
|
||||
if (!-e "$PATHweb/vicidial/server_reports/") {`mkdir -p $PATHweb/vicidial/server_reports/`;}
|
||||
|
||||
print "Copying web files...\n";
|
||||
`cp -f -R ./www/* $PATHweb/`;
|
||||
@@ -2294,9 +2304,9 @@ exit;
|
||||
|
||||
|
||||
sub leading_zero($)
|
||||
{
|
||||
{
|
||||
$_ = $_[0];
|
||||
s/^(\d)$/0$1/;
|
||||
s/^(\d\d)$/0$1/;
|
||||
return $_;
|
||||
} # End of the leading_zero() routine.
|
||||
} # End of the leading_zero() routine.
|
||||
|
||||
Reference in New Issue
Block a user