logging fixes for LAGGED calls and vicidial_agent_log entries

Added human-readable manual dial hangup causes

git-svn-id: svn://192.168.202.10@1391 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-04-01 02:19:57 +00:00
parent 4e6a017c6c
commit 409a377664
8 changed files with 186 additions and 20 deletions
@@ -1770,7 +1770,7 @@ while($one_day_interval > 0)
if ($toPAUSEcount > 0)
{
$stmtA = "SELECT agent_log_id,user,server_ip,campaign_id,user_group from vicidial_live_agents where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED');";
$stmtA = "SELECT agent_log_id,user,server_ip,campaign_id from vicidial_live_agents where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsL=$sthA->rows;
@@ -1782,7 +1782,6 @@ while($one_day_interval > 0)
$LAGuser[$lagged_ids] = $aryA[1];
$LAGserver_ip[$lagged_ids] = $aryA[2];
$LAGcampaign_id[$lagged_ids] = $aryA[3];
$LAGuser_group[$lagged_ids] = $aryA[4];
$lagged_ids++;
}
$sthA->finish();
@@ -1793,6 +1792,17 @@ while($one_day_interval > 0)
$stmtA = "UPDATE vicidial_agent_log set sub_status='LAGGED' where agent_log_id='$LAGagent_log_id[$lagged_ids]';";
$VLaffected_rows = $dbhA->do($stmtA);
$stmtA = "SELECT user_group from vicidial_users where user='$server_ip' limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsLU=$sthA->rows;
if ($sthArowsLU > 0)
{
@aryA = $sthA->fetchrow_array;
$LAGuser_group[$lagged_ids] = $aryA[0];
}
$sthA->finish();
$stmtA = "INSERT INTO vicidial_agent_log set event_time='$now_date',server_ip='$LAGserver_ip[$lagged_ids]',campaign_id='$LAGcampaign_id[$lagged_ids]',user_group='$LAGuser_group[$lagged_ids]',user='$LAGuser[$lagged_ids]',pause_epoch='$secX',pause_sec='0',wait_epoch='$secX';";
$VLaffected_rows = $dbhA->do($stmtA);
@@ -810,6 +810,8 @@ while ($h < $i)
if($DBX){print STDERR "\n|$stmtA|\n";}
if ($TEST < 1) {$affected_rows = $dbhA->do($stmtA); }
$h++;
$event_string = "VAL UPDATE PAUSESEC: $h|$pause_epoch[$h]|$wait_epoch[$h]|$affected_rows|$stmtA|";
&event_logger;
}
if ($DB) {print STDERR " Pause times fixed: $h\n";}
@@ -853,6 +855,8 @@ while ($h < $i)
if($DBX){print STDERR "\n|$stmtA|\n";}
if ($TEST < 1) {$affected_rows = $dbhA->do($stmtA); }
$h++;
$event_string = "VAL UPDATE WAITSEC: $h|$wait_epoch[$h]|$wait_epoch[$h]|$affected_rows|$stmtA|";
&event_logger;
}
if ($DB) {print STDERR " Wait times fixed: $h\n";}
@@ -896,6 +900,8 @@ while ($h < $i)
if($DBX){print STDERR "|$stmtA|\n";}
if ($TEST < 1) {$affected_rows = $dbhA->do($stmtA); }
$h++;
$event_string = "VAL UPDATE TALKSEC: $h|$talk_epoch[$h]|$dispo_epoch[$h]|$affected_rows|$stmtA|";
&event_logger;
}
if ($DB) {print STDERR " Talk times fixed: $h\n";}
@@ -1160,6 +1166,8 @@ if ( ($skip_agent_log_validation < 1) && ($VAL_validate > 0) )
{
$affected_rows = $dbhA->do($stmtA);
}
$event_string = "VAL UPDATE: $r|$i|$Vuser[$i]|$Vevent_time[$r]|$affected_rows|$corrections_LOG|$stmtA|";
&event_logger;
}
$total_scanned_records++;
@@ -435,6 +435,61 @@ $MT[0]='';
$agents='@agents';
$US='_';
##### Hangup Cause Dictionary #####
$hangup_cause_dictionary = array(
0 => "Unspecified. No other cause codes applicable.",
1 => "Unallocated (unassigned) number.",
2 => "No route to specified transit network (national use).",
3 => "No route to destination.",
6 => "Channel unacceptable.",
7 => "Call awarded, being delivered in an established channel.",
16 => "Normal call clearing.",
17 => "User busy.",
18 => "No user responding.",
19 => "No answer from user (user alerted).",
20 => "Subscriber absent.",
21 => "Call rejected.",
22 => "Number changed.",
23 => "Redirection to new destination.",
25 => "Exchange routing error.",
27 => "Destination out of order.",
28 => "Invalid number format (address incomplete).",
29 => "Facilities rejected.",
30 => "Response to STATUS INQUIRY.",
31 => "Normal, unspecified.",
34 => "No circuit/channel available.",
38 => "Network out of order.",
41 => "Temporary failure.",
42 => "Switching equipment congestion.",
43 => "Access information discarded.",
44 => "Requested circuit/channel not available.",
50 => "Requested facility not subscribed.",
52 => "Outgoing calls barred.",
54 => "Incoming calls barred.",
57 => "Bearer capability not authorized.",
58 => "Bearer capability not presently available.",
63 => "Service or option not available, unspecified.",
65 => "Bearer capability not implemented.",
66 => "Channel type not implemented.",
69 => "Requested facility not implemented.",
79 => "Service or option not implemented, unspecified.",
81 => "Invalid call reference value.",
88 => "Incompatible destination.",
95 => "Invalid message, unspecified.",
96 => "Mandatory information element is missing.",
97 => "Message type non-existent or not implemented.",
98 => "Message not compatible with call state or message type non-existent or not implemented.",
99 => "Information element / parameter non-existent or not implemented.",
100 => "Invalid information element contents.",
101 => "Message not compatible with call state.",
102 => "Recovery on timer expiry.",
103 => "Parameter non-existent or not implemented - passed on (national use).",
111 => "Protocol error, unspecified.",
127 => "Interworking, unspecified."
);
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
@@ -2433,9 +2488,10 @@ if ($ACTION == 'manDiaLlookCaLL')
$dialstatus =$row[0];
$hangup_cause =$row[1];
$channel = $dialstatus . "-" . $hangup_cause;
$channel = $dialstatus;
$hangup_cause_msg = "Cause: " . $hangup_cause . " - " . hangup_cause_description($hangup_cause);
$call_output = "$uniqueid\n$channel\nERROR";
$call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg;
$call_good++;
### Delete call record
@@ -6717,7 +6773,13 @@ echo "\n</body>\n</html>\n";
exit;
##### Hangup Cause Description Map #####
function hangup_cause_description($code)
{
global $hangup_cause_dictionary;
if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; }
else { return "Unidentified Hangup Cause Code."; }
}
##### MySQL Error Logging #####
@@ -4607,7 +4607,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if (XDalert == 'ERROR')
{
var DiaLAlerTMessagE = "Call Rejected: " + XDchannel;
var XDerrorDesc = MDlookResponse_array[3];
var DiaLAlerTMessagE = "Call Rejected: " + XDchannel + "\n" + XDerrorDesc;
TimerActionRun("DiaLAlerT",DiaLAlerTMessagE);
}
if ( (XDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') && (MD_ring_secondS < 10) )
@@ -4650,7 +4651,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if (MDalert == 'ERROR')
{
var DiaLAlerTMessagE = "Call Rejected: " + MDchannel;
var MDerrorDesc = MDlookResponse_array[3];
var DiaLAlerTMessagE = "Call Rejected: " + MDchannel + "\n" + MDerrorDesc;
TimerActionRun("DiaLAlerT",DiaLAlerTMessagE);
}
if ( (MDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') )
@@ -9720,7 +9722,7 @@ else
{
if (taskaction == 'DiaLAlerT')
{
document.getElementById("TimerContentSpan").innerHTML = "<b>DIAL ALERT:<BR><BR>" + taskdialalert + "</b>";
document.getElementById("TimerContentSpan").innerHTML = "<b>DIAL ALERT:<BR><BR>" + taskdialalert.replace("\n","<BR>") + "</b>";
showDiv('TimerSpan');
}
+12 -2
View File
@@ -1784,7 +1784,7 @@ while($one_day_interval > 0)
if ($toPAUSEcount > 0)
{
$stmtA = "SELECT agent_log_id,user,server_ip,campaign_id,user_group from vicidial_live_agents where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED');";
$stmtA = "SELECT agent_log_id,user,server_ip,campaign_id from vicidial_live_agents where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsL=$sthA->rows;
@@ -1796,7 +1796,6 @@ while($one_day_interval > 0)
$LAGuser[$lagged_ids] = $aryA[1];
$LAGserver_ip[$lagged_ids] = $aryA[2];
$LAGcampaign_id[$lagged_ids] = $aryA[3];
$LAGuser_group[$lagged_ids] = $aryA[4];
$lagged_ids++;
}
$sthA->finish();
@@ -1807,6 +1806,17 @@ while($one_day_interval > 0)
$stmtA = "UPDATE vicidial_agent_log set sub_status='LAGGED' where agent_log_id='$LAGagent_log_id[$lagged_ids]';";
$VLaffected_rows = $dbhA->do($stmtA);
$stmtA = "SELECT user_group from vicidial_users where user='$server_ip' limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsLU=$sthA->rows;
if ($sthArowsLU > 0)
{
@aryA = $sthA->fetchrow_array;
$LAGuser_group[$lagged_ids] = $aryA[0];
}
$sthA->finish();
$stmtA = "INSERT INTO vicidial_agent_log set event_time='$now_date',server_ip='$LAGserver_ip[$lagged_ids]',campaign_id='$LAGcampaign_id[$lagged_ids]',user_group='$LAGuser_group[$lagged_ids]',user='$LAGuser[$lagged_ids]',pause_epoch='$secX',pause_sec='0',wait_epoch='$secX';";
$VLaffected_rows = $dbhA->do($stmtA);
@@ -812,6 +812,8 @@ while ($h < $i)
if($DBX){print STDERR "\n|$stmtA|\n";}
if ($TEST < 1) {$affected_rows = $dbhA->do($stmtA); }
$h++;
$event_string = "VAL UPDATE PAUSESEC: $h|$pause_epoch[$h]|$wait_epoch[$h]|$affected_rows|$stmtA|";
&event_logger;
}
if ($DB) {print STDERR " Pause times fixed: $h\n";}
@@ -855,6 +857,8 @@ while ($h < $i)
if($DBX){print STDERR "\n|$stmtA|\n";}
if ($TEST < 1) {$affected_rows = $dbhA->do($stmtA); }
$h++;
$event_string = "VAL UPDATE WAITSEC: $h|$wait_epoch[$h]|$wait_epoch[$h]|$affected_rows|$stmtA|";
&event_logger;
}
if ($DB) {print STDERR " Wait times fixed: $h\n";}
@@ -898,6 +902,8 @@ while ($h < $i)
if($DBX){print STDERR "|$stmtA|\n";}
if ($TEST < 1) {$affected_rows = $dbhA->do($stmtA); }
$h++;
$event_string = "VAL UPDATE TALKSEC: $h|$talk_epoch[$h]|$dispo_epoch[$h]|$affected_rows|$stmtA|";
&event_logger;
}
if ($DB) {print STDERR " Talk times fixed: $h\n";}
@@ -1162,6 +1168,8 @@ if ( ($skip_agent_log_validation < 1) && ($VAL_validate > 0) )
{
$affected_rows = $dbhA->do($stmtA);
}
$event_string = "VAL UPDATE: $r|$i|$Vuser[$i]|$Vevent_time[$r]|$affected_rows|$corrections_LOG|$stmtA|";
&event_logger;
}
$total_scanned_records++;
+68 -5
View File
@@ -241,10 +241,11 @@
# 100301-1342 - Changed Available agents output for AGENTDIRECT selection
# 100309-0535 - Added queuemetrics_loginout option
# 100311-1559 - Added callcard logging to startcallurl and dispourl functions
# 100331-1217 - Added human-readable hangup codes for manual dial
#
$version = '2.4-148';
$build = '100311-1559';
$version = '2.4-149';
$build = '100331-1217';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=321;
$one_mysql_log=0;
@@ -444,6 +445,61 @@ $MT[0]='';
$agents='@agents';
$US='_';
##### Hangup Cause Dictionary #####
$hangup_cause_dictionary = array(
0 => "Unspecified. No other cause codes applicable.",
1 => "Unallocated (unassigned) number.",
2 => "No route to specified transit network (national use).",
3 => "No route to destination.",
6 => "Channel unacceptable.",
7 => "Call awarded, being delivered in an established channel.",
16 => "Normal call clearing.",
17 => "User busy.",
18 => "No user responding.",
19 => "No answer from user (user alerted).",
20 => "Subscriber absent.",
21 => "Call rejected.",
22 => "Number changed.",
23 => "Redirection to new destination.",
25 => "Exchange routing error.",
27 => "Destination out of order.",
28 => "Invalid number format (address incomplete).",
29 => "Facilities rejected.",
30 => "Response to STATUS INQUIRY.",
31 => "Normal, unspecified.",
34 => "No circuit/channel available.",
38 => "Network out of order.",
41 => "Temporary failure.",
42 => "Switching equipment congestion.",
43 => "Access information discarded.",
44 => "Requested circuit/channel not available.",
50 => "Requested facility not subscribed.",
52 => "Outgoing calls barred.",
54 => "Incoming calls barred.",
57 => "Bearer capability not authorized.",
58 => "Bearer capability not presently available.",
63 => "Service or option not available, unspecified.",
65 => "Bearer capability not implemented.",
66 => "Channel type not implemented.",
69 => "Requested facility not implemented.",
79 => "Service or option not implemented, unspecified.",
81 => "Invalid call reference value.",
88 => "Incompatible destination.",
95 => "Invalid message, unspecified.",
96 => "Mandatory information element is missing.",
97 => "Message type non-existent or not implemented.",
98 => "Message not compatible with call state or message type non-existent or not implemented.",
99 => "Information element / parameter non-existent or not implemented.",
100 => "Invalid information element contents.",
101 => "Message not compatible with call state.",
102 => "Recovery on timer expiry.",
103 => "Parameter non-existent or not implemented - passed on (national use).",
111 => "Protocol error, unspecified.",
127 => "Interworking, unspecified."
);
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
@@ -2478,9 +2534,10 @@ if ($ACTION == 'manDiaLlookCaLL')
$dialstatus =$row[0];
$hangup_cause =$row[1];
$channel = $dialstatus . "-" . $hangup_cause;
$channel = $dialstatus;
$hangup_cause_msg = "Cause: " . $hangup_cause . " - " . hangup_cause_description($hangup_cause);
$call_output = "$uniqueid\n$channel\nERROR";
$call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg;
$call_good++;
### Delete call record
@@ -7196,7 +7253,13 @@ echo "\n</body>\n</html>\n";
exit;
##### Hangup Cause Description Map #####
function hangup_cause_description($code)
{
global $hangup_cause_dictionary;
if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; }
else { return "Unidentified Hangup Cause Code."; }
}
##### MySQL Error Logging #####
+8 -5
View File
@@ -286,10 +286,11 @@
# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number
# 100317-1301 - Added agent_fullscreen User Group option
# 100327-0901 - fix for manual dial answering machine message
# 100331-1220 - Added human-readable hangup codes for manual dial
#
$version = '2.4-264';
$build = '100327-0901';
$version = '2.4-265';
$build = '100331-1220';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=64;
$one_mysql_log=0;
@@ -4750,7 +4751,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if (XDalert == 'ERROR')
{
var DiaLAlerTMessagE = "Call Rejected: " + XDchannel;
var XDerrorDesc = MDlookResponse_array[3];
var DiaLAlerTMessagE = "Call Rejected: " + XDchannel + "\n" + XDerrorDesc;
TimerActionRun("DiaLAlerT",DiaLAlerTMessagE);
}
if ( (XDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') && (MD_ring_secondS < 10) )
@@ -4793,7 +4795,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if (MDalert == 'ERROR')
{
var DiaLAlerTMessagE = "Call Rejected: " + MDchannel;
var MDerrorDesc = MDlookResponse_array[3];
var DiaLAlerTMessagE = "Call Rejected: " + MDchannel + "\n" + MDerrorDesc;
TimerActionRun("DiaLAlerT",DiaLAlerTMessagE);
}
if ( (MDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') )
@@ -9976,7 +9979,7 @@ else
{
if (taskaction == 'DiaLAlerT')
{
document.getElementById("TimerContentSpan").innerHTML = "<b>DIAL ALERT:<BR><BR>" + taskdialalert + "</b>";
document.getElementById("TimerContentSpan").innerHTML = "<b>DIAL ALERT:<BR><BR>" + taskdialalert.replace("\n","<BR>") + "</b>";
showDiv('TimerSpan');
}