From 27c2f92d13cca8c2a5164cbd70e998b415bd3bbd Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 9 Sep 2009 13:25:20 +0000 Subject: [PATCH] Fixes for parked calls in vicidial.php git-svn-id: svn://192.168.202.10@1223 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi | 6 +-- agc_2-X/trunk/agi/park_CID.agi | 7 +-- agc_2-X/trunk/bin/AST_VDauto_dial.pl | 49 +++++++++++-------- agc_2-X/trunk/bin/AST_VDsales_export.pl | 5 ++ agc_2-X/trunk/www/agc/manager_send.php | 16 +++--- agc_2-X/trunk/www/agc/vicidial.php | 12 +++-- .../trunk/www/vicidial/admin_search_lead.php | 2 +- 7 files changed, 60 insertions(+), 37 deletions(-) diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index 479e5f95..38cad4ad 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -2194,7 +2194,7 @@ if ( ($start_place_in_line > 0) && ($moh_delay == '1') ) if ($rec_countWAIT > 0) {$place = $rec_countWAIT;} if ($rec_countWAITrem > 0) {$place = $rec_countWAITrem;} $place++; - if ($AGILOG) {$agi_string = "-- PLACE IN LINE: |$campaign_id|$place|"; &agi_output;} + if ($AGILOG) {$agi_string = "-- PLACE IN LINE: |$campaign|$place|"; &agi_output;} $AGI->stream_file('sip-silence'); # stop music-on-hold process $AGI->stream_file('sip-silence'); # stop music-on-hold process @@ -2285,7 +2285,7 @@ if ( ($start_hold_estimate > 0) && ($moh_delay == '1') ) if ($holdtime_estimate_sec_diff < 10) {$holdtime_estimate_sec_diff=10;} $holdtime_estimate = int($holdtime_estimate_sec_diff / 60); $holdtime_estimate_sec_rem = ( $holdtime_estimate_sec_diff - ($holdtime_estimate * 60) ); - if ($AGILOG) {$agi_string = "-- HOLD ESTIMATE: |$campaign_id|$holdtime_estimate|$holdtime_estimate_sec_rem|$holdtime_estimate_sec_diff| |$holdtime_estimate_sec|$livetime_estimate_sec|$avgtime_estimate_sec|"; &agi_output;} + if ($AGILOG) {$agi_string = "-- HOLD ESTIMATE: |$campaign|$holdtime_estimate|$holdtime_estimate_sec_rem|$holdtime_estimate_sec_diff| |$holdtime_estimate_sec|$livetime_estimate_sec|$avgtime_estimate_sec|"; &agi_output;} ##### play the hold time estimate to the caller if option is set if ($play_estimate_hold_time =~ /Y/i) @@ -2321,7 +2321,7 @@ if ( ($start_hold_estimate > 0) && ($moh_delay == '1') ) } ##### check if hold_time_option is set to leave Queue -if ( ($hold_time_option !~ /NONE/ ) && ( $holdtime_estimate_sec_diff > $hold_time_option_second ) && ($wait_in_queue < 2) ) +if ( ($hold_time_option !~ /NONE/ ) && ( $holdtime_estimate_sec_diff > $hold_time_option_seconds ) && ($wait_in_queue < 2) ) { $wait_in_queue=0; # exits wait loop $DROPexten = ''; diff --git a/agc_2-X/trunk/agi/park_CID.agi b/agc_2-X/trunk/agi/park_CID.agi index 02b5e730..2089d1e6 100644 --- a/agc_2-X/trunk/agi/park_CID.agi +++ b/agc_2-X/trunk/agi/park_CID.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# park_CID.agi version 2.0.5 *DBI-version* +# park_CID.agi version 2.2.0 *DBI-version* # # runs before the park extension to populate the parked_channels entry with the channel's callerid # @@ -12,12 +12,13 @@ # exten => 8301,3,Playback(park) # exten => 8301,4,Hangup # -# Copyright (C) 2008 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 # # changes: # 60731-1423 - changed to use DBI-DBD::mysql # - changed to use /etc/astguiclient.conf for configs # 60815-1256 - added output options check from database +# 90909-0922 - Fixed calleridname issue # $script = 'park_CID.agi'; @@ -171,7 +172,7 @@ while() { if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} if ( $calleridname =~ /\"/) {$calleridname =~ s/\"//gi;} - if ( (!$callerid) or ($callerid =~ /unknown/) ) + if ( (!$callerid) or ($callerid =~ /unknown/) or ( ($calleridname =~ /\d\d\d\d\d\d\d\d\d/) && (length($calleridname) > 16) ) ) {$callerid = $calleridname;} ### allow for ANI being sent with the DNIS "*3125551212*9999*" diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index 0dbbffca..06f5b33c 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -81,6 +81,7 @@ # 90816-0057 - Changed default vicidial_log time to 0 from 1 second # 90827-1227 - Added list_id logging in vicidial_log on NA calls # 90907-0919 - Added LAGGED pause code update for paused agents, reduced logging if no issues +# 90909-0640 - Parked bug fix and code optimizations # @@ -393,12 +394,10 @@ while($one_day_interval > 0) $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) + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $active_line_counter = "$aryA[0]"; - $rec_count++; + $active_line_counter = $aryA[0]; } $sthA->finish(); @@ -533,12 +532,10 @@ while($one_day_interval > 0) $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) + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; $tally_xfer_line_counter = "$aryA[0]"; - $rec_count++; } $sthA->finish(); @@ -571,12 +568,10 @@ while($one_day_interval > 0) $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) + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; $DBIPexistcalls[$user_CIPct] = "$aryA[0]"; - $rec_count++; } $sthA->finish(); @@ -657,12 +652,10 @@ while($one_day_interval > 0) $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) + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; $waiting_calls = "$aryA[0]"; - $rec_count++; } $sthA->finish(); @@ -1044,6 +1037,22 @@ while($one_day_interval > 0) $sthA->finish(); } + # Find out if (the call is parked + $PARKchannel=0; + if (length($KLcallerid[$kill_vac]) > 17) + { + $stmtA = "SELECT count(*) from parked_channels where channel_group='$KLcallerid[$kill_vac]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsPK=$sthA->rows; + if ($sthArowsPK > 0) + { + @aryA = $sthA->fetchrow_array; + $PARKchannel = $aryA[0]; + } + $sthA->finish(); + } + $CLlead_id=''; $auto_call_id=''; $CLstatus=''; $CLcampaign_id=''; $CLphone_number=''; $CLphone_code=''; $stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,call_type,UNIX_TIMESTAMP(last_update_time) FROM vicidial_auto_calls where callerid='$KLcallerid[$kill_vac]'"; @@ -1113,7 +1122,7 @@ while($one_day_interval > 0) $call_timeout = ($CLdial_timeout + $CLdrop_call_seconds); if ($CLstage =~ /SURVEY|REMIND/) {$call_timeout = ($call_timeout + 120);} - if ( ($dialtime_log >= $call_timeout) || ($dialtime_catch >= $call_timeout) || ($CLstatus =~ /BUSY|DISCONNECT|XFER|CLOSER/) ) + if ( ( ($dialtime_log >= $call_timeout) || ($dialtime_catch >= $call_timeout) || ($CLstatus =~ /BUSY|DISCONNECT|XFER|CLOSER/) ) && ($PARKchannel < 1) ) { if ($CLcall_type !~ /IN/) { @@ -1830,19 +1839,17 @@ while($one_day_interval > 0) $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) + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $DBmax_vicidial_trunks = "$aryA[0]"; - $DBanswer_transfer_agent= "$aryA[1]"; - $DBSERVER_GMT = "$aryA[2]"; - $DBext_context = "$aryA[3]"; + $DBmax_vicidial_trunks = $aryA[0]; + $DBanswer_transfer_agent = $aryA[1]; + $DBSERVER_GMT = $aryA[2]; + $DBext_context = $aryA[3]; $max_vicidial_trunks = $DBmax_vicidial_trunks; if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} if ($DBext_context) {$ext_context = $DBext_context;} - $rec_count++; } $sthA->finish(); diff --git a/agc_2-X/trunk/bin/AST_VDsales_export.pl b/agc_2-X/trunk/bin/AST_VDsales_export.pl index 1eef8dfc..b67096a6 100644 --- a/agc_2-X/trunk/bin/AST_VDsales_export.pl +++ b/agc_2-X/trunk/bin/AST_VDsales_export.pl @@ -1162,6 +1162,11 @@ sub select_format_loop # 12- order number (just a dash for now '-') # 13- call recording filenames + $uniqueid =~ s/\.00000//gi; + $uniqueid =~ s/\.0000//gi; + $uniqueid =~ s/\.000//gi; + $uniqueid =~ s/\.00//gi; + $uniqueid =~ s/\.0//gi; $uniqueid =~ s/\D//gi; @call_date_array = split(/ /,$call_date); while (length($phone_number)>10) {$phone_number =~ s/^.//gi;} diff --git a/agc_2-X/trunk/www/agc/manager_send.php b/agc_2-X/trunk/www/agc/manager_send.php index bec956e4..6083e28b 100644 --- a/agc_2-X/trunk/www/agc/manager_send.php +++ b/agc_2-X/trunk/www/agc/manager_send.php @@ -731,9 +731,9 @@ if ($ACTION=="RedirectVD") } if ($ACTION=="RedirectToPark") -{ - if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { $channel_live=0; echo "One of these variables is not valid:\n"; echo "Channel $channel must be greater than 2 characters\n"; @@ -744,17 +744,21 @@ if ($ACTION=="RedirectToPark") echo "ext_priority $ext_priority must be set\n"; echo "parkedby $parkedby must be set\n"; echo "\nRedirectToPark Action not sent\n"; - } + } else - { + { if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} - $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','$CalLCID','$extenName','$parkedby','$NOW_TIME');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);} $ACTION="Redirect"; + + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n"); + # fclose($fp); + } } -} if ($ACTION=="RedirectFromPark") { diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index c0762722..56db650b 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -251,10 +251,11 @@ # 90827-1549 - Added list script override option, original_phone_login variable # 90831-1456 - Added active_agent_login_server option for servers # 90908-1038 - Added DEAD call display +# 90909-0921 - Fixed park issues # -$version = '2.2.0-228'; -$build = '90908-1038'; +$version = '2.2.0-229'; +$build = '90909-0921'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=61; $one_mysql_log=0; @@ -3655,12 +3656,16 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (taskvar == 'ParK') { + if (CalLCID.length < 1) + { + CalLCID = MDnextCID; + } blind_transfer=0; var queryCID = "LPvdcW" + epoch_sec + user_abb; var redirectdestination = taskxferconf; var redirectdestserverip = taskserverip; var parkedby = protocol + "/" + extension; - xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=RedirectToPark&format=text&channel=" + redirectdestination + "&call_server_ip=" + redirectdestserverip + "&queryCID=" + queryCID + "&exten=" + park_on_extension + "&ext_context=" + ext_context + "&ext_priority=1&extenName=park&parkedby=" + parkedby + "&session_id=" + session_id; + xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=RedirectToPark&format=text&channel=" + redirectdestination + "&call_server_ip=" + redirectdestserverip + "&queryCID=" + queryCID + "&exten=" + park_on_extension + "&ext_context=" + ext_context + "&ext_priority=1&extenName=park&parkedby=" + parkedby + "&session_id=" + session_id + "&CalLCID=" + CalLCID; document.getElementById("ParkControl").innerHTML ="\"Grab"; customerparked=1; @@ -5962,6 +5967,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} VD_live_call_secondS = 0; MD_ring_secondS = 0; CalLCID = ''; + MDnextCID = ''; // UPDATE VICIDIAL_LOG ENTRY FOR THIS CALL PROCESS DialLog("end"); diff --git a/agc_2-X/trunk/www/vicidial/admin_search_lead.php b/agc_2-X/trunk/www/vicidial/admin_search_lead.php index 238ebfc4..840e16f8 100644 --- a/agc_2-X/trunk/www/vicidial/admin_search_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_search_lead.php @@ -271,7 +271,7 @@ else $SQL_log = "$stmt|"; $SQL_log = ereg_replace(';','',$SQL_log); $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN MODIFY LEAD', event_sql=\"$SQL_log\", event_notes='';"; + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN SEARCH LEAD', event_sql=\"$SQL_log\", event_notes='';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); }