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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user