Added BETA support for Asterisk 1.8 with vicidial. To download a version of Asterisk 1.8, go to:
http://downloads.vicidial.com/beta-apps/ git-svn-id: svn://192.168.202.10@1917 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# agi-NVA_recording.agi version 2.4
|
||||
# agi-NVA_recording.agi version 2.6
|
||||
#
|
||||
# This script is designed to give recording ability to agents not the using
|
||||
# ViciDial agent screen
|
||||
@@ -23,11 +23,13 @@
|
||||
#exten => 5678,n,Hangup
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 91105-1402 - First build
|
||||
# 100123-1434 - Added double-log option for CallMenu forwarded calls
|
||||
# 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible
|
||||
# 130108-1811 - Changes for Asterisk 1.8 compatibility
|
||||
#
|
||||
|
||||
&get_time_now;
|
||||
@@ -93,6 +95,25 @@ $AGI = new Asterisk::AGI;
|
||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
### Grab Server values from the database
|
||||
$stmtA = "SELECT agi_output,ext_context,asterisk_version FROM servers where server_ip = '$VARserver_ip';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
$AGILOG = '0';
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$DBagi_output = $aryA[0];
|
||||
$ext_context = $aryA[1];
|
||||
$asterisk_version = $aryA[2];
|
||||
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
|
||||
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
|
||||
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -165,7 +186,15 @@ if ($record_call =~ /Y/)
|
||||
$filename =~ s/\"|\'//gi;
|
||||
### code to record call goes here ###
|
||||
|
||||
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$filename");
|
||||
%ast_ver_str = parse_asterisk_version($asterisk_version);
|
||||
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
|
||||
{
|
||||
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$filename");
|
||||
}
|
||||
else
|
||||
{
|
||||
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$filename");
|
||||
}
|
||||
|
||||
### insert record into recording_log table ###
|
||||
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$extension','$now_date','$start_epoch','0','$filename','0','$accountcode','$filename','$unique_id');";
|
||||
@@ -233,3 +262,46 @@ sub agi_output
|
||||
{print STDERR "$now_date|$script|$agi_string\n";}
|
||||
$agi_string='';
|
||||
}
|
||||
|
||||
# subroutine to parse the asterisk version
|
||||
# and return a hash with the various part
|
||||
sub parse_asterisk_version
|
||||
{
|
||||
# grab the arguments
|
||||
my $ast_ver_str = $_[0];
|
||||
|
||||
# get everything after the - and put it in $ast_ver_postfix
|
||||
my @hyphen_parts = split( /-/ , $ast_ver_str );
|
||||
|
||||
my $ast_ver_postfix = $hyphen_parts[1];
|
||||
|
||||
# now split everything before the - up by the .
|
||||
my @dot_parts = split( /\./ , $hyphen_parts[0] );
|
||||
|
||||
my %ast_ver_hash;
|
||||
|
||||
if ( $dot_parts[0] <= 1 )
|
||||
{
|
||||
%ast_ver_hash = (
|
||||
"major" => $dot_parts[0],
|
||||
"minor" => $dot_parts[1],
|
||||
"build" => $dot_parts[2],
|
||||
"revision" => $dot_parts[3],
|
||||
"postfix" => $ast_ver_postfix
|
||||
);
|
||||
}
|
||||
|
||||
# digium dropped the 1 from asterisk 10 but we still need it
|
||||
if ( $dot_parts[0] > 1 )
|
||||
{
|
||||
%ast_ver_hash = (
|
||||
"major" => 1,
|
||||
"minor" => $dot_parts[0],
|
||||
"build" => $dot_parts[1],
|
||||
"revision" => $dot_parts[2],
|
||||
"postfix" => $ast_ver_postfix
|
||||
);
|
||||
}
|
||||
|
||||
return ( %ast_ver_hash );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user