Fix for recordings beginning with CALLID

more updates for Asterisk 13 compatibility

git-svn-id: svn://192.168.202.10@2819 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2017-09-22 02:17:39 +00:00
parent 8b020f1f87
commit 6b106ba49a
9 changed files with 99 additions and 43 deletions
+3 -1
View File
@@ -215,6 +215,7 @@
# 170816-2245 - Added ask survey options
# 170903-0929 - Added additional xfer_log details
# 170914-1634 - Added Asterisk 13 compatibility
# 170921-2008 - Fix for CALLID in beginning of recording filename
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -2999,7 +3000,8 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$dbhP=$dbhA; $mysql_count='02214'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02215'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
+7 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-VDAD_ALL_outbound.agi version 2.12
# agi-VDAD_ALL_outbound.agi version 2.14
#
# runs when an outbound call is answered. This script will
# send the calls out to the agents that are logged in.
@@ -46,7 +46,7 @@
#exten => 8366,4,AGI(agi-VDAD_ALL_outbound.agi,SURVEY-----LB-----US_pol_survey_hello-----1238-----8-----US_pol_survey_transfer-----US_thanks_no_contact-----OPTOUT-----DNC)
#exten => 8366,5,Hangup
#
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80218-2027 - First Build
@@ -116,6 +116,7 @@
# 160101-1528 - Added routing_initiated_recordings
# 161102-1037 - Fixed QM partition problem
# 161201-1003 - Fixed LRERR logging issue
# 170921-2007 - Fix for CALLID in beginning of recording filename
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -2691,7 +2692,8 @@ while ($drop_timer <= $DROP_TIME)
$dbhP=$dbhA; $mysql_count='02125'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02126'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
@@ -3405,7 +3407,8 @@ while ($drop_timer <= $DROP_TIME)
$dbhP=$dbhA; $mysql_count='02133'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02134'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-VDAD_ALL_outboundBETA.agi version 2.12
# agi-VDAD_ALL_outboundBETA.agi version 2.14
#
# runs when an outbound call is answered. This script will
# send the calls out to the agents that are logged in.
@@ -46,7 +46,7 @@
#exten => 8366,4,AGI(agi-VDAD_ALL_outbound.agi,SURVEY-----LB-----US_pol_survey_hello-----1238-----8-----US_pol_survey_transfer-----US_thanks_no_contact-----OPTOUT-----DNC)
#exten => 8366,5,Hangup
#
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80218-2027 - First Build
@@ -117,6 +117,7 @@
# 161102-1037 - Fixed QM partition problem
# 161115-1359 - Forked to BETA script, added vdad_debug_logging option
# 161201-1003 - Fixed LRERR logging issue
# 170921-2007 - Fix for CALLID in beginning of recording filename
#
$script = 'agi-VDAD_ALL_outboundBETA.agi';
@@ -2799,7 +2800,8 @@ while ($drop_timer <= $DROP_TIME)
$dbhP=$dbhA; $mysql_count='02135'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02136'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
@@ -3522,7 +3524,8 @@ while ($drop_timer <= $DROP_TIME)
$dbhP=$dbhA; $mysql_count='02144'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02145'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-VDAD_ALL_outboundBETA2.agi version 2.12
# agi-VDAD_ALL_outboundBETA2.agi version 2.14
#
# runs when an outbound call is answered. This script will
# send the calls out to the agents that are logged in.
@@ -46,7 +46,7 @@
#exten => 8366,4,AGI(agi-VDAD_ALL_outbound.agi,SURVEY-----LB-----US_pol_survey_hello-----1238-----8-----US_pol_survey_transfer-----US_thanks_no_contact-----OPTOUT-----DNC)
#exten => 8366,5,Hangup
#
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80218-2027 - First Build
@@ -118,6 +118,7 @@
# 161115-1359 - Forked to BETA script, added vdad_debug_logging option
# 161201-1003 - Fixed LRERR logging issue
# 161201-1030 - EXPERIMENTAL REMOVED MANY FEATURES TO TEST INTERPRETATION TIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# 170921-2007 - Fix for CALLID in beginning of recording filename
#
$script = 'agi-VDAD_ALL_outboundBETA2.agi';
@@ -2122,7 +2123,8 @@ while ($drop_timer <= $DROP_TIME)
$dbhP=$dbhA; $mysql_count='02144'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02145'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
+3 -3
View File
@@ -217,7 +217,7 @@ if (length($ARGV[0])>1)
print " [-adfill-delay=X] = setting delay seconds on auto-dial FILL process\n";
print " [-fill-staggered] = enable experimental staggered auto-dial FILL process\n";
print " [-cu3way] = keepalive for the optional 3way conference checker\n";
print " [-lstn-buffer] = use special enhanced telnet buffer listen process\n";
print " [-lstn-buffer] = use special enhanced telnet buffer listen process(depricated)\n";
print " [-cu3way-delay=X] = setting delay seconds on 3way conference checker\n";
print " [-debug] = verbose debug messages\n";
print " [-debugX] = Extra-verbose debug messages\n";
@@ -294,8 +294,8 @@ if (length($ARGV[0])>1)
}
if ($args =~ /-lstn-buffer/i)
{
$lstn_buffer=1;
if ($DB > 0) {print "\n----- lstn_buffer ENABLED -----\n\n";}
# $lstn_buffer=1;
if ($DB > 0) {print "\n----- lstn_buffer ENABLED (depricated) -----\n\n";}
}
if ($args =~ /-cu3way-delay=/i) # CLI defined delay
{
+61 -22
View File
@@ -18,7 +18,7 @@
# 130108-1707 - Changes for Asterisk 1.8 compatibility
# 160608-1549 - Added support for AMI version 1.3
# 170222-0939 - Changed to file logging using server settings
#
# 170921-1814 - Added support for AMI2
# constants
$DB=0; # Debug flag
@@ -240,7 +240,7 @@ while ($loops > $loop_counter)
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$event_string = "$loop_counter|$sthArows|$stmtA";
&event_logger;
&event_logger;
$rec_count=0;
while ($sthArows > $rec_count)
{
@@ -255,35 +255,74 @@ while ($loops > $loop_counter)
if ($rec_count > 0)
{
$max_buffer = 4*1024*1024; # 4 meg buffer
### connect to asterisk manager through telnet
$t = new Net::Telnet (Port => $telnet_port,
Prompt => '/.*[\$%#>] $/',
Output_record_separator => '',);
#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log
$t = new Net::Telnet (
Port => $telnet_port,
Prompt => '/\r\n/',
Output_record_separator => "\n\n",
Max_buffer_length => $max_buffer,
Telnetmode => 0,
);
$LItelnetlog = "$PATHlogs/3way_telnet_log.txt"; # uncomment for telnet log
# $fh = $t->dump_log("$LItelnetlog"); # uncomment for telnet log
if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;}
else {$telnet_login = $ASTmgrUSERNAME;}
$t->open("$telnet_host");
$t->waitfor('/Asterisk Call Manager\//');
$t->open("$telnet_host");
$t->waitfor('/[0123]\n$/'); # print login
$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n");
$t->waitfor('/Authentication accepted/'); # waitfor auth accepted
# get the AMI version number
$ami_version = $t->getline(Errmode => Return, Timeout => 1,);
$ami_version =~ s/\n//gi;
if ($DB) {print "----- AMI Version $ami_version -----\n";}
$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET");
$t->waitfor('/Authentication accepted/'); # waitfor auth accepted
$t->buffer_empty;
$i=0;
foreach(@PTextensions)
{
@list_channels=@MT;
$t->buffer_empty;
$COMMAND = "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n";
$event_string = "|$PT_conf_extens[$i]|$COMMAND|";
&event_logger;
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/');
}
else
{
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Success\nPing: Pong.*/');
}
if ($ami_version =~ /^1\./i)
{
$COMMAND = "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n";
$event_string = "|$PT_conf_extens[$i]|$COMMAND|";
&event_logger;
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/');
}
else
{
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Success\nPing: Pong.*/');
}
}
elsif ($ami_version =~ /^2\./i)
{
# get the current time
( $now_sec, $now_micro_sec ) = gettimeofday();
# figure out how many micro seconds since epoch
$now_micro_epoch = $now_sec * 1000000;
$now_micro_epoch = $now_micro_epoch + $now_micro_sec;
$begin_micro_epoch = $now_micro_epoch;
# create a new action id
$action_id = "$now_sec.$now_micro_sec";
$COMMAND = "Action: Command\nActionID:$action_id\nCommand: Meetme list $PT_conf_extens[$i]";
$event_string = "|$PT_conf_extens[$i]|$COMMAND|";
&event_logger;
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/--END COMMAND--\n\n/');
}
$j=0;
$conf_empty[$i]=0;
+5 -2
View File
@@ -46,8 +46,10 @@
# 141219-1137 - Change to keepalive processes to not run at busy times and not drop buffer
# 150610-1200 - Added support for AMI version 1.3
# 150709-1506 - Added DTMF logging for Asterisk 1.8 and higher
# 151031-0651 - Added perl telnet buffer options, requires newer versions of Net::Telnet CPAN module
# 151031-0918 - Added better capture of errors in telnet connection, other small fixes
# 170920-1416 - Fix for issue with recordings beginning with CALLID variable
# 170920-1417 - Fix for issue with recordings beginning with CALLID variable
# 170921-2209 - Merged code from AST_manager_listenBUFFER.pl script
#
# constants
@@ -225,7 +227,8 @@ while($one_day_interval > 0)
### connect to asterisk manager through telnet
$tn = new Net::Telnet (Port => $telnet_port,
Prompt => '/.*[\$%#>] $/',
Output_record_separator => '',);
Output_record_separator => '',
Max_buffer_length => 4*1024*1024, );
# $LItelnetlog = "$PATHlogs/listen_telnet_log.txt"; # uncomment for telnet log
# $fh = $tn->dump_log("$LItelnetlog"); # uncomment for telnet log
if (length($ASTmgrUSERNAMElisten) > 3) {$telnet_login = $ASTmgrUSERNAMElisten;}
@@ -48,6 +48,7 @@
# 150709-1506 - Added DTMF logging for Asterisk 1.8 and higher
# 151031-0651 - Added perl telnet buffer options, requires newer versions of Net::Telnet CPAN module
# 170920-1417 - Fix for issue with recordings beginning with CALLID variable
# 170921-2208 - DEPRICATED, CODE MERGED TO AST_manager_listen.pl
#
# constants
+7 -4
View File
@@ -138,10 +138,11 @@
# 170513-1616 - Added more debugging output
# 170526-2241 - Added additional variable filtering
# 170528-0850 - Fix for rare inbound logging issue #1017, Added additional variable filtering
# 170921-2009 - Fix for CALLID in beginning of recording filename
#
$version = '2.14-85';
$build = '170528-0850';
$version = '2.14-86';
$build = '170921-2009';
$php_script = 'manager_send.php';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=142;
@@ -2375,14 +2376,16 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") )
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02134',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
$vmgr_callerid = substr($filename, 0, 17) . '...';
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$vmgr_callerid','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02135',$user,$server_ip,$session_name,$one_mysql_log);}
}
else
{
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
$vmgr_callerid = substr($filename, 0, 17) . '...';
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$vmgr_callerid','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02072',$user,$server_ip,$session_name,$one_mysql_log);}