diff --git a/agc_2-X/trunk/bin/AST_VDremote_agents.pl b/agc_2-X/trunk/bin/AST_VDremote_agents.pl index ae325954..fe84acb0 100644 --- a/agc_2-X/trunk/bin/AST_VDremote_agents.pl +++ b/agc_2-X/trunk/bin/AST_VDremote_agents.pl @@ -38,6 +38,7 @@ # 91123-1802 - Added outbound_autodial field # 100309-0555 - Added queuemetrics_loginout option # 100318-2307 - Added ra_user field input to vla table +# 100524-1542 - Fixed live call detection bug on multi-server systems # ### begin parsing run-time options ### @@ -656,10 +657,10 @@ while($one_day_interval > 0) ############################################################################### - ###### fourth, validate that the calls that the vicidial_live_agents are on are not dead + ###### fourth, validate that the calls that the vicidial_live_agents are on and not dead ###### and if they are wipe out the values and set the agent record back to READY ############################################################################### - $stmtA = "SELECT user,extension,status,uniqueid,callerid,lead_id,campaign_id FROM vicidial_live_agents where extension LIKE \"R/%\" and server_ip='$server_ip' and uniqueid > 10;"; + $stmtA = "SELECT user,extension,status,uniqueid,callerid,lead_id,campaign_id,call_server_ip FROM vicidial_live_agents where extension LIKE \"R/%\" and server_ip='$server_ip' and uniqueid > 10;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -675,6 +676,7 @@ while($one_day_interval > 0) $VDcallerid = $aryA[4]; $VDlead_id = $aryA[5]; $VDcampaign_id = $aryA[6]; + $VDcall_server_ip = $aryA[7]; $VDrandom = int( rand(9999999)) + 10000000; $VD_user[$z] = $VDuser; @@ -684,6 +686,7 @@ while($one_day_interval > 0) $VD_callerid[$z] = $VDcallerid; $VD_lead_id[$z] = $VDlead_id; $VD_campaign_id[$z] = $VDcampaign_id; + $VD_call_server_ip[$z] = $VDcall_server_ip; $VD_random[$z] = $VDrandom; $z++; @@ -695,7 +698,7 @@ while($one_day_interval > 0) $z=0; foreach(@VD_user) { - $stmtA = "SELECT count(*) FROM vicidial_auto_calls where uniqueid='$VD_uniqueid[$z]' and server_ip='$server_ip';"; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where uniqueid='$VD_uniqueid[$z]' and server_ip IN('$server_ip','$VD_call_server_ip[$z]');"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -710,9 +713,9 @@ while($one_day_interval > 0) { if ($DELusers =~ /R\/$VD_user[$z]\|/) { - $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='PAUSED', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$VD_user[$z]' and server_ip='$server_ip';"; + $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='PAUSED', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$VD_user[$z]' and server_ip='$server_ip';"; $affected_rows = $dbhA->do($stmtA); - if ($DB) {print STDERR "$VD_user[$z] CALL WIPE UPDATE: $affected_rows|PAUSED|$VD_uniqueid[$z]|$VD_user[$z]|\n";} + if ($DB) {print STDERR "$VD_user[$z] CALL WIPE DELETE UPDATE: $affected_rows|PAUSED|$VD_uniqueid[$z]|$VD_user[$z]|\n";} if ($affected_rows>0) { if ($enable_queuemetrics_logging > 0) diff --git a/agc_2-X/trunk/extras/resolution_change.pl b/agc_2-X/trunk/extras/resolution_change.pl new file mode 100644 index 00000000..0f2ca7fb --- /dev/null +++ b/agc_2-X/trunk/extras/resolution_change.pl @@ -0,0 +1,154 @@ +#!/usr/bin/perl +# +# res.pl - script to gather resolution and set to consistent resolution +# +# CHANGES: +# 20100518-1326 - first build +# + +$build = '20100518-1326'; + + +### 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 "res.pl - forces resoution change\n"; + print "allowed run time options:\n"; + print " [-t] = test, don't change anything\n"; + print " [-debug] = lots of debug output\n"; + print " [-debugX] = even more debug output\n"; + print " [-change-only] = do not add new resolution mode\n"; + print " [-800x600] = find 800 by 600 resolution monitor specifics and set resolutions to it\n"; + print " [-1024x768] = find 1024 by 768 resolution monitor specifics and set resolutions to it\n"; + print " [-help] = this help message\n"; + print "\n"; + exit; + } + else + { + if ($args =~ /-change-only/i) + { + $change_only = 1; + } + if ($args =~ /-debug/i) + {$DB=1;} + if ($args =~ /--debugX/i) + { + $DB=1; + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\nBUILD: $build\n"; + } + if ($args =~ /-1024x768/i) + { + $cvt_options = '1024 768'; + $xrandr_options = '1024x768'; + } + if ( ($args =~ /-800x600/i) || (length($cvt_options) < 1) ) + { + $cvt_options = '800 600'; + $xrandr_options = '800x600'; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } + } +else + { + $cvt_options = '800 600'; + $xrandr_options = '800x600'; + } +### end parsing run-time options ### + + +### find cvt binary "cvt 800 600" +$cvtbin = ''; +if ( -e ('/bin/cvt')) {$cvtbin = '/bin/cvt';} +else + { + if ( -e ('/usr/bin/cvt')) {$cvtbin = '/usr/bin/cvt';} + else + { + if ( -e ('/usr/local/bin/cvt')) {$cvtbin = '/usr/local/bin/cvt';} + else + { + print "Can't find cvt binary! Exiting...\n"; + exit; + } + } + } + +### find xrandr binary +$xrandrbin = ''; +if ( -e ('/bin/xrandr')) {$xrandrbin = '/bin/xrandr';} +else + { + if ( -e ('/usr/bin/xrandr')) {$xrandrbin = '/usr/bin/xrandr';} + else + { + if ( -e ('/usr/local/bin/xrandr')) {$xrandrbin = '/usr/local/bin/xrandr';} + else + { + print "Can't find xrandr binary! Exiting...\n"; + exit; + } + } + } + +if ($change_only < 1) + { + if ($DBX > 0) {print "CVT COMMAND: |$cvtbin $cvt_options|\n";} + + @cvtOUTPUT = `$cvtbin $cvt_options`; + ## 800x600 59.86 Hz (CVT 0.48M3) hsync: 37.35 kHz; pclk: 38.25 MHz + #Modeline "800x600_60.00" 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync + + $Modeline_found=0; + $ct=0; + while( ($Modeline_found < 1) && ($ct < 10) ) + { + if ($cvtOUTPUT[$ct] =~ /Modeline/) + { + $Modeline_found++; + chomp($cvtOUTPUT[$ct]); + $modline = $cvtOUTPUT[$ct]; + $modline =~ s/Modeline //gi; + if ($DBX > 0) {print "MODLINE: $ct|$modline|\n";} + } + $ct++; + } + + if ($DBX > 0) {print "XRANDR COMMAND: |$xrandrbin --newmode $modline|\n";} + + @xrandrOUTPUT = `$xrandrbin --newmode $modline`; + + + $ct=0; + foreach(@xrandrOUTPUT) + { + $modline = chomp($xrandrOUTPUT[$ct]); + if ($DBX > 0) {print "XRANDR OUTPUT: $ct|$xrandrOUTPUT[$ct]|\n";} + $ct++; + } + } + +if ($DBX > 0) {print "CHANGING RESOLUTION: |$xrandrbin --size $xrandr_options|\n";} + +@xrandr_sizeOUTPUT = `$xrandrbin --size $xrandr_options`; + + +if ($DBX > 0) {print "DONE, EXITING...\n";} + + +exit;