bug fix for all audio handling scripts

logging fix for ALL_inbound/_outbound and vdc_db_query.php scripts for specific situations on blended call handling systems

git-svn-id: svn://192.168.202.10@931 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-08-04 23:14:42 +00:00
parent c17292ae7e
commit cbaf2010a2
10 changed files with 60 additions and 28 deletions
+4 -4
View File
@@ -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;
}
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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]");
+2 -2
View File
@@ -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]");
+2 -2
View File
@@ -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]");
+2 -2
View File
@@ -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]");
+2 -2
View File
@@ -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;
+40 -9
View File
@@ -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);
+3 -2
View File
@@ -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 = "<IMG SRC=\"./images/vdc_LB_dialnextnumber_OFF.gif\" border=0 alt=\"Dial Next Number\">";
@@ -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)
{
+1 -1
View File
@@ -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);