diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 56ff0c56..735acb34 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -958,7 +958,7 @@ if ($agent_search_method =~ /^SO|^LO/) if ($sthArows > 0) { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where user='$VDADuser';"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid',comments='INBOUND' where user='$VDADuser';"; my $affected_rows = $dbhA->do($stmtA); $found_agents=$affected_rows; } @@ -972,7 +972,7 @@ if ($agent_search_method =~ /^SO|^LO/) } else { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid',comments='INBOUND' where status IN('CLOSER','READY') and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; my $affected_rows = $dbhA->do($stmtA); $found_agents=$affected_rows; } @@ -1235,7 +1235,7 @@ if ($agent_search_method =~ /^LO|^LB/) if ($sthArows > 0) { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip' where user='$VDADuser';"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip',comments='INBOUND' where user='$VDADuser';"; my $affected_rows = $dbhA->do($stmtA); $found_agents=$affected_rows; } @@ -1249,7 +1249,7 @@ if ($agent_search_method =~ /^LO|^LB/) } else { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip' where status IN('CLOSER','READY') and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip',comments='INBOUND' where status IN('CLOSER','READY') and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; my $affected_rows = $dbhA->do($stmtA); $found_agents=$affected_rows; } diff --git a/agi/agi-VDAD_ALL_outbound.agi b/agi/agi-VDAD_ALL_outbound.agi index 129ea108..afa04683 100644 --- a/agi/agi-VDAD_ALL_outbound.agi +++ b/agi/agi-VDAD_ALL_outbound.agi @@ -861,7 +861,7 @@ if ($agent_search_method =~ /^SO|^LO/) $sthA->finish(); if ($rec_countWAIT < $concurrent_transfers) { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid' where status = 'READY' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status = 'READY' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} if ($affected_rows > 0) @@ -1013,7 +1013,7 @@ else {$concurrent_transfers = $DBconcurrent_transfers;} $sthA->finish(); if ($rec_countWAITrem < $concurrent_transfers) { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid' where status = 'READY' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status = 'READY' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} if ($affected_rows > 0) diff --git a/bin/AST_CRON_audio_1_move_VDonly.pl b/bin/AST_CRON_audio_1_move_VDonly.pl index 68b00cf9..058a60f1 100644 --- a/bin/AST_CRON_audio_1_move_VDonly.pl +++ b/bin/AST_CRON_audio_1_move_VDonly.pl @@ -148,7 +148,7 @@ $i=0; foreach(@FILES) { $FILEsize1[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize1[$i] = (-s "$dir1/$FILES[$i]"); if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";} @@ -165,7 +165,7 @@ foreach(@FILES) { $FILEsize2[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize2[$i] = (-s "$dir1/$FILES[$i]"); diff --git a/bin/AST_CRON_audio_1_move_mix.pl b/bin/AST_CRON_audio_1_move_mix.pl index 73885dce..cca7e6ce 100644 --- a/bin/AST_CRON_audio_1_move_mix.pl +++ b/bin/AST_CRON_audio_1_move_mix.pl @@ -169,7 +169,7 @@ $i=0; foreach(@FILES) { $FILEsize1[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize1[$i] = (-s "$dir1/$FILES[$i]"); if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";} @@ -186,7 +186,7 @@ foreach(@FILES) { $FILEsize2[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize2[$i] = (-s "$dir1/$FILES[$i]"); diff --git a/bin/AST_CRON_audio_2_compress.pl b/bin/AST_CRON_audio_2_compress.pl index 560e111a..b252b33f 100644 --- a/bin/AST_CRON_audio_2_compress.pl +++ b/bin/AST_CRON_audio_2_compress.pl @@ -205,7 +205,7 @@ $i=0; foreach(@FILES) { $FILEsize1[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize1[$i] = (-s "$dir1/$FILES[$i]"); if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";} @@ -222,7 +222,7 @@ foreach(@FILES) { $FILEsize2[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize2[$i] = (-s "$dir1/$FILES[$i]"); diff --git a/bin/AST_CRON_audio_3_ftp.pl b/bin/AST_CRON_audio_3_ftp.pl index d4d5c753..0318fff2 100644 --- a/bin/AST_CRON_audio_3_ftp.pl +++ b/bin/AST_CRON_audio_3_ftp.pl @@ -202,7 +202,7 @@ $i=0; foreach(@FILES) { $FILEsize1[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize1[$i] = (-s "$dir1/$FILES[$i]"); if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";} @@ -219,7 +219,7 @@ foreach(@FILES) { $FILEsize2[$i] = 0; - if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) { $FILEsize2[$i] = (-s "$dir1/$FILES[$i]"); diff --git a/bin/AST_VDauto_dial.pl b/bin/AST_VDauto_dial.pl index 9cbffe42..c53be6dc 100644 --- a/bin/AST_VDauto_dial.pl +++ b/bin/AST_VDauto_dial.pl @@ -1249,12 +1249,12 @@ while($one_day_interval > 0) $stmtA = "DELETE from vicidial_auto_calls where auto_call_id='$auto_call_id'"; $affected_rows = $dbhA->do($stmtA); - $event_string = "| lagged call vdac call DELETED $affected_rows|$BDtsSQLdate|"; + $event_string = "| lagged call vdac call DELETED $affected_rows|$BDtsSQLdate|$auto_call_id|$CLcallerid|$CLuniqueid|$CLphone_number|$CLstatus|"; &event_logger; if ( ($affected_rows > 0) && ($CLlead_id > 0) ) { - $jam_string = "| lagged call vdac call DELETED $affected_rows|$BDtsSQLdate|"; + $jam_string = "| lagged call vdac call DELETED $affected_rows|$BDtsSQLdate|$auto_call_id|$CLcallerid|$CLuniqueid|$CLphone_number|$CLstatus|"; &jam_event_logger; $CLstage =~ s/LIVE|-//gi; diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 3f177e7b..9c247ce5 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -333,6 +333,7 @@ if (!isset($format)) {$format="text";} if ($format == 'debug') {$DB=1;} if (!isset($ACTION)) {$ACTION="refresh";} +$txt = '.txt'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -1150,6 +1151,7 @@ if ($ACTION == 'manDiaLlogCaLL') $MT[0]=''; $row=''; $rowx=''; $vidSQL=''; + $VDterm_reason=''; if ($stage == "start") { @@ -1210,7 +1212,26 @@ if ($stage == "start") if ($stage == "end") { - if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + ##### get call type from vicidial_live_agents table + $VLA_inOUT='NONE'; + $stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VLA_inOUT_ct = mysql_num_rows($rslt); + if ($VLA_inOUT_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VLA_inOUT = $row[0]; + } + + if ( (strlen($uniqueid)<1) and ($VLA_inOUT == 'INBOUND') ) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND_LOG_0|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$start_epoch|$phone_number|$agent_log_id|\n"); + fclose($fp); + $uniqueid='6666.1'; + } + if ( (strlen($uniqueid)<1) or (strlen($lead_id)<1) ) { echo "LOG NOT ENTERED\n"; echo "uniqueid $uniqueid or lead_id: $lead_id is not valid\n"; @@ -1221,17 +1242,19 @@ if ($stage == "end") $term_reason='NONE'; if ($start_epoch < 1000) { - if ($inOUT == 'IN') + if ($VLA_inOUT == 'INBOUND') { $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); ##### look for the start epoch in the vicidial_closer_log table $stmt="SELECT start_epoch,term_reason,closecallid FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; + $VDIDselect = "VDCL_LID $lead_id $phone_number $user $four_hours_ago"; } else { ##### look for the start epoch in the vicidial_log table $stmt="SELECT start_epoch,term_reason,uniqueid FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -1249,7 +1272,7 @@ if ($stage == "end") $length_in_sec = 0; } - if ( ($length_in_sec < 1) and ($inOUT == 'IN') ) + if ( ($length_in_sec < 1) and ($VLA_inOUT == 'INBOUND') ) { $fp = fopen ("./vicidial_debug.txt", "a"); fwrite ($fp, "$NOW_TIME|INBND_LOG_1|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$start_epoch|\n"); @@ -1277,7 +1300,7 @@ if ($stage == "end") $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); - if ($inOUT == 'IN') + if ($VLA_inOUT == 'INBOUND') { $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} @@ -1521,7 +1544,7 @@ if ($stage == "end") } } - if ($inOUT == 'OUT') + if ($VLA_inOUT == 'AUTO') { $SQLterm = "term_reason='$term_reason',"; @@ -1536,6 +1559,7 @@ if ($stage == "end") $row=mysql_fetch_row($rslt); $VDterm_reason = $row[0]; $VDvicidial_id = $row[1]; + $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } if (ereg("CALLER",$VDterm_reason)) { @@ -1577,6 +1601,7 @@ if ($stage == "end") $row=mysql_fetch_row($rslt); $VDterm_reason = $row[0]; $VDvicidial_id = $row[1]; + $VDIDselect = "VDCL_LID4HOUR $lead_id $four_hours_ago"; } if (ereg("CALLER",$VDterm_reason)) { @@ -1666,13 +1691,13 @@ if ($stage == "end") {$vidSQL = ",vicidial_id='$VDvicidial_id'";} else { - if ( (ereg('.',$vicidial_id)) and ($inOUT == 'IN') ) + if ( (ereg('.',$vicidial_id)) and ($VLA_inOUT == 'INBOUND') ) { if (!ereg('.',$VDvicidial_id)) {$vidSQL = ",vicidial_id='$VDvicidial_id'";} $fp = fopen ("./vicidial_debug.txt", "a"); - fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n"); + fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n"); fclose($fp); } } @@ -1685,6 +1710,10 @@ if ($stage == "end") $rslt=mysql_query($stmt, $link); echo "$recording_id|$length_in_min|"; + + $fp = fopen ("./recording_debug_$NOW_DATE$txt", "a"); + fwrite ($fp, "$NOW_TIME|RECORD_LOG|$filename[$loop_count]|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|$VDIDselect|\n"); + fclose($fp); } else {echo "||";} } @@ -1778,7 +1807,7 @@ if ($ACTION == 'VDADcheckINCOMING') else { ### grab the call and lead info from the vicidial_live_agents table - $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip,comments FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $queue_leadID_ct = mysql_num_rows($rslt); @@ -1791,6 +1820,8 @@ if ($ACTION == 'VDADcheckINCOMING') $callerid =$row[2]; $channel =$row[3]; $call_server_ip =$row[4]; + $VLAcomments=$row[5]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; @@ -1809,7 +1840,7 @@ if ($ACTION == 'VDADcheckINCOMING') $calls_today++; ### update the agent status to INCALL in vicidial_live_agents - $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 5eee9eac..75cef539 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -3522,6 +3522,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // Send the Manual Dial Next Number request function ManualDialNext(mdnCBid,mdnBDleadid,mdnDiaLCodE,mdnPhonENumbeR,mdnStagE) { + inOUT = 'OUT'; all_record = 'NO'; all_record_count=0; document.getElementById("DiaLControl").innerHTML = "\"Dial"; @@ -3879,6 +3880,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // Send the Manual Dial Only - dial the previewed lead function ManualDialOnly(taskaltnum) { + inOUT = 'OUT'; alt_dial_status_display = 0; all_record = 'NO'; all_record_count=0; @@ -4131,7 +4133,6 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (typeof(xmlhttprequestcheckauto) == "undefined") { - inOUT = 'OUT'; all_record = 'NO'; all_record_count=0; document.vicidial_form.lead_id.value = ''; @@ -5085,7 +5086,6 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // Update vicidial_list lead record with disposition selection function DispoSelect_submit() { - inOUT = 'OUT'; var DispoChoice = document.vicidial_form.DispoSelection.value; if (DispoChoice.length < 1) {alert("You Must Select a Disposition");} @@ -5171,6 +5171,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.vicidial_form.called_count.value =''; VDCL_group_id = ''; fronter = ''; + inOUT = 'OUT'; if (manual_dial_in_progress==1) { diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php index 664d5c9e..18093bc9 100644 --- a/www/vicidial/AST_CLOSERstats.php +++ b/www/vicidial/AST_CLOSERstats.php @@ -253,7 +253,7 @@ while ($p < $statuses_to_print) $q++; $p++; } -$stmt = "SELECT status,status_name,human_answered,category from vicidial_campaign_statuses';"; +$stmt = "SELECT status,status_name,human_answered,category from vicidial_campaign_statuses;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $statuses_to_print = mysql_num_rows($rslt);