several minor fixes and changes mostly to bin scripts
Change back to development half-version number: 2.0.4.0-5 git-svn-id: svn://192.168.202.10@743 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# ADMIN_update_server_ip.pl
|
||||
# ADMIN_update_server_ip.pl - updates IP address in DB and conf file
|
||||
#
|
||||
# This script is designed to update all database tables and the local
|
||||
# astguiclient.conf file to reflect a change in IP address. The script will
|
||||
# automatically default to the first eth address in the ifconfig output.
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 71205-2144 - added display of extensions.conf example for call routing
|
||||
#
|
||||
|
||||
############################################
|
||||
# ADMIN_update_server_ip.pl - updates IP address in DB and conf file
|
||||
#
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
@@ -382,11 +382,39 @@ if ($DB) {print " |$affected_rows|$stmtA|\n";}
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
### format the new server_ip dialstring for example to use with extensions.conf
|
||||
$S='*';
|
||||
if( $VARserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ )
|
||||
{
|
||||
$a = leading_zero($1);
|
||||
$b = leading_zero($2);
|
||||
$c = leading_zero($3);
|
||||
$d = leading_zero($4);
|
||||
$VARremDIALstr = "$a$S$b$S$c$S$d";
|
||||
}
|
||||
|
||||
print "\nSERVER IP ADDRESS CHANGE FOR VICIDIAL FINISHED!\n";
|
||||
print "\nPlease remember to change your extensions.conf entries for the new IP address:\n";
|
||||
print "exten => _$VARremDIALstr*8600XXX,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _$VARremDIALstr*8600XXX*.,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _$VARremDIALstr*78600XXX,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _$VARremDIALstr*78600XXX*.,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
|
||||
print "exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
|
||||
|
||||
|
||||
$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far
|
||||
print "\n - process runtime ($secz sec) ($minz minutes)\n";
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
sub leading_zero($)
|
||||
{
|
||||
$_ = $_[0];
|
||||
s/^(\d)$/0$1/;
|
||||
s/^(\d\d)$/0$1/;
|
||||
return $_;
|
||||
} # End of the leading_zero() routine.
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ $KEEP=0;
|
||||
$DELETE=0;
|
||||
foreach(@lead_ids)
|
||||
{
|
||||
if ($save_statuses !~ /\|$statuses[$i]\|/)
|
||||
if ( ($save_statuses !~ /\|$statuses[$i]\|/) && (length($statuses[$i])>0) )
|
||||
{
|
||||
if ($use_date_DIRs)
|
||||
{
|
||||
|
||||
+51
-5
@@ -4,7 +4,9 @@
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# OPTIONAL!!! CUSTOMIZE THIS SCRIPT FIRST!!!
|
||||
# separates leads into two different lists
|
||||
# - separates leads into two different lists
|
||||
# - moves leads older than 30 days into 999999 list_id
|
||||
# - deletes non-sale leads older than 45 days
|
||||
#
|
||||
# It is recommended that you run this program on the local Asterisk machine
|
||||
#
|
||||
@@ -102,8 +104,18 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
|
||||
|
||||
if ($isdst) {$TZmove = "'-6.00','-7.00','-8.00','-9.00','-10.00'";}
|
||||
else {$TZmove = "'-7.00','-8.00','-9.00','-10.00','-11.00'";}
|
||||
if ($isdst)
|
||||
{
|
||||
$TZmove = "'-6.00','-7.00','-8.00','-9.00','-10.00'";
|
||||
$TZback = "'-4.00','-5.00'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$TZmove = "'-7.00','-8.00','-9.00','-10.00','-11.00'";
|
||||
$TZback = "'-5.00','-6.00'";
|
||||
}
|
||||
|
||||
##### change Pacific Mountain
|
||||
|
||||
$stmtA = "UPDATE vicidial_list set list_id='222' where list_id='111' and gmt_offset_now IN($TZmove);";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
@@ -119,6 +131,39 @@ else {$TZmove = "'-7.00','-8.00','-9.00','-10.00','-11.00'";}
|
||||
if($DB){print STDERR "\n|$affected_rows records changed|\n";}
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE vicidial_list set list_id='4444' where list_id='3333' and gmt_offset_now IN($TZmove);";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) {
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows records changed|\n";}
|
||||
}
|
||||
|
||||
##### change back Eastern Central
|
||||
|
||||
$stmtA = "UPDATE vicidial_list set list_id='111' where list_id='222' and gmt_offset_now IN($TZback);";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) {
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows records changed|\n";}
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE vicidial_list set list_id='11315' where list_id='12021' and gmt_offset_now IN($TZback);";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) {
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows records changed|\n";}
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE vicidial_list set list_id='3333' where list_id='4444' and gmt_offset_now IN($TZback);";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) {
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows records changed|\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$secX = time();
|
||||
|
||||
$XDtarget = ($secX - 2678400);
|
||||
@@ -143,14 +188,14 @@ if ($Tmin < 10) {$Tmin = "0$Tmin";}
|
||||
if ($Tsec < 10) {$Tsec = "0$Tsec";}
|
||||
$TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec";
|
||||
|
||||
$stmtA = "UPDATE vicidial_list set list_id='999999' where list_id IN('11315','12021','111','222') and entry_date < \"$XDSQLdate\";";
|
||||
$stmtA = "UPDATE vicidial_list set list_id='999999' where list_id IN('11315','12021','111','222','3333','4444') and entry_date < \"$XDSQLdate\";";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) {
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows records changed|\n";}
|
||||
}
|
||||
|
||||
$stmtA = "DELETE from vicidial_list WHERE list_id='999999' and entry_date < \"$TDSQLdate\";";
|
||||
$stmtA = "DELETE from vicidial_list WHERE list_id='999999' and entry_date < \"$TDSQLdate\" and status NOT IN('SALE','UPSELL','UPSALE','A1','A2','A3','A4');";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) {
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
@@ -161,3 +206,4 @@ if ($Tsec < 10) {$Tsec = "0$Tsec";}
|
||||
$dbhA->disconnect();
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
@@ -86,10 +86,6 @@ $secX = time();
|
||||
print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_agent_day.pl --\n\n";
|
||||
print "This program is designed to print stats to a file for agents' activity for the previous day. \n\n";
|
||||
|
||||
$TDoutfile = '';
|
||||
$TLoutfile = '';
|
||||
$TLoutfile .= "TODAY: $day $shipdate\n\n";
|
||||
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
@@ -158,9 +154,12 @@ $vicidial_agent_log = 'vicidial_agent_log';
|
||||
###########################################################################
|
||||
########### PAST WEEK STAT GATHERING LOOP #################################
|
||||
###########################################################################
|
||||
print Dout "TODAY: $day $shipdate\n\n";
|
||||
print Dout "DATE|AGENT|USER|CALLS|TALK|PAUSE|WAIT|DISPO|ACTIVE|LOGTIME|FIRST|LAST\n";
|
||||
print out "TODAY: $day $shipdate\n\n";
|
||||
print out "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n";
|
||||
print "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n";
|
||||
print "TODAY: $day $shipdate\n\n";
|
||||
print "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n";
|
||||
|
||||
$stmtA = "select count(*) as calls, full_name,vicidial_users.user,sum(talk_sec),sum(pause_sec),sum(wait_sec),sum(dispo_sec) from vicidial_users,$vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$shipdate 00:00:00' and vicidial_users.user=$vicidial_agent_log.user and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by vicidial_users.user order by full_name limit 10000;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# AST_agent_week_tally.pl
|
||||
#
|
||||
# This script is designed to gather stats for all agent activity over the course
|
||||
# of a week and print it in an ASCI text file to be placed
|
||||
# on a web server for viewing.
|
||||
#
|
||||
# Place in the crontab and run every Saturday night at 23:59
|
||||
# 59 23 6 * * /home/cron/AST_agent_day.pl
|
||||
#
|
||||
# CHANGES
|
||||
# 60517-1100 - First version
|
||||
# 60715-2325 - changed to use /etc/astguiclient.conf for configs
|
||||
# 71115-0231 - added Pipe-delimited file output
|
||||
# 71205-1232 - Changed to week total version
|
||||
#
|
||||
|
||||
$txt = '.txt';
|
||||
$US = '_';
|
||||
$MT[0] = '';
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
$args = "$args $ARGV[$i]";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($args =~ /--help/i)
|
||||
{
|
||||
print "allowed run time options:\n [-q] = quiet\n [-t] = test\n\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--debug/i)
|
||||
{
|
||||
$DB=1;
|
||||
print "\n-----DEBUG MODE-----\n\n";
|
||||
}
|
||||
if ($args =~ /-q/i)
|
||||
{
|
||||
$q=1; $Q=1;
|
||||
}
|
||||
if ($args =~ /-t/i)
|
||||
{
|
||||
$T=1; $TEST=1;
|
||||
print "\n-----TESTING-----\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set\n";
|
||||
}
|
||||
### end parsing run-time options ###
|
||||
|
||||
|
||||
$secX = time();
|
||||
($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";}
|
||||
$filedate = "$year$mon$mday-$hour$min$sec";
|
||||
$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec";
|
||||
$shipdate = "$year-$mon-$mday";
|
||||
$datestamp = "$year/$mon/$mday $hour:$min";
|
||||
|
||||
if ($wday==0) {$day='Sunday ';}
|
||||
if ($wday==1) {$day='Monday ';}
|
||||
if ($wday==2) {$day='Tuesday ';}
|
||||
if ($wday==3) {$day='Wednesday';}
|
||||
if ($wday==4) {$day='Thursday ';}
|
||||
if ($wday==5) {$day='Friday ';}
|
||||
if ($wday==6) {$day='Saturday ';}
|
||||
|
||||
$TDtarget = ($secX - 600000); # 6 days 10 hours 30 minutes in the past
|
||||
($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";}
|
||||
$begindate = "$Tyear-$Tmon-$Tmday";
|
||||
|
||||
|
||||
print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_agent_week_tally.pl --\n\n";
|
||||
print "This program is designed to print stats to a file for agents' activity for the previous week. \n\n";
|
||||
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
|
||||
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
|
||||
@conf = <conf>;
|
||||
close(conf);
|
||||
$i=0;
|
||||
foreach(@conf)
|
||||
{
|
||||
$line = $conf[$i];
|
||||
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
|
||||
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
|
||||
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
|
||||
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
|
||||
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
|
||||
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
|
||||
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
|
||||
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
|
||||
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
|
||||
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
|
||||
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
|
||||
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
|
||||
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
|
||||
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
|
||||
$i++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
|
||||
$outfile = "AGENT_TALLY_$shipdate$txt";
|
||||
$Doutfile = "AGENT_TALLY_PIPE_$shipdate$txt";
|
||||
|
||||
### open the X out file for writing ###
|
||||
open(out, ">$PATHweb/vicidial/agent_reports/$outfile")
|
||||
|| die "Can't open $outfile: $!\n";
|
||||
open(Dout, ">$PATHweb/vicidial/agent_reports/$Doutfile")
|
||||
|| die "Can't open $Doutfile: $!\n";
|
||||
|
||||
if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
|
||||
use DBI;
|
||||
|
||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
#$vicidial_agent_log = 'vicidial_agent_log_archive';
|
||||
$vicidial_agent_log = 'vicidial_agent_log';
|
||||
|
||||
###########################################################################
|
||||
########### PAST WEEK STAT GATHERING LOOP #################################
|
||||
###########################################################################
|
||||
print Dout "DATE|AGENT|USER|CALLS|TALK|PAUSE|WAIT|DISPO|ACTIVE|LOGTIME|FIRST|LAST\n";
|
||||
print out "WEEK: $begindate through $shipdate\n\n";
|
||||
print out "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n";
|
||||
print "WEEK: $begindate through $shipdate\n\n";
|
||||
print "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n";
|
||||
|
||||
$stmtA = "select count(*) as calls, full_name,vicidial_users.user,sum(talk_sec),sum(pause_sec),sum(wait_sec),sum(dispo_sec) from vicidial_users,$vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$begindate 00:00:00' and vicidial_users.user=$vicidial_agent_log.user and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by vicidial_users.user order by full_name limit 10000;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
|
||||
$Dcalls = $aryA[0];
|
||||
$Dname = $aryA[1];
|
||||
$Duser = $aryA[2];
|
||||
$calls = sprintf("%7s", $aryA[0]);
|
||||
$name = sprintf("%-20s", $aryA[1]); while(length($name)>20) {chop($name);}
|
||||
$user = sprintf("%-8s", $aryA[2]);
|
||||
|
||||
### TOTAL ACTIVE TIME
|
||||
$active = ($aryA[3] + $aryA[4] + $aryA[5] + $aryA[6]);
|
||||
$TIME_S = $active;
|
||||
$TIME_H = int($TIME_S / 3600);
|
||||
$TIME_S = ($TIME_S - ($TIME_H * 3600));
|
||||
$TIME_M = int($TIME_S / 60);
|
||||
$TIME_S = ($TIME_S - ($TIME_M * 60));
|
||||
if ($TIME_S < 10) {$TIME_S = "0$TIME_S";}
|
||||
if ($TIME_M < 10) {$TIME_M = "0$TIME_M";}
|
||||
$TIME_HMS = "$TIME_H:$TIME_M:$TIME_S";
|
||||
$Dactive = $TIME_HMS;
|
||||
$active = sprintf("%9s", $TIME_HMS);
|
||||
|
||||
### TOTAL TALK TIME
|
||||
$TIME_S = $aryA[3];
|
||||
$TIME_H = int($TIME_S / 3600);
|
||||
$TIME_S = ($TIME_S - ($TIME_H * 3600));
|
||||
$TIME_M = int($TIME_S / 60);
|
||||
$TIME_S = ($TIME_S - ($TIME_M * 60));
|
||||
if ($TIME_S < 10) {$TIME_S = "0$TIME_S";}
|
||||
if ($TIME_M < 10) {$TIME_M = "0$TIME_M";}
|
||||
$TIME_HMS = "$TIME_H:$TIME_M:$TIME_S";
|
||||
$Dtalk = $TIME_HMS;
|
||||
$talk = sprintf("%9s", $TIME_HMS);
|
||||
|
||||
### TOTAL PAUSE TIME
|
||||
$TIME_S = $aryA[4];
|
||||
$TIME_H = int($TIME_S / 3600);
|
||||
$TIME_S = ($TIME_S - ($TIME_H * 3600));
|
||||
$TIME_M = int($TIME_S / 60);
|
||||
$TIME_S = ($TIME_S - ($TIME_M * 60));
|
||||
if ($TIME_S < 10) {$TIME_S = "0$TIME_S";}
|
||||
if ($TIME_M < 10) {$TIME_M = "0$TIME_M";}
|
||||
$TIME_HMS = "$TIME_H:$TIME_M:$TIME_S";
|
||||
$Dpause = $TIME_HMS;
|
||||
$pause = sprintf("%9s", $TIME_HMS);
|
||||
|
||||
### TOTAL WAIT TIME
|
||||
$TIME_S = $aryA[5];
|
||||
$TIME_H = int($TIME_S / 3600);
|
||||
$TIME_S = ($TIME_S - ($TIME_H * 3600));
|
||||
$TIME_M = int($TIME_S / 60);
|
||||
$TIME_S = ($TIME_S - ($TIME_M * 60));
|
||||
if ($TIME_S < 10) {$TIME_S = "0$TIME_S";}
|
||||
if ($TIME_M < 10) {$TIME_M = "0$TIME_M";}
|
||||
$TIME_HMS = "$TIME_H:$TIME_M:$TIME_S";
|
||||
$Dwait = $TIME_HMS;
|
||||
$wait = sprintf("%9s", $TIME_HMS);
|
||||
|
||||
### TOTAL DISPO TIME
|
||||
$TIME_S = $aryA[6];
|
||||
$TIME_H = int($TIME_S / 3600);
|
||||
$TIME_S = ($TIME_S - ($TIME_H * 3600));
|
||||
$TIME_M = int($TIME_S / 60);
|
||||
$TIME_S = ($TIME_S - ($TIME_M * 60));
|
||||
if ($TIME_S < 10) {$TIME_S = "0$TIME_S";}
|
||||
if ($TIME_M < 10) {$TIME_M = "0$TIME_M";}
|
||||
$TIME_HMS = "$TIME_H:$TIME_M:$TIME_S";
|
||||
$Ddispo = $TIME_HMS;
|
||||
$dispo = sprintf("%9s", $TIME_HMS);
|
||||
|
||||
$stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$begindate 00:00:00' and user='$aryA[2]' order by event_time limit 1;";
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtA ", $dbhB->errstr;
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$Dfirst_time = $aryB[0];
|
||||
$first_time = sprintf("%21s", $aryB[0]);
|
||||
$Dfirst_log = $aryB[1];
|
||||
$first_log = $aryB[1];
|
||||
|
||||
$stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$begindate 00:00:00' and user='$aryA[2]' order by event_time desc limit 1;";
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtA ", $dbhB->errstr;
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$Dlast_time = $aryB[0];
|
||||
$last_time = sprintf("%21s", $aryB[0]);
|
||||
$Dlast_log = $aryB[1];
|
||||
$last_log = $aryB[1];
|
||||
|
||||
$TIME_S = ($last_log - $first_log);
|
||||
$TIME_H = int($TIME_S / 3600);
|
||||
$TIME_S = ($TIME_S - ($TIME_H * 3600));
|
||||
$TIME_M = int($TIME_S / 60);
|
||||
$TIME_S = ($TIME_S - ($TIME_M * 60));
|
||||
if ($TIME_S < 10) {$TIME_S = "0$TIME_S";}
|
||||
if ($TIME_M < 10) {$TIME_M = "0$TIME_M";}
|
||||
$TIME_HMS = "$TIME_H:$TIME_M:$TIME_S";
|
||||
$TIME_HMS = "N/A";
|
||||
$Dlogin_time = $TIME_HMS;
|
||||
$login_time = sprintf("%9s", $TIME_HMS);
|
||||
|
||||
|
||||
|
||||
print Dout "$shipdate|$Dname|$Duser|$Dcalls|$Dtalk|$Dpause|$Dwait|$Ddispo|$Dactive|$Dlogin_time|$Dfirst_time|$Dlast_time\n";
|
||||
print out "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n";
|
||||
print "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n";
|
||||
|
||||
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
|
||||
close(Dout);
|
||||
close(out);
|
||||
|
||||
### calculate time to run script ###
|
||||
$secY = time();
|
||||
$secZ = ($secY - $secX);
|
||||
$secZm = ($secZ /60);
|
||||
|
||||
print "script execution time in seconds: $secZ minutes: $secZm\n";
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
|
||||
if ($DB) {print " - cleaning up pause time\n";}
|
||||
### Grab any pause time record greater than 50000
|
||||
$stmtA = "SELECT agent_log_id,pause_epoch,wait_epoch from vicidial_agent_log where pause_sec>50000;";
|
||||
### Grab any pause time record greater than 43999
|
||||
$stmtA = "SELECT agent_log_id,pause_epoch,wait_epoch from vicidial_agent_log where pause_sec>43999;";
|
||||
if ($DBX) {print "$stmtA\n";}
|
||||
#$dbhA->query("$stmtA");
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -129,7 +129,7 @@ if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
$pause_epoch[$i] = "$aryA[1]";
|
||||
$wait_epoch[$i] = "$aryA[2]";
|
||||
$pause_sec[$i] = int($wait_epoch[$i] - $pause_epoch[$i]);
|
||||
if ( ($pause_sec[$i] < 0) || ($pause_sec[$i] > 50000) )
|
||||
if ( ($pause_sec[$i] < 0) || ($pause_sec[$i] > 43999) )
|
||||
{
|
||||
$DBout = "Override output: $pause_sec[$i]";
|
||||
$pause_sec[$i] = 0;
|
||||
@@ -156,8 +156,8 @@ if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
if ($DBX) {print "\n\n";}
|
||||
if ($DB) {print " - cleaning up wait time\n";}
|
||||
### Grab any pause time record greater than 50000
|
||||
$stmtA = "SELECT agent_log_id,wait_epoch,talk_epoch from vicidial_agent_log where wait_sec>50000;";
|
||||
### Grab any pause time record greater than 43999
|
||||
$stmtA = "SELECT agent_log_id,wait_epoch,talk_epoch from vicidial_agent_log where wait_sec>43999;";
|
||||
if ($DBX) {print "$stmtA\n";}
|
||||
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -173,7 +173,7 @@ if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
$wait_epoch[$i] = "$aryA[1]";
|
||||
$talk_epoch[$i] = "$aryA[2]";
|
||||
$wait_sec[$i] = int($talk_epoch[$i] - $wait_epoch[$i]);
|
||||
if ( ($wait_sec[$i] < 0) || ($wait_sec[$i] > 50000) )
|
||||
if ( ($wait_sec[$i] < 0) || ($wait_sec[$i] > 43999) )
|
||||
{
|
||||
$DBout = "Override output: $wait_sec[$i]";
|
||||
$wait_sec[$i] = 0;
|
||||
@@ -199,8 +199,8 @@ if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
if ($DBX) {print "\n\n";}
|
||||
if ($DB) {print " - cleaning up talk time\n";}
|
||||
### Grab any pause time record greater than 50000
|
||||
$stmtA = "SELECT agent_log_id,talk_epoch,dispo_epoch from vicidial_agent_log where talk_sec>50000;";
|
||||
### Grab any pause time record greater than 43999
|
||||
$stmtA = "SELECT agent_log_id,talk_epoch,dispo_epoch from vicidial_agent_log where talk_sec>43999;";
|
||||
if ($DBX) {print "$stmtA\n";}
|
||||
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -216,7 +216,7 @@ if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
$talk_epoch[$i] = "$aryA[1]";
|
||||
$dispo_epoch[$i] = "$aryA[2]";
|
||||
$talk_sec[$i] = int($dispo_epoch[$i] - $talk_epoch[$i]);
|
||||
if ( ($talk_sec[$i] < 0) || ($talk_sec[$i] > 50000) )
|
||||
if ( ($talk_sec[$i] < 0) || ($talk_sec[$i] > 43999) )
|
||||
{
|
||||
$DBout = "Override output: $talk_sec[$i]";
|
||||
$talk_sec[$i] = 0;
|
||||
@@ -243,7 +243,7 @@ if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
if ($DBX) {print "\n\n";}
|
||||
if ($DB) {print " - cleaning up dispo time\n";}
|
||||
$stmtA = "UPDATE vicidial_agent_log set dispo_sec='0' where dispo_sec>50000;";
|
||||
$stmtA = "UPDATE vicidial_agent_log set dispo_sec='0' where dispo_sec>43999;";
|
||||
if($DBX){print STDERR "|$stmtA|\n";}
|
||||
if (!$TEST)
|
||||
{
|
||||
|
||||
@@ -1464,8 +1464,10 @@ exten => _56XXX,1,AgentCallbackLogin(||${EXTEN:1}@default)
|
||||
### FOR MORE INFORMATION, READ THE LOAD_BALANCING.txt DOCUMENT
|
||||
### server 1 extens:
|
||||
exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o)
|
||||
exten => _010*010*010*016*78600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o)
|
||||
### server 2 extens:
|
||||
exten => _010*010*010*015*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o)
|
||||
exten => _010*010*010*015*78600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o)
|
||||
|
||||
10. edit dnsmgr.conf: # It is very helpful to enable dnsmgr
|
||||
[general]
|
||||
@@ -1902,7 +1904,10 @@ exten => _*NXXNXXXXXX*3429,5,Voicemail,u2000
|
||||
|
||||
exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1)
|
||||
exten => _010*010*010*015*8600XXX*.,1,Goto(default,${EXTEN:16},1)
|
||||
exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1)
|
||||
exten => _010*010*010*015*78600XXX*.,1,Goto(default,${EXTEN:16},1)
|
||||
exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
|
||||
exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
|
||||
|
||||
|
||||
; parameters for agi-VDAD_ALL_inbound.agi (9 fields separated by five dashes "-----"):
|
||||
|
||||
+31
@@ -1878,6 +1878,27 @@ if ($PROMPTcopy_conf_files =~ /y/i)
|
||||
`cp -f ./docs/conf_examples/dnsmgr.conf.sample /etc/asterisk/dnsmgr.conf`;
|
||||
}
|
||||
|
||||
|
||||
### format the new server_ip dialstring for example to use with extensions.conf
|
||||
$S='*';
|
||||
if( $VARserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ )
|
||||
{
|
||||
$a = leading_zero($1);
|
||||
$b = leading_zero($2);
|
||||
$c = leading_zero($3);
|
||||
$d = leading_zero($4);
|
||||
$VARremDIALstr = "$a$S$b$S$c$S$d";
|
||||
}
|
||||
|
||||
print "\nIMPORTANT NOTE!\n";
|
||||
print "\nPlease remember to put these lines in your extensions.conf file:\n";
|
||||
print "exten => _$VARremDIALstr*8600XXX,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _$VARremDIALstr*8600XXX*.,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _$VARremDIALstr*78600XXX,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _$VARremDIALstr*78600XXX*.,1,Goto(default,${EXTEN:16},1)\n";
|
||||
print "exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
|
||||
print "exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
|
||||
|
||||
print "\nASTGUICLIENT INSTALLATION FINISHED! ENJOY!\n";
|
||||
|
||||
$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far
|
||||
@@ -1885,3 +1906,13 @@ print "\n - process runtime ($secz sec) ($minz minutes)\n";
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
sub leading_zero($)
|
||||
{
|
||||
$_ = $_[0];
|
||||
s/^(\d)$/0$1/;
|
||||
s/^(\d\d)$/0$1/;
|
||||
return $_;
|
||||
} # End of the leading_zero() routine.
|
||||
|
||||
@@ -474,10 +474,10 @@ echo "</FORM>\n\n";
|
||||
if ($campaign_allow_inbound > 0)
|
||||
{
|
||||
$stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
|
||||
if ($non_latin > 0)
|
||||
{
|
||||
$rslt=mysql_query("SET NAMES 'UTF8'");
|
||||
}
|
||||
if ($non_latin > 0)
|
||||
{
|
||||
$rslt=mysql_query("SET NAMES 'UTF8'");
|
||||
}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$closer_campaigns = preg_replace("/^ | -$/","",$row[0]);
|
||||
|
||||
Reference in New Issue
Block a user