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:
mattf
2013-01-20 17:41:26 +00:00
parent 383436fcc9
commit 666a583b24
38 changed files with 3078 additions and 994 deletions
+9
View File
@@ -153,6 +153,15 @@ OTHER CHANGES:
### inbound email parser
* * * * * /usr/share/astguiclient/AST_inbound_email_parser.pl
33. Added Asterisk 1.8 support. This is in the BETA testing phase currently,
and is not recommended for use in production at this time. If you are
upgrading an existing system, please make note of the many conf file
changes(extensions.conf and manager.conf) that will need to be made for
Vicidial to function properly while interfacing with Asterisk 1.8. Also,
make sure that the Admin -> Servers -> modify server "Asterisk Version"
setting is set properly for the version you have installed on that
server.
+8 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# VDL_CID_lookup.agi version 0.1 *DBI-version*
# VDL_CID_lookup.agi version 2.6
#
# runs after a call goes through AMD in extensions.conf to send the call on to
# it's proper destination
@@ -19,11 +19,12 @@
# exten => 8369,9,Hangup
#
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# changes:
# 80930-0226 - first build
# 81015-1702 - added filter stats
# 130108-1836 - Changes for Asterisk 1.8 compatibility
#
$filter_stats = 1;
@@ -235,6 +236,7 @@ if ($filter_stats > 0)
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|NOT_FOUND|"; &agi_output;}
print "SET PRIORITY $priority\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -263,6 +265,7 @@ if ($filter_stats > 0)
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|EXISTING|SALE|"; &agi_output;}
print "SET PRIORITY $priority\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -290,6 +293,7 @@ if ($filter_stats > 0)
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|EXISTING|DNC|"; &agi_output;}
print "SET PRIORITY $priority\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -317,6 +321,7 @@ if ($filter_stats > 0)
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|EXISTING|ARCHIVE|"; &agi_output;}
print "SET PRIORITY $priority\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -353,6 +358,7 @@ else
$priority = ($priority + 3);
if ($AGILOG) {$agi_string = "-- cid_lookup finish: |$priority|$callerid"; &agi_output;}
print "SET PRIORITY $priority\n";
$result = <STDIN>;
checkresult($result);
}
+58 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# VD_amd.agi version 2.4
# VD_amd.agi version 2.6
#
# runs after a call goes through AMD in extensions.conf to send the call on to
# it's proper destination, or when agent sends to VM message
@@ -21,7 +21,7 @@
# exten => _8320*.,1,AGI(VD_amd.agi,${EXTEN}-----YES)
# exten => _8320*.,2,Hangup
#
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 60206-1434 - first build
@@ -42,6 +42,8 @@
# 110324-2334 - Logging changes made
# 110812-1515 - Added static tts file parsing and replacement
# 110926-1902 - Added extended logging and additional waitforsilence options
# 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible
# 130108-1808 - Changes for Asterisk 1.8 compatibility
#
$script = 'VD_amd.agi';
@@ -113,7 +115,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';";
$stmtA = "SELECT agi_output,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;
@@ -122,6 +124,7 @@ if ($sthArows > 0)
$AGILOG = '0';
@aryA = $sthA->fetchrow_array;
$DBagi_output = $aryA[0];
$asterisk_version = $aryA[1];
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
@@ -515,7 +518,15 @@ else
$campaign_rec_filename =~ s/\"|\'//gi;
$campaign_rec_filename =~ s/ //gi;
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_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/$campaign_rec_filename");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_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','$VD_phone_number','$now_date','$now_date_epoch','0','$campaign_rec_filename','$VD_lead_id','VDAD','$campaign_rec_filename','$uniqueid');";
@@ -838,3 +849,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 );
}
+12 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-AGENT_dial_in.agi version 0.1
# agi-AGENT_dial_in.agi version 2.6
#
# This script is designed to allow agents the ability to dial in to an extension
# to establish the phone connection to their VICIDIAL session. The user login
@@ -28,11 +28,12 @@
# ; call menu with options:
# agi-AGENT_dial_in.agi,Y---Y
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 81022-2115 - First build
# 120511-1423 - Added new options
# 130108-1809 - Changes for Asterisk 1.8 compatibility
#
&get_time_now;
@@ -273,10 +274,13 @@ if ($VALID_login < 1)
{
if ($AGILOG) {$agi_string = "exiting the agent dial-in app, transferring call to B @ $context"; &agi_output;}
print "SET CONTEXT $context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION B\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
else
@@ -308,10 +312,13 @@ else
{
if ($AGILOG) {$agi_string = "exiting the agent dial-in app, transferring call to A @ $context"; &agi_output;}
print "SET CONTEXT $context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION A\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
@@ -378,10 +385,13 @@ else
if ($AGILOG) {$agi_string = "Agent $PIN_number sent to $VDADremDIALstr"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $VDADremDIALstr\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
}
+6 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-AGENT_route.agi version 2.4
# agi-AGENT_route.agi version 2.6
#
# for use with a Call Menu in the custom dialplan section or as an AGI route.
#
@@ -28,11 +28,12 @@
#; example with 4-digit agent IDs
# exten => _XXXX,1,AGI(agi-AGENT_route.agi,default---AGENTDIRECT---ACTIVE)
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 100321-0108 - First Build
# 100704-2128 - Added several options
# 130108-1811 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-AGENT_route.agi';
@@ -325,10 +326,13 @@ if (length($transfer_prompt) > 1)
if ($AGILOG) {$agi_string = "exiting the AGENT app, transferring call to $did_extension @ $ext_context"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $did_extension\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
+6 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-CALLCARD_dial_in.agi version 0.1
# agi-CALLCARD_dial_in.agi version 2.6
#
# This script is designed to allow customers the ability to dial in to a DID and
# enter in a PIN number that would look up their account and send on to a
@@ -36,10 +36,11 @@
# - vm-youhave
# - callcard_minutes_left
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 100311-1135 - First build
# 130108-1812 - Changes for Asterisk 1.8 compatibility
#
&get_time_now;
@@ -339,10 +340,13 @@ else
if ($AGILOG) {$agi_string = "Customer $PIN_number sent to $forward_extension"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $forward_extension\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
+66 -6
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-DID_route.agi version 2.4
# agi-DID_route.agi version 2.6
#
# runs when a call comes into an inbound context on a trunk. This script will
# send the calls to various places depending on the settings for each DID.
@@ -13,7 +13,7 @@
# ;inbound DID catch-all:
#exten => _X.,1,AGI(agi-DID_route.agi)
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 81007-0324 - First Build
@@ -28,6 +28,8 @@
# 100805-0943 - Added Filter Phone Group alternate routing feature and CID number cleanup
# 110822-1210 - Added did_agent_log optional logging
# 120314-1112 - Fixed small filter bug
# 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible
# 130108-1810 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-DID_route.agi';
@@ -109,7 +111,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT agi_output,local_gmt FROM servers where server_ip = '$VARserver_ip';";
$stmtA = "SELECT agi_output,local_gmt,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;
@@ -117,8 +119,9 @@ if ($sthArows > 0)
{
$AGILOG = '0';
@aryA = $sthA->fetchrow_array;
$DBagi_output = "$aryA[0]";
$local_gmt = "$aryA[1]";
$DBagi_output = $aryA[0];
$local_gmt = $aryA[1];
$asterisk_version = $aryA[2];
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
@@ -339,7 +342,15 @@ if ($record_call =~ /Y/)
$filename = "$tsSQLdate$US$extension$US$callerid";
### 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','$callerid','$SQLdate','$now_date_epoch','0','$filename','0','$extension','$filename','$unique_id');";
@@ -590,10 +601,13 @@ if ($did_route =~ /EXTEN/)
$XFERexten = "$did_extension";
if ($AGILOG) {$agi_string = "exiting the DID app, transferring call to $XFERexten @ $exten_context"; &agi_output;}
print "SET CONTEXT $exten_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $XFERexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
@@ -606,10 +620,13 @@ if ($did_route =~ /CALLMENU/)
$XFERcontext = "$menu_id";
if ($AGILOG) {$agi_string = "exiting the DID app, transferring call to CALLMENU $XFERcontext"; &agi_output;}
print "SET CONTEXT $XFERcontext\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION s\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
@@ -686,3 +703,46 @@ sub did_output
}
$did_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 );
}
+386 -308
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-IVR_recording_verification.agi version 0.1
# agi-IVR_recording_verification.agi version 2.6
#
# This script is designed to function as a complete automated 3rd party
# verification IVR recording system. This script will work by optionally asking
@@ -42,7 +42,7 @@
#exten => _83002*.,5,Hangup
#
#
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 70912-1105 - First build, non-functional
@@ -51,6 +51,8 @@
# 71028-1122 - added say datetime as an option
# 71112-0238 - added prompt delays and date announcement message
# 71120-1337 - added playing of recording ID at beginning of session
# 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible
# 130108-1816 - Changes for Asterisk 1.8 compatibility
#
&get_time_now;
@@ -116,82 +118,100 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
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 ###
if (length($ARGV[0])>1)
{
if ($ARGV[0] =~ /---/)
{
### list of command-line array arguments:
@ARGV_vars = split(/---/, $ARGV[0]);
if ($ARGV[0] =~ /---/)
{
### list of command-line array arguments:
@ARGV_vars = split(/---/, $ARGV[0]);
$inbound_number = $ARGV_vars[0];
$play_ID = $ARGV_vars[1];
$record_call = $ARGV_vars[2];
$company_ID_ask = $ARGV_vars[3];
$user_ID_ask = $ARGV_vars[4];
$cust_phone_ask = $ARGV_vars[5];
$say_date = $ARGV_vars[6];
$prompts = $ARGV_vars[7];
$last_prompt = $ARGV_vars[8];
$AGI_output = $ARGV_vars[9];
@prompts_list = split(/-/, $prompts);
$prompts_count = $#prompts_list;
$inbound_number = $ARGV_vars[0];
$play_ID = $ARGV_vars[1];
$record_call = $ARGV_vars[2];
$company_ID_ask = $ARGV_vars[3];
$user_ID_ask = $ARGV_vars[4];
$cust_phone_ask = $ARGV_vars[5];
$say_date = $ARGV_vars[6];
$prompts = $ARGV_vars[7];
$last_prompt = $ARGV_vars[8];
$AGI_output = $ARGV_vars[9];
@prompts_list = split(/-/, $prompts);
$prompts_count = $#prompts_list;
if ($play_ID =~ /Y/)
{
@play_IDary = split(/-/, $play_ID);
$play_ID_prompt = $play_IDary[1];
}
{
@play_IDary = split(/-/, $play_ID);
$play_ID_prompt = $play_IDary[1];
}
if ($company_ID_ask =~ /Y/)
{
@company_ID = split(/-/, $company_ID_ask);
$company_ID_length = $company_ID[1];
$company_ID_prompt = $company_ID[2];
}
{
@company_ID = split(/-/, $company_ID_ask);
$company_ID_length = $company_ID[1];
$company_ID_prompt = $company_ID[2];
}
if ($user_ID_ask =~ /Y/)
{
@user_ID = split(/-/, $user_ID_ask);
$user_ID_length = $user_ID[1];
$user_ID_prompt = $user_ID[2];
}
{
@user_ID = split(/-/, $user_ID_ask);
$user_ID_length = $user_ID[1];
$user_ID_prompt = $user_ID[2];
}
if ($cust_phone_ask =~ /Y/)
{
@cust_phone_ID = split(/-/, $cust_phone_ask);
$cust_phone_length = $cust_phone_ID[1];
$cust_phone_prompt = $cust_phone_ID[2];
}
{
@cust_phone_ID = split(/-/, $cust_phone_ask);
$cust_phone_length = $cust_phone_ID[1];
$cust_phone_prompt = $cust_phone_ID[2];
}
if ($say_date =~ /Y/)
{
@say_date_ID = split(/-/, $say_date);
$say_date_prompt = $say_date_ID[1];
{
@say_date_ID = split(/-/, $say_date);
$say_date_prompt = $say_date_ID[1];
}
if ($AGI_output =~ /STDERR/) {$AGILOG = '1';}
if ($AGI_output =~ /FILE/) {$AGILOG = '2';}
if ($AGI_output =~ /BOTH/) {$AGILOG = '3';}
}
if ($AGI_output =~ /STDERR/) {$AGILOG = '1';}
if ($AGI_output =~ /FILE/) {$AGILOG = '2';}
if ($AGI_output =~ /BOTH/) {$AGILOG = '3';}
}
}
$|=1;
while(<STDIN>)
{
{
chomp;
last unless length($_);
if ($V)
{
if (/^agi_(\w+)\:\s+(.*)$/)
{
if (/^agi_(\w+)\:\s+(.*)$/)
{
$AGI{$1} = $2;
}
}
}
if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1;}
if (/^agi_extension\:\s+(.*)$/) {$extension = $1;}
if (/^agi_channel\:\s+(.*)$/) {$channel = $1;}
if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;}
if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;}
}
}
if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) )
{
@@ -304,95 +324,103 @@ $AGI->stream_file('beep');
### if set to play ID at beginning of session ###
if ($play_ID =~ /Y/)
{
$AGI->stream_file("$play_ID_prompt");
$AGI->say_digits("$ivr_id");
sleep(1);
$AGI->stream_file('beep');
$AGI->say_digits("$ivr_id");
sleep(1);
}
{
$AGI->stream_file("$play_ID_prompt");
$AGI->say_digits("$ivr_id");
sleep(1);
$AGI->stream_file('beep');
$AGI->say_digits("$ivr_id");
sleep(1);
}
### if set to ask for company ID, run that subroutine ###
if ($company_ID_ask =~ /Y/)
{
&company_ID_gather_response;
$company_ID = $totalDTMF;
&get_time_now;
$length_in_sec = ($now_date_epoch - $start_epoch);
$stmtA = "UPDATE vicidial_ivr SET company_id='$company_ID', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "IVR- $ivr_id company: $company_ID length: $length_in_sec"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
{
&company_ID_gather_response;
$company_ID = $totalDTMF;
&get_time_now;
$length_in_sec = ($now_date_epoch - $start_epoch);
$stmtA = "UPDATE vicidial_ivr SET company_id='$company_ID', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "IVR- $ivr_id company: $company_ID length: $length_in_sec"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
### if set to ask for user ID, run that subroutine ###
if ($user_ID_ask =~ /Y/)
{
&user_ID_gather_response;
$user_ID = $totalDTMF;
&get_time_now;
$length_in_sec = ($now_date_epoch - $start_epoch);
$stmtA = "UPDATE vicidial_ivr SET user='$user_ID', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "IVR- $ivr_id user: $user_ID length: $length_in_sec"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
{
&user_ID_gather_response;
$user_ID = $totalDTMF;
&get_time_now;
$length_in_sec = ($now_date_epoch - $start_epoch);
$stmtA = "UPDATE vicidial_ivr SET user='$user_ID', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "IVR- $ivr_id user: $user_ID length: $length_in_sec"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
### if set to ask for customer phone number, run that subroutine ###
if ($cust_phone_ask =~ /Y/)
{
&cust_phone_gather_response;
$phone_number = $totalDTMF;
&get_time_now;
$length_in_sec = ($now_date_epoch - $start_epoch);
$stmtA = "UPDATE vicidial_ivr SET phone_number='$phone_number', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "IVR- $ivr_id phone: $phone_number length: $length_in_sec"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
{
&cust_phone_gather_response;
$phone_number = $totalDTMF;
&get_time_now;
$length_in_sec = ($now_date_epoch - $start_epoch);
$stmtA = "UPDATE vicidial_ivr SET phone_number='$phone_number', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "IVR- $ivr_id phone: $phone_number length: $length_in_sec"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
### if set to record this session, start recording ###
if ($record_call =~ /Y/)
{
#$filename = "$inbound_number$US$phone_number$US$ivr_id";
$filename = "$ivr_id";
### code to record call goes here ###
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/$filename|m");
### 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) values('$channel','$server_ip','$inbound_number','$now_date','start_epoch','0','$filename','$lead_id','$user','$ivr_id');";
$affected_rows = $dbhA->do($stmtA);
$cbc=0;
$stmtA = "select LAST_INSERT_ID() LIMIT 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$recording_id = "$aryA[0]";
$cbc++;
#$filename = "$inbound_number$US$phone_number$US$ivr_id";
$filename = "$ivr_id";
### code to record call goes here ###
%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|m");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$filename,m");
}
### 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) values('$channel','$server_ip','$inbound_number','$now_date','start_epoch','0','$filename','$lead_id','$user','$ivr_id');";
$affected_rows = $dbhA->do($stmtA);
$cbc=0;
$stmtA = "select LAST_INSERT_ID() LIMIT 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$recording_id = "$aryA[0]";
$cbc++;
}
$sthA->finish();
$stmtA = "UPDATE vicidial_ivr SET recording_id='$recording_id', recording_filename='$filename' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "RECORDING- $recording_id $ivr_id START filename: $filename"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
$sthA->finish();
$stmtA = "UPDATE vicidial_ivr SET recording_id='$recording_id', recording_filename='$filename' where ivr_id='$ivr_id';";
if ($AGILOG) {$agi_string = "RECORDING- $recording_id $ivr_id START filename: $filename"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
}
### if set, say the current date ###
if ($say_date =~ /Y/)
{
{
if ($AGILOG) {$agi_string = "SAYING DATETIME $now_date_epoch"; &agi_output;}
if (length($say_date_prompt)>0) {$AGI->stream_file("$say_date_prompt");}
sleep(1);
$AGI->exec("SayUnixtime");
sleep(1);
}
}
##### Go through the propmts one at a time until done #####
@@ -402,7 +430,7 @@ if ($say_date =~ /Y/)
$i=0;
$j=1;
while($prompts_count >= $i)
{
{
$prompt_ary = $prompts_list[$i];
@prompts_specs = split(/-/, $prompt_ary);
$prompt = $prompts_specs[0];
@@ -427,7 +455,7 @@ while($prompts_count >= $i)
$i++;
$j++;
}
}
##### Play the last prompt and say the IVR number #####
$AGI->stream_file("$last_prompt");
@@ -470,213 +498,213 @@ exit;
##### BEGIN collect the company ID #############################################
sub company_ID_gather_response
{
$digit='';
$interrupt_digit='';
$interrupt_digit = $AGI->stream_file("$company_ID_prompt",'1234567890');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
# if ($interrupt_digit == 35) {$interrupt_digit='#';}
# if ($interrupt_digit == 42) {$interrupt_digit='*';}
if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
$digit='';
$interrupt_digit='';
while ($digit_loop_counter < $company_ID_length)
{
$digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input
if ($digit =~ /\d/)
$interrupt_digit = $AGI->stream_file("$company_ID_prompt",'1234567890');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
# if ($interrupt_digit == 35) {$interrupt_digit='#';}
# if ($interrupt_digit == 42) {$interrupt_digit='*';}
if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
else
while ($digit_loop_counter < $company_ID_length)
{
$digit_loop_counter=$company_ID_length;
$digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input
if ($digit =~ /\d/)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
}
else
{
$digit_loop_counter=$company_ID_length;
}
$digit_loop_counter++;
}
$digit_loop_counter++;
}
}
##### END collect the company ID ###############################################
##### BEGIN collect the user ID ################################################
sub user_ID_gather_response
{
$digit='';
$interrupt_digit='';
$interrupt_digit = $AGI->stream_file("$user_ID_prompt",'1234567890');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
# if ($interrupt_digit == 35) {$interrupt_digit='#';}
# if ($interrupt_digit == 42) {$interrupt_digit='*';}
if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
$digit='';
$interrupt_digit='';
while ($digit_loop_counter < $user_ID_length)
{
$digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input
if ($digit =~ /\d/)
$interrupt_digit = $AGI->stream_file("$user_ID_prompt",'1234567890');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
# if ($interrupt_digit == 35) {$interrupt_digit='#';}
# if ($interrupt_digit == 42) {$interrupt_digit='*';}
if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
else
while ($digit_loop_counter < $user_ID_length)
{
$digit_loop_counter=$user_ID_length;
$digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input
if ($digit =~ /\d/)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
}
else
{
$digit_loop_counter=$user_ID_length;
}
$digit_loop_counter++;
}
$digit_loop_counter++;
}
}
##### END collect the user ID ##################################################
##### BEGIN collect the customer phone number ##################################
sub cust_phone_gather_response
{
$digit='';
$interrupt_digit='';
$interrupt_digit = $AGI->stream_file("$cust_phone_prompt",'1234567890');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
$digit='';
$interrupt_digit='';
while ($digit_loop_counter < $cust_phone_length)
{
$digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input
if ($digit =~ /\d/)
$interrupt_digit = $AGI->stream_file("$cust_phone_prompt",'1234567890');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
else
while ($digit_loop_counter < $cust_phone_length)
{
$digit_loop_counter=$cust_phone_length;
$digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input
if ($digit =~ /\d/)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
}
else
{
$digit_loop_counter=$cust_phone_length;
}
$digit_loop_counter++;
}
$digit_loop_counter++;
}
}
##### END collect the customer phone number ####################################
##### BEGIN collect the response to a prompt ###################################
sub prompt_gather_response
{
$digit='';
$interrupt_digit='';
$interrupt_digit = $AGI->stream_file("$prompt",'123456789');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
# if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
$digit='';
$interrupt_digit='';
while ($digit_loop_counter < 1)
{
$wait_ms = ($wait_sec * 1000);
$digit = chr($AGI->wait_for_digit("$wait_ms")); # wait number of milli-seconds for input
if ($digit =~ /\d/)
$interrupt_digit = $AGI->stream_file("$prompt",'123456789');
print STDERR "interrupt_digit |$interrupt_digit|\n";
$digits_being_entered=1;
$digit_loop_counter=0;
$totalDTMF='';
if ($interrupt_digit > 1)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
# if ($interrupt_digit == 48) {$interrupt_digit=0;}
if ($interrupt_digit == 49) {$interrupt_digit=1;}
if ($interrupt_digit == 50) {$interrupt_digit=2;}
if ($interrupt_digit == 51) {$interrupt_digit=3;}
if ($interrupt_digit == 52) {$interrupt_digit=4;}
if ($interrupt_digit == 53) {$interrupt_digit=5;}
if ($interrupt_digit == 54) {$interrupt_digit=6;}
if ($interrupt_digit == 55) {$interrupt_digit=7;}
if ($interrupt_digit == 56) {$interrupt_digit=8;}
if ($interrupt_digit == 57) {$interrupt_digit=9;}
$totalDTMF=$interrupt_digit;
$digit_loop_counter++;
}
else
while ($digit_loop_counter < 1)
{
$digit_loop_counter=-1;
$wait_ms = ($wait_sec * 1000);
$digit = chr($AGI->wait_for_digit("$wait_ms")); # wait number of milli-seconds for input
if ($digit =~ /\d/)
{
$totalDTMF = "$totalDTMF$digit";
print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";
# $AGI->say_digits("$digit");
undef $digit;
}
else
{
$digit_loop_counter=-1;
}
$digit_loop_counter++;
}
$digit_loop_counter++;
}
}
##### END collect the response to a prompt #####################################
@@ -684,55 +712,105 @@ while ($digit_loop_counter < 1)
sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes
{
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
{
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
$now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec";
$filedate = "$year$mon$mday$hour$min$sec";
}
$now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec";
$filedate = "$year$mon$mday$hour$min$sec";
}
sub checkresult {
sub checkresult
{
my ($res) = @_;
my $retval;
$tests++;
chomp $res;
if ($res =~ /^200/) {
if ($res =~ /^200/)
{
$res =~ /result=(-?\d+)/;
if (!length($1)) {
if (!length($1))
{
print STDERR "FAIL ($res)\n";
$fail++;
} else {
}
else
{
print STDERR "PASS ($1)\n";
$pass++;
}
} else {
}
}
else
{
print STDERR "FAIL (unexpected result '$res')\n";
$fail++;
}
}
}
sub agi_output
{
if ($AGILOG >=2)
{
### open the log file for writing ###
open(Lout, ">>$AGILOGfile")
|| die "Can't open $AGILOGfile: $!\n";
print Lout "$now_date|$script|$agi_string\n";
close(Lout);
if ($AGILOG >=2)
{
### open the log file for writing ###
open(Lout, ">>$AGILOGfile")
|| die "Can't open $AGILOGfile: $!\n";
print Lout "$now_date|$script|$agi_string\n";
close(Lout);
}
### send to STDERR writing ###
if ( ($AGILOG == '1') || ($AGILOG == '3') )
{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 );
}
### send to STDERR writing ###
if ( ($AGILOG == '1') || ($AGILOG == '3') )
{print STDERR "$now_date|$script|$agi_string\n";}
$agi_string='';
}
+75 -3
View File
@@ -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 );
}
+97 -11
View File
@@ -82,7 +82,7 @@
#exten => _99909*.,2,AGI(agi-VDAD_ALL_inbound.agi)
#exten => _99909*.,3,Hangup
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 70828-0924 - First Build
@@ -174,6 +174,8 @@
# 111219-2124 - Added max stats updating
# 111229-1726 - Changed call time overflow to look at previous day stop time
# 120130-1708 - Fix for ring agent EXTERNAL protocol phone issue
# 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible
# 120430-2237 - For AGI commands not made through the AGI object added a read from STDIN before calling checkresult
# 120513-0051 - Added ability to have Dial In-Group agent calls go directly to agents
# 120514-0953 - Added force checks for dial-ingroup calls
# 121025-2210 - If AGENTDIRECT and no agent defined, set drop call seconds to 1
@@ -181,6 +183,7 @@
# 121120-0921 - Added QM socket-send functionality
# 121124-1345 - Added call times holidays function
# 121129-1618 - Small fix for estimated hold time, excluding QUEUE status
# 130108-1804 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -647,13 +650,13 @@ while ($sthArows > $cbc)
$DBext_context = $aryA[1];
$DBanswer_transfer_agent = $aryA[2];
$DBSERVER_GMT = $aryA[3];
$DBasterisk_version = $aryA[4];
$asterisk_version = $aryA[4];
$DBmax_vicidial_trunks = $aryA[5];
if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;}
if ($DBext_context) {$ext_context = $DBext_context;}
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;}
if ($asterisk_version) {$AST_ver = $asterisk_version;}
if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;}
$cbc++;
}
@@ -962,7 +965,7 @@ if ($call_handle_method =~ /LOOKUP/)
$launch .= " --call_type=IN";
$launch .= " --campaign=" . $channel_group;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --call_id=" . $XXqueryCID;
$launch .= " --function=INGROUP_ADD_LEAD_URL";
@@ -1101,7 +1104,7 @@ if ($call_handle_method =~ /LOOKUP/)
$launch .= " --call_type=IN";
$launch .= " --campaign=" . $channel_group;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --call_id=" . $XXqueryCID;
$launch .= " --function=INGROUP_ADD_LEAD_URL";
@@ -1176,7 +1179,7 @@ else
$launch .= " --call_type=IN";
$launch .= " --campaign=" . $channel_group;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --call_id=" . $XXqueryCID;
$launch .= " --function=INGROUP_ADD_LEAD_URL";
@@ -1462,10 +1465,13 @@ if ( ( ( ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) && ($hm >= $c
if ($AGILOG) {$agi_string = "exiting the VDAD app after hours, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
}
@@ -1701,10 +1707,13 @@ if ( ( ($no_agent_no_queue =~ /Y|NO_PAUSED/) || ($MCnanque_override > 0) ) && ($
if ($AGILOG) {$agi_string = "exiting the VDAD app no agent no queue, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
}
@@ -2104,7 +2113,16 @@ if ( ($CLchannel_group =~ /DID_INBOUND/) && (length($CLend_epoch) < 5) )
$CLlength_in_min = ($CLlength_in_sec / 60);
$CLlength_in_min = sprintf("%8.2f", $CLlength_in_min);
$AGI->exec("StopMonitor wav|/var/spool/asterisk/monitor/MIX/$CLfilename");
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$AGI->exec("StopMonitor wav|/var/spool/asterisk/monitor/MIX/$CLfilename");
}
else
{
$AGI->exec("StopMonitor","wav,/var/spool/asterisk/monitor/MIX/$CLfilename");
}
$stmtA = "UPDATE recording_log set end_time='$now_date',end_epoch='$now_date_epoch',length_in_sec=$CLlength_in_sec,length_in_min='$CLlength_in_min' where recording_id='$CLrecording_id'";
$affected_rowsRL = $dbhA->do($stmtA);
@@ -3203,7 +3221,15 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$campaign_rec_filename =~ s/LEADID/$insert_lead_id/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_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/$campaign_rec_filename");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_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','$phone_number','$now_date','$now_date_epoch','0','$campaign_rec_filename','$insert_lead_id','$VDADuser','$campaign_rec_filename','$uniqueid');";
@@ -3249,10 +3275,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$AGI->stream_file('sip-silence');
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $VDADremDIALstr\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -3260,7 +3289,8 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec";
if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date|$VDADremDIALstr"; &agi_output;}
$result = <STDIN>;
exit;
}
else
@@ -3382,10 +3412,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -4015,7 +4048,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$launch .= " --campaign=" . $channel_group;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --call_id=" . $callerid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --function=INGROUP_ADD_LEAD_URL";
system($launch . ' &');
@@ -4126,10 +4159,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -4424,7 +4460,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$launch .= " --call_type=IN";
$launch .= " --campaign=" . $channel_group;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --call_id=" . $callerid;
$launch .= " --function=INGROUP_ADD_LEAD_URL";
@@ -4535,10 +4571,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -4572,6 +4611,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
{
$start_moh=0;
print "SET MUSIC ON $moh_context\n";
$result = <STDIN>;
checkresult($result);
}
if ($moh_delay > 0)
@@ -4850,10 +4890,13 @@ if ( ($drop_timer > $DROP_TIME) || ($MCdrop_override > 0) )
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
else
@@ -5247,6 +5290,49 @@ sub mysql_error_logging
$one_mysql_log=0;
}
# 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 );
}
sub trigger_transfer_process
{
+113 -16
View File
@@ -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) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80218-2027 - First Build
@@ -93,11 +93,14 @@
# 110926-1929 - Small fixes
# 111201-1751 - Added grade-random next-agent-call option
# 111219-2256 - Added max stats updating
# 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible
# 120430-2218 - For AGI commands not made through the AGI object added a read from STDIN before calling checkresult
# 120529-2112 - Added safe_harbor_audio_field campaign option
# 120621-0726 - Changed survey opt-in non-agent qm logging to log connection to VDAD agent
# 121009-1458 - Changed survey method HANGUP to not wait for digits, added LRERR Local channel logging
# 121120-0922 - Added QM socket-send functionality
# 121125-0035 - Added Other Campaign DNC option
# 130108-1806 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -227,14 +230,14 @@ while ($sthArows > $rec_count)
$DBext_context = $aryA[1];
$DBanswer_transfer_agent = $aryA[2];
$DBSERVER_GMT = $aryA[3];
$DBasterisk_version = $aryA[4];
$asterisk_version = $aryA[4];
$DBmax_vicidial_trunks = $aryA[5];
$DBagi_output = $aryA[6];
if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;}
if ($DBext_context) {$ext_context = $DBext_context;}
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;}
if ($asterisk_version) {$AST_ver = $asterisk_version;}
if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;}
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
@@ -307,6 +310,7 @@ if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S
$callerid =~ s/ .*//gi;
### set the callerid to the ACQS value(calleridname)
print "SET CALLERID $callerid\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;}
}
@@ -318,6 +322,7 @@ if ( (
$callerid = $calleridname;
### set the callerid to the ACQS value(calleridname)
print "SET CALLERID $callerid\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;}
}
@@ -702,7 +707,15 @@ if ($VDACaffected_rows > 0)
$campaign_rec_filename =~ s/\"|\'//gi;
$campaign_rec_filename =~ s/ //gi;
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_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/$campaign_rec_filename");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_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','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','VDAD','$campaign_rec_filename','$uniqueid');";
@@ -1401,10 +1414,13 @@ if ($call_handle_method =~ /SURVEY/)
{
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $survey_third_exten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $survey_third_exten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
else
@@ -1513,11 +1529,15 @@ if ($call_handle_method =~ /SURVEY/)
{
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $survey_fourth_exten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $survey_fourth_exten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
else
{$AGI->hangup();}
@@ -1685,11 +1705,11 @@ if ($call_handle_method =~ /SURVEY/)
$launch .= " --lead_id=" . $CIDlead_id;
$launch .= " --phone_number=" . $VDADphone;
$launch .= " --user=VDAD";
$launch .= " --call_type=";
$launch .= " --call_type=OUT";
$launch .= " --campaign=" . $VDADcampaign;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --call_id=" . $callerid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --function=QM_SOCKET_SEND";
$launch .= " --compat_url=" . $compat_url;
@@ -1712,11 +1732,11 @@ if ($call_handle_method =~ /SURVEY/)
$launch .= " --lead_id=" . $CIDlead_id;
$launch .= " --phone_number=" . $VDADphone;
$launch .= " --user=VDAD";
$launch .= " --call_type=";
$launch .= " --call_type=OUT";
$launch .= " --campaign=" . $VDADcampaign;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --call_id=" . $callerid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --function=QM_SOCKET_SEND";
$launch .= " --compat_url=" . $compat_url;
@@ -1735,10 +1755,13 @@ if ($call_handle_method =~ /SURVEY/)
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $DROPexten $ext_context"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
@@ -2353,7 +2376,15 @@ while ($drop_timer <= $DROP_TIME)
$campaign_rec_filename =~ s/LEADID/$CIDlead_id/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_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/$campaign_rec_filename");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_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','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','$VDADuser','$campaign_rec_filename','$uniqueid');";
@@ -2435,11 +2466,11 @@ while ($drop_timer <= $DROP_TIME)
$launch .= " --lead_id=" . $CIDlead_id;
$launch .= " --phone_number=" . $VDADphone;
$launch .= " --user=" . $VDADuser;
$launch .= " --call_type=";
$launch .= " --call_type=OUT";
$launch .= " --campaign=" . $VDADcampaign;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --call_id=" . $callerid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --function=QM_SOCKET_SEND";
$launch .= " --compat_url=" . $compat_url;
@@ -2451,10 +2482,13 @@ while ($drop_timer <= $DROP_TIME)
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $VDADconf_exten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -2469,7 +2503,8 @@ while ($drop_timer <= $DROP_TIME)
$now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec";
if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;}
$result = <STDIN>;
exit;
}
else
@@ -2907,7 +2942,15 @@ while ($drop_timer <= $DROP_TIME)
$campaign_rec_filename =~ s/LEADID/$CIDlead_id/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_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/$campaign_rec_filename");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_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','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','$VDADuser','$campaign_rec_filename','$uniqueid');";
@@ -2991,11 +3034,11 @@ while ($drop_timer <= $DROP_TIME)
$launch .= " --lead_id=" . $CIDlead_id;
$launch .= " --phone_number=" . $VDADphone;
$launch .= " --user=" . $VDADuser;
$launch .= " --call_type=";
$launch .= " --call_type=OUT";
$launch .= " --campaign=" . $VDADcampaign;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --call_id=" . $callerid;
$launch .= " --alt_dial=";
$launch .= " --alt_dial=MAIN";
$launch .= " --function=QM_SOCKET_SEND";
$launch .= " --compat_url=" . $compat_url;
@@ -3007,10 +3050,13 @@ while ($drop_timer <= $DROP_TIME)
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADremDIALstr"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $VDADremDIALstr\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -3025,7 +3071,8 @@ while ($drop_timer <= $DROP_TIME)
$now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec";
if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;}
$result = <STDIN>;
exit;
}
else
@@ -3280,11 +3327,15 @@ if ($drop_timer > $DROP_TIME)
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten $ext_context"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
else
{
@@ -3566,10 +3617,13 @@ sub cpd_end_call
if ($AGILOG) {$agi_string = "exiting the VDAD app, CPD transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
@@ -3588,6 +3642,49 @@ sub cpd_end_call
}
}
# 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 );
}
sub trigger_transfer_process
{
+61 -5
View File
@@ -12,13 +12,14 @@
# exten => _8331*.,n,AGI(agi-VDAD_RINGALL.agi,${EXTEN})
# exten => _8331*.,n,Hangup
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 110303-2325 - First build
# 110324-2328 - Added recording of remote agent calls, per in-group and campaign recording settings
# 110325-1411 - Added user recording override settings checking for remote agent recording
# 121114-1935 - Added INGROUP recording option
# 130108-1808 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDAD_RINGALL.agi';
@@ -86,7 +87,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT agi_output,ext_context FROM servers where server_ip = '$VARserver_ip';";
$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;
@@ -95,8 +96,9 @@ while ($sthArows > $rec_count)
{
$AGILOG = '0';
@aryA = $sthA->fetchrow_array;
$DBagi_output = $aryA[0];
$ext_context = $aryA[1];
$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';}
@@ -336,7 +338,15 @@ if ($NAGcount > 0)
$campaign_rec_filename =~ s/LEADID/$VAC_lead_id/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_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/$campaign_rec_filename");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_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','$VAC_phone_number','$now_date','$now_date_epoch','0','$campaign_rec_filename','$VAC_lead_id','$dial_user','$campaign_rec_filename','$uniqueid');";
@@ -404,10 +414,13 @@ if ($NAGcount > 0)
if ($AGILOG) {$agi_string = "-- Ring-Agent Sending Call: |$callerid|$auto_call_id|$dial_user|$VLA_DIALstr|"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $VLA_DIALstr\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
$dbhA->disconnect();
@@ -521,3 +534,46 @@ sub leading_zero($)
s/^(\d\d)$/0$1/;
return $_;
} # End of the leading_zero() routine.
# 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 );
}
+8 -1
View File
@@ -31,7 +31,7 @@
#exten => 1234,2,AGI(agi-VDAD_inbound_calltime_check.agi,INBOUND-----YES-----START-----24hours-----EXTENSION-----101-----default-----NO)
#exten => 1234,3,Hangup
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80525-0144 - First Build
@@ -49,6 +49,7 @@
# 120719-1411 - Fixed issue with inbound IVR calls not showing up in real-time screen
# 120730-0727 - Fixed issue with non-populating phone number
# 121124-1414 - Added call times holidays function
# 130108-1807 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDAD_inbound_calltime_check.agi';
@@ -589,10 +590,13 @@ if ( ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) && ($hm >= $ct_st
if ($AGILOG) {$agi_string = "exiting the VDAD app after hours, transferring call to $DROPexten |$hm|$ct_default_start|$ct_default_stop|$ct_stop_overflow|"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
}
}
@@ -663,10 +667,13 @@ if ( ($call_menu_qualify_enabled > 0) && ($query_qualification =~ /YES/) && ( ($
if ($AGILOG) {$agi_string = " TimeCheck App Qualify SQL FAIL, transferring call to D |$qualify_count|$lead_id|$context|$calleridname|"; &agi_output;}
print "SET CONTEXT $context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION D\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
+8 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-VDADautoREMINDER.agi version 0.4 *DBI-version*
# agi-VDADautoREMINDER.agi version 2.6
#
# runs when a call comes in from the VICIDIAL auto_dialer. This script will
# send the calls out to specified voicemail boxes in if called person presses key.
@@ -22,13 +22,14 @@
# exten => 8372,1,AGI(call_log.agi,${EXTEN})
# exten => 8372,2,AGI(agi-VDADautoREMINDER.agi,${EXTEN})
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# CHANGES
# 60313-1626 - First build
# 60810-1729 - Changed to DBI
# - changed to use /etc/astguiclient.conf for configs
# 60818-1144 - added output options check from database
# 130108-1814 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDADautoREMINDER.agi';
@@ -207,6 +208,7 @@ if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S
$callerid =~ s/\".*$//gi;
### set the callerid to the ACQS value(calleridname)
print "SET CALLERID $callerid\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;}
}
@@ -217,6 +219,7 @@ if ( (
$callerid = $calleridname;
### set the callerid to the ACQS value(calleridname)
print "SET CALLERID $callerid\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;}
}
@@ -413,10 +416,13 @@ if ($pin == "1") ### send call to voicemail
### SEND CALL TO VOICEMAIL BOX ###
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $voicemail_dump_exten$VMAIL_box"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $voicemail_dump_exten$VMAIL_box\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
+12 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-VDADautoREMINDERxfer.agi version 0.3 *DBI-version*
# agi-VDADautoREMINDERxfer.agi version 2.6
#
# runs when a call comes in from the VICIDIAL auto_dialer. This script will
# send the calls out to specified voicemail boxes or specified extensions if
@@ -24,13 +24,14 @@
# exten => 8372,1,AGI(call_log.agi,${EXTEN})
# exten => 8372,2,AGI(agi-VDADautoREMINDERxfer.agi,${EXTEN})
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# CHANGES
# 60511-1214 - First build
# 60810-1729 - Changed to DBI
# - changed to use /etc/astguiclient.conf for configs
# 60818-1144 - added output options check from database
# 130108-1812 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDADautoREMINDERxfer.agi';
@@ -209,6 +210,7 @@ if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S
$callerid =~ s/\".*$//gi;
### set the callerid to the ACQS value(calleridname)
print "SET CALLERID $callerid\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;}
}
@@ -219,6 +221,7 @@ if ( (
$callerid = $calleridname;
### set the callerid to the ACQS value(calleridname)
print "SET CALLERID $callerid\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;}
}
@@ -415,10 +418,13 @@ if ($pin == "1") ### send call to voicemail
### SEND CALL TO VOICEMAIL BOX ###
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $voicemail_dump_exten$VMAIL_box"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $voicemail_dump_exten$VMAIL_box\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
@@ -518,11 +524,14 @@ if ($pin == "3") ### send call to extension
### SEND CALL TO VOICEMAIL BOX ###
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $XFER_exten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
print "SET CONTEXT $ext_context\n"
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $XFER_exten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
+6 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-VDADfixCXFER.agi version 2.0.5 *DBI-version*
# agi-VDADfixCXFER.agi version 2.6
#
# runs when a Consultative transfer is released by the vicidial fronter as the
# call arrives on another channel so that the vicidial_live_agents record is
@@ -12,12 +12,13 @@
# exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
# exten => _010*010*010*015*8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG:
# 60809-1749 - First build
# 60817-1122 - Added output options check from database
# 70212-1252 - Fixed issue with Local/ channel transfers on same server
# 130108-1812 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDADfixCXFER.agi';
@@ -189,6 +190,7 @@ if ($AGILOG) {$agi_string = "CXFERfix : $lead_id $user $channel $uniqueid"; &a
$CIDlead = sprintf("%010s", $lead_id);
$CIDlead = "C123412345$CIDlead";
print "SET CALLERID $CIDlead\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "callerID changed: $CIDlead"; &agi_output;}
@@ -211,8 +213,10 @@ if ($AGILOG) {$agi_string = "exiting the CXFERfix app, transferring call to $con
#print "SET CONTEXT $ext_context\n";
# checkresult($result);
print "SET EXTENSION $conf_exten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
+6 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-VDADselective_CID_hangup.agi version 2.0.5 *NO DB Connection*
# agi-VDADselective_CID_hangup.agi version 2.6
#
# Will hangup a call if it is not within the specified area codes
#
@@ -11,11 +11,12 @@
#exten => 8352,2,Playback(85100001)
#exten => 8352,3,Hangup
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 60918-1151 - First build
# 100903-0041 - Changed lead_id max length to 10 digits
# 130108-1813 - Changes for Asterisk 1.8 compatibility
#
$script = 'agi-VDADselective_CID_hangup.agi';
@@ -171,11 +172,14 @@ foreach $i (sort keys %AGI)
if ($areacode !~ /$clear_area_codes/)
{
print "SET HANGUP $channel\n";
$result = <STDIN>;
checkresult($result);
if ($AGILOG) {$agi_string = "channel Hungup: $channel"; &agi_output;}
print "SET EXTENSION $extension\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 3\n";
$result = <STDIN>;
checkresult($result);
}
+6 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-record_prompts.agi version 2.2.0-4
# agi-record_prompts.agi version 2.6
#
# for recording prompts to GSM file over the phone
# Saves recordings with 8-digit filenames to be played when exten is dialed
@@ -29,11 +29,12 @@
# - vm-msgsaved
# - vm-goodbye
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 71226-1303 - Added option to change format GSM/WAV and timeout through flags
# 90519-1019 - Changed formatting to conform to other scripts
# 130108-1815 - Changes for Asterisk 1.8 compatibility
#
$US='_';
@@ -157,10 +158,13 @@ sub welcome_1
{
print STDERR "\nexiting the ping app\n";
print "SET CONTEXT demo\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION 8158\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 3\n";
$result = <STDIN>;
checkresult($result);
exit;
}
+4 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# call_inbound.agi version 2.0.5 *DBI-version*
# call_inbound.agi version 2.6
#
# runs at the beginning and ending of every inbound call received
#
@@ -17,12 +17,13 @@
#
#
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 60731-1435 - changed to use DBI-DBD::mysql
# - changed to use /etc/astguiclient.conf for configs
# 60817-1102 - added output options check from database
# 130108-1838 - Changes for Asterisk 1.8 compatibility
#
$script = 'call_inbound.agi';
@@ -196,6 +197,7 @@ while(<STDIN>) {
### set the callerid if sent with DNIS
print "SET CALLERID $callerid\n";
$result = <STDIN>;
checkresult($result);
}
}
+5 -1
View File
@@ -17,10 +17,11 @@
# example of what to put in the AGI entry for a Call Menu AGI route:
# cm_dnc.agi,DNC---YES---TESTCAMP---B---CAMP
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 121109-1623 - First draft
# 130108-1817 - Changes for Asterisk 1.8 compatibility
#
$script = 'cm_dnc.agi';
@@ -299,10 +300,13 @@ $dbhA->disconnect();
if ($AGILOG) {$agi_string = "exiting the cm_dnc app, transferring call to $next_step:$context |$phone_number|"; &agi_output;}
print "SET CONTEXT $context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $next_step\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
+5 -1
View File
@@ -36,7 +36,7 @@
#; example with 8-digit vendor lead codes
# exten => _XXXXXXXX,1,AGI(cm_lookup.agi,vendor_lead_code---CAMPLISTSALL---TESTCAMP---lastname_oneyestwono---N---N---Y---N)
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 111004-1450 - First Build
@@ -44,6 +44,7 @@
# 120511-1508 - Added option for 'address3' uniqueid update and 'user' agent_user_id field update if AGENT-dial-in AGI is used beforoe this AGI
# 120604-1311 - Added title call variable option
# 120824-1221 - Added filtering for non-digits in extension, and example of variable-digit account number
# 130108-1817 - Changes for Asterisk 1.8 compatibility
#
$script = 'cm_lookup.agi';
@@ -513,10 +514,13 @@ $AGI->stream_file('sip-silence');
if ($AGILOG) {$agi_string = "exiting the cm_lookup.agi app, transferring call to $found_extension @ $context + $found_priority"; &agi_output;}
print "SET CONTEXT $context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $found_extension\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY $found_priority\n";
$result = <STDIN>;
checkresult($result);
exit;
+6 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# cm_status_dial.agi version 2.4
# cm_status_dial.agi version 2.6
#
# Used as a Call Menu AGI option route to alter status of a lead before dialing.
# The lead is only updated if the call is tagged with a lead_id before this script.
@@ -14,11 +14,12 @@
# ;inbound calls check calltime:
#cm_status_dial.agi,XFER-----917275551212-----default
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 120909-2301 - First Build
# 120924-0637 - Added log updating
# 130108-1820 - Changes for Asterisk 1.8 compatibility
#
$script = 'cm_status_dial.agi';
@@ -291,10 +292,13 @@ $dbhA->disconnect();
if ($AGILOG) {$agi_string = " Status Dial, transferring call |$dial_extension|$dial_context|$lead_id|$calleridname|"; &agi_output;}
print "SET CONTEXT $dial_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $dial_extension\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
+4 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# park_CID.agi version 2.4
# park_CID.agi version 2.6
#
# runs before the park extension to populate the parked_channels entry with the channel's callerid
#
@@ -12,7 +12,7 @@
# exten => 8301,3,Playback(park)
# exten => 8301,4,Hangup
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 60731-1423 - changed to use DBI-DBD::mysql
@@ -20,6 +20,7 @@
# 60815-1256 - added output options check from database
# 90909-0922 - Fixed calleridname issue
# 101004-1012 - Changed park to Music On Hold, added option for park on AGI
# 130108-1817 - Changes for Asterisk 1.8 compatibility
#
$script = 'park_CID.agi';
@@ -305,6 +306,7 @@ $AGI->stream_file('sip-silence');
if ($AGILOG) {$agi_string = "-- Starting MoH: |$park_context| |$callerid|"; &agi_output;}
print "SET MUSIC ON $park_context\n";
$result = <STDIN>;
checkresult($result);
sleep(360);
+157 -23
View File
@@ -78,6 +78,7 @@
# 121124-1440 - Added holiday expiration function
# 121215-2036 - Added email inbound script keepalive, option E
# 130103-0808 - Added CLI options for delay to be used with auto-dial and FILL processes
# 130108-1657 - Changes for Asterisk 1.8 compatibility
#
$DB=0; # Debug flag
@@ -1544,6 +1545,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Lext = "\n";
$Lext .= "; Local Server: $server_ip\n";
$Lext .= "exten => _$VARremDIALstr*.,1,Goto(default,\${EXTEN:16},1)\n";
$Lext .= "exten => _$VARremDIALstr*.,2,Hangup()\n";
$Liax .= "\n";
$Liax .= "[ASTloop]\n";
@@ -1623,6 +1625,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Lext .= "; Remote Server VDAD extens: $server_id[$i] $server_ip[$i]\n";
$Lext .= "exten => _$VARremDIALstr*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,oT)\n";
$Lext .= "exten => _$VARremDIALstr*.,2,Hangup()\n";
$Liax .= "\n";
$Liax .= "[$server_id[$i]]\n";
@@ -1651,33 +1654,38 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Vext .= "; Voicemail Extensions:\n";
$Vext .= "exten => _85026666666666.,1,Wait(1)\n";
$Vext .= "exten => _85026666666666.,n,Voicemail(\${EXTEN:14},u)\n";
$Vext .= "exten => _85026666666666.,n,Hangup\n";
$Vext .= "exten => _85026666666666.,n,Hangup()\n";
$Vext .= "exten => 8500,1,VoicemailMain\n";
$Vext .= "exten => 8500,2,Goto(s,6)\n";
$Vext .= "exten => 8500,3,Hangup()\n";
if ($asterisk_version =~ /^1.2/)
{$Vext .= "exten => 8501,1,VoicemailMain(s\${CALLERIDNUM})\n";}
else
{$Vext .= "exten => 8501,1,VoicemailMain(s\${CALLERID(num)})\n";}
$Vext .= "exten => 8501,2,Hangup\n";
$Vext .= "exten => 8501,2,Hangup()\n";
$Vext .= "\n";
$Vext .= "; Prompt Extensions:\n";
$Vext .= "exten => 8167,1,Answer\n";
$Vext .= "exten => 8167,2,AGI(agi-record_prompts.agi,wav-----720000)\n";
$Vext .= "exten => 8167,3,Hangup\n";
$Vext .= "exten => 8167,3,Hangup()\n";
$Vext .= "exten => 8168,1,Answer\n";
$Vext .= "exten => 8168,2,AGI(agi-record_prompts.agi,gsm-----720000)\n";
$Vext .= "exten => 8168,3,Hangup\n";
$Vext .= "exten => 8168,3,Hangup()\n";
}
else
{
$Vext .= "; Voicemail Extensions go to main voicemail server:\n";
$Vext .= "exten => _85026666666666.,1,Dial(\${TRUNK$voicemail_server_id}/\${EXTEN},99,oT)\n";
$Vext .= "exten => 8500,1,Dial(\${TRUNK$voicemail_server_id}/\${EXTEN},99,oT)\n";
$Vext .= "exten => 8500,2,Hangup()\n";
$Vext .= "exten => 8501,1,Dial(\${TRUNK$voicemail_server_id}/\${EXTEN},99,oT)\n";
$Vext .= "exten => 8501,2,Hangup()\n";
$Vext .= "\n";
$Vext .= "; Prompt Extensions go to main voicemail server:\n";
$Vext .= "exten => 8167,1,Dial(\${TRUNK$voicemail_server_id}/\${EXTEN},99,oT)\n";
$Vext .= "exten => 8167,2,Hangup()\n";
$Vext .= "exten => 8168,1,Dial(\${TRUNK$voicemail_server_id}/\${EXTEN},99,oT)\n";
$Vext .= "exten => 8168,2,Hangup()\n";
}
$Vext .= "\n";
@@ -1691,16 +1699,16 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{$Vext .= "exten => 8309,2,Monitor(wav,\${CALLERIDNAME})\n";}
else
{$Vext .= "exten => 8309,2,Monitor(wav,\${CALLERID(name)})\n";}
$Vext .= "exten => 8309,3,Wait,$vicidial_recording_limit\n";
$Vext .= "exten => 8309,4,Hangup\n";
$Vext .= "exten => 8309,3,Wait($vicidial_recording_limit)\n";
$Vext .= "exten => 8309,4,Hangup()\n";
$Vext .= "; this is the GSM verison\n";
$Vext .= "exten => 8310,1,Answer\n";
if ($asterisk_version =~ /^1.2/)
{$Vext .= "exten => 8310,2,Monitor(gsm,\${CALLERIDNAME})\n";}
else
{$Vext .= "exten => 8310,2,Monitor(gsm,\${CALLERID(name)})\n";}
$Vext .= "exten => 8310,3,Wait,$vicidial_recording_limit\n";
$Vext .= "exten => 8310,4,Hangup\n";
$Vext .= "exten => 8310,3,Wait($vicidial_recording_limit)\n";
$Vext .= "exten => 8310,4,Hangup()\n";
$Vext .= "\n; agent alert extension\n";
$Vext .= "exten => 83047777777777,1,Answer\n";
@@ -1708,17 +1716,17 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{$Vext .= "exten => 83047777777777,2,Playback(\${CALLERIDNAME})\n";}
else
{$Vext .= "exten => 83047777777777,2,Playback(\${CALLERID(name)})\n";}
$Vext .= "exten => 83047777777777,3,Hangup\n";
$Vext .= "exten => 83047777777777,3,Hangup()\n";
$Vext .= "; This is a loopback dial-around to allow for immediate answer of outbound calls\n";
$Vext .= "exten => _8305888888888888.,1,Answer\n";
$Vext .= "exten => _8305888888888888.,n,Wait(\${EXTEN:16:1})\n";
$Vext .= "exten => _8305888888888888.,n,Dial(\${TRUNKloop}/\${EXTEN:17},,To)\n";
$Vext .= "exten => _8305888888888888.,n,Hangup\n";
$Vext .= "exten => _8305888888888888.,n,Hangup()\n";
$Vext .= "; No-call silence extension\n";
$Vext .= "exten => _8305888888888888X999,1,Answer\n";
$Vext .= "exten => _8305888888888888X999,n,Wait($vicidial_recording_limit)\n";
$Vext .= "exten => _8305888888888888X999,n,Hangup\n";
$Vext .= "exten => _8305888888888888X999,n,Hangup()\n";
##### END Create Voicemail extensions for this server_ip #####
@@ -1947,8 +1955,20 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Piax .= "auth=md5\n";
$Piax .= "host=dynamic\n";
}
$Pext .= "exten => $dialplan[$i],1,Dial(IAX2/$extension[$i]|$phone_ring_timeout[$i]|)\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (!(( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6)))
{
$Pext .= "exten => $dialplan[$i],1,Dial(IAX2/$extension[$i]|$phone_ring_timeout[$i]|)\n";
}
else
{
$Pext .= "exten => $dialplan[$i],1,Dial(IAX2/$extension[$i],$phone_ring_timeout[$i],)\n";
}
$Pext .= "exten => $dialplan[$i],2,Goto(default,85026666666666$voicemail[$i],1)\n";
if (!(( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6)))
{
$Pext .= "exten => $dialplan[$i],3,Hangup()\n";
}
if ($delete_vm_after_email[$i] =~ /Y/)
{$vm .= "$voicemail[$i] => $pass[$i],$extension[$i] Mailbox,$email[$i],,|delete=yes|tz=$voicemail_timezone[$i]|$voicemail_options[$i]\n";}
@@ -2066,8 +2086,20 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Psip .= "type=friend\n";
$Psip .= "host=dynamic\n";
}
$Pext .= "exten => $dialplan[$i],1,Dial(SIP/$extension[$i]|$phone_ring_timeout[$i]|)\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$Pext .= "exten => $dialplan[$i],1,Dial(SIP/$extension[$i]|$phone_ring_timeout[$i]|)\n";
}
else
{
$Pext .= "exten => $dialplan[$i],1,Dial(SIP/$extension[$i],$phone_ring_timeout[$i],)\n";
}
$Pext .= "exten => $dialplan[$i],2,Goto(default,85026666666666$voicemail[$i],1)\n";
if (!(( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6)))
{
$Pext .= "exten => $dialplan[$i],3,Hangup()\n";
}
if ($delete_vm_after_email[$i] =~ /Y/)
{$vm .= "$voicemail[$i] => $pass[$i],$extension[$i] Mailbox,$email[$i],,|delete=yes|tz=$voicemail_timezone[$i]|$voicemail_options[$i]\n";}
@@ -2289,12 +2321,14 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$menu_invalid_prompt_ext .= "exten => i,$PRI,Set(INVCOUNT=\$[\$\{INVCOUNT\} + 1]) \n"; $PRI++;
$menu_invalid_prompt_ext .= "exten => i,$PRI,NoOp(\$\{INVCOUNT\}) \n"; $PRI++;
$menu_invalid_prompt_ext .= "exten => i,$PRI,Gotoif(\$[0\$\{INVCOUNT\} < 2]?" . $menu_id[$i] . ",s,4) \n"; $PRI++;
$menu_invalid_prompt_ext .= "exten => i,$PRI,Hangup()\n"; $PRI++;
}
if ( ($option_value[$j] =~ /INVALID_3RD/) && ($cm_invalid_set < 1) )
{
$menu_invalid_prompt_ext .= "exten => i,$PRI,Set(INVCOUNT=\$[\$\{INVCOUNT\} + 1]) \n"; $PRI++;
$menu_invalid_prompt_ext .= "exten => i,$PRI,NoOp(\${INVCOUNT}) \n"; $PRI++;
$menu_invalid_prompt_ext .= "exten => i,$PRI,Gotoif(\$[0\$\{INVCOUNT\} < 3]?" . $menu_id[$i] . ",s,4) \n"; $PRI++;
$menu_invalid_prompt_ext .= "exten => i,$PRI,Hangup()\n"; $PRI++;
}
$call_menu_line .= "$menu_invalid_prompt_ext";
@@ -2305,19 +2339,22 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,AGI($option_route_value[$j])\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,AGI($option_route_value[$j])\n"; $PRI++;
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
if ($option_route[$j] =~ /CALLMENU/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value[$j],s,1)\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value[$j],s,1)\n"; $PRI++;
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
if ($option_route[$j] =~ /DID/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(trunkinbound,$option_route_value[$j],1)\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(trunkinbound,$option_route_value[$j],1)\n"; $PRI++;
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
if ($option_route[$j] =~ /INGROUP/)
{
@@ -2334,20 +2371,23 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(agi-VDAD_ALL_inbound.agi,$IGhandle_method-----$IGsearch_method-----$option_route_value[$j]-----$menu_id[$i]--------------------$IGlist_id-----$IGphone_code-----$IGcampaign_id---------------$IGvid_enter_filename-----$IGvid_id_number_filename-----$IGvid_confirm_filename-----$IGvid_validate_digits)\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(agi-VDAD_ALL_inbound.agi,$IGhandle_method-----$IGsearch_method-----$option_route_value[$j]-----$menu_id[$i]--------------------$IGlist_id-----$IGphone_code-----$IGcampaign_id---------------$IGvid_enter_filename-----$IGvid_id_number_filename-----$IGvid_confirm_filename-----$IGvid_validate_digits)\n"; $PRI++;
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
if ($option_route[$j] =~ /EXTENSION/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
if (length($option_route_value_context[$j])>0) {$option_route_value_context[$j] = "$option_route_value_context[$j],";}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value_context[$j]$option_route_value[$j],1)\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value_context[$j]$option_route_value[$j],1)\n"; $PRI++;
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
if ($option_route[$j] =~ /VOICEMAIL/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,85026666666666$option_route_value[$j],1)\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,85026666666666$option_route_value[$j],1)\n"; $PRI++;
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
if ($option_route[$j] =~ /HANGUP/)
{
@@ -2377,13 +2417,13 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$call_menu_line .= "$hangup_prompt_ext";
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],n,Hangup\n";
$call_menu_line .= "exten => $option_value[$j],n,Hangup()\n";
}
else
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
}
if ($option_route[$j] =~ /PHONE/)
@@ -2411,7 +2451,8 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
}
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,$DIALstring$Pdialplan,1)\n";
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,$DIALstring$Pdialplan,1)\n"; $PRI++;
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n";
}
$sthA->finish();
}
@@ -2456,6 +2497,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{
$call_menu_options_ext .= "; time check after hours AGI special extension\n";
$call_menu_options_ext .= "exten => 9999999999999999999988,1,AGI($time_check_route_value)\n";
$call_menu_options_ext .= "exten => 9999999999999999999988,2,Hangup()\n";
$time_check_route = 'EXTENSION';
$time_check_route_value = '9999999999999999999988';
@@ -2465,6 +2507,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{
$call_menu_options_ext .= "; time check after hours INGROUP special extension\n";
$call_menu_options_ext .= "exten => 9999999999999999999988,1,AGI($CM_agi_string)\n";
$call_menu_options_ext .= "exten => 9999999999999999999988,2,Hangup()\n";
$time_check_route = 'EXTENSION';
$time_check_route_value = '9999999999999999999988';
@@ -2487,7 +2530,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{$call_menu_ext .= "exten => s,n,WaitExten($menu_timeout[$i])\n";}
$k++;
}
# $call_menu_ext .= "exten => s,n,Hangup\n";
# $call_menu_ext .= "exten => s,n,Hangup()\n";
$call_menu_ext .= "\n";
$call_menu_ext .= "$call_menu_options_ext";
$call_menu_ext .= "\n";
@@ -2498,10 +2541,12 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{
$call_menu_ext .= "exten => t,1,Playback($menu_timeout_prompt[$i])\n";
$call_menu_ext .= "exten => t,n,Goto(s,4)\n";
$call_menu_ext .= "exten => t,n,Hangup()\n";
}
else
{
$call_menu_ext .= "exten => t,1,Goto(s,4)\n";
$call_menu_ext .= "exten => t,n,Hangup()\n";
}
}
else
@@ -2514,10 +2559,12 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
{
$call_menu_ext .= "exten => i,1,Playback($menu_invalid_prompt[$i])\n";
$call_menu_ext .= "exten => i,n,Goto(s,4)\n";
$call_menu_ext .= "exten => i,n,Hangup()\n";
}
else
{
$call_menu_ext .= "exten => i,1,Goto(s,4)\n";
$call_menu_ext .= "exten => i,n,Hangup()\n";
}
}
else
@@ -2525,7 +2572,15 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$call_menu_ext .= "$call_menu_invalid_ext";
}
$call_menu_ext .= "; hangup\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$call_menu_ext .= 'exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
} else {
$call_menu_ext .= 'exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
}
if (length($custom_dialplan_entry[$i]) > 4)
{
@@ -2753,34 +2808,70 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
if (length($SScustom_dialplan_entry)>5)
{
print ext "[vicidial-auto-system-setting-custom]\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
print ext 'exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
} else {
print ext 'exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
}
print ext "\n";
print ext "; System Setting Custom Dialplan\n$SScustom_dialplan_entry\n\n";
}
if (length($SERVERcustom_dialplan_entry)>5)
{
print ext "[vicidial-auto-server-custom]\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
print ext 'exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
} else {
print ext 'exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
}
print ext "\n";
print ext "; Server Custom Dialplan\n$SERVERcustom_dialplan_entry\n\n";
}
print ext "[vicidial-auto-external]\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
print ext 'exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
} else {
print ext 'exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
}
print ext "\n";
print ext "$Lext\n";
print ext "[vicidial-auto-internal]\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
print ext 'exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
} else {
print ext 'exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
}
print ext "\n";
print ext "$Vext\n";
print ext "[vicidial-auto-phones]\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
print ext 'exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
} else {
print ext 'exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
}
print ext "\n";
print ext "$Pext\n";
print ext "[vicidial-auto]\n";
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
print ext 'exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
} else {
print ext 'exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})';
}
print ext "\n";
print ext "\n";
print ext "include => vicidial-auto-internal\n";
@@ -3159,3 +3250,46 @@ sub leading_zero($)
s/^(\d\d)$/0$1/;
return $_;
} # End of the leading_zero() routine.
# 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 );
}
+31 -11
View File
@@ -1,16 +1,17 @@
#!/usr/bin/perl
#
# ADMIN_restart_roll_logs.pl version 2.2.0
# ADMIN_restart_roll_logs.pl version 2.6
#
# script to roll the Asterisk logs on machine restart
#
# have this run on the astersik server
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES:
# 90311-0921 - Added /var/log/asterisk/screenlog log rolling
# 90508-0535 - Changes root screenlog to /var/log/astguiclient
# 130108-1715 - Changes for new log rolling script compatibility
#
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -27,23 +28,42 @@ $now_date = "$year-$mon-$mday---$hour$min$sec";
print "rolling Asterisk messages log...\n";
`mv -f /var/log/asterisk/messages /var/log/asterisk/messages.$now_date`;
if ( -e '/var/log/asterisk/messages' )
{
`mv -f /var/log/asterisk/messages /var/log/asterisk/messages.$now_date`;
}
print "rolling Asterisk event log...\n";
`mv -f /var/log/asterisk/event_log /var/log/asterisk/event_log.$now_date`;
if ( -e '/var/log/asterisk/event_log' )
{
`mv -f /var/log/asterisk/event_log /var/log/asterisk/event_log.$now_date`;
}
print "rolling Asterisk cdr logs...\n";
`mv -f /var/log/asterisk/cdr-csv/Master.csv /var/log/asterisk/cdr-csv/Master.csv.$now_date`;
`mv -f /var/log/asterisk/cdr-custom/Master.csv /var/log/asterisk/cdr-custom/Master.csv.$now_date`;
if ( -e '/var/log/asterisk/cdr-csv/Master.csv' )
{
`mv -f /var/log/asterisk/cdr-csv/Master.csv /var/log/asterisk/cdr-csv/Master.csv.$now_date`;
}
if ( -e '/var/log/asterisk/cdr-custom/Master.csv' )
{
`mv -f /var/log/asterisk/cdr-custom/Master.csv /var/log/asterisk/cdr-custom/Master.csv.$now_date`;
}
print "rolling Asterisk screen log...\n";
`mv -f /var/log/astguiclient/screenlog.0 /var/log/astguiclient/screenlog.0.$now_date`;
if ( -e '/var/log/astguiclient/screenlog.0' )
{
`mv -f /var/log/astguiclient/screenlog.0 /var/log/astguiclient/screenlog.0.$now_date`;
}
print "rolling Asterisk root screen log...\n";
`mv -f /root/screenlog.0 /root/screenlog.0.$now_date`;
if ( -e '/root/screenlog.0' )
{
`mv -f /root/screenlog.0 /var/log/astguiclient/screenlog.0.root.$now_date`;
}
print "rolling Asterisk var log screen log...\n";
`mv -f /var/log/asterisk/screenlog.0 /var/log/asterisk/screenlog.0.$now_date`;
if ( -e '/var/log/asterisk/screenlog.0' )
{
`mv -f /var/log/asterisk/screenlog.0 /var/log/asterisk/screenlog.0.asterisk.$now_date`;
}
print "FINISHED... EXITING\n";
+177 -112
View File
@@ -1,10 +1,10 @@
#!/usr/bin/perl
#
# AST_conf_update.pl version 2.4
# AST_conf_update.pl version 2.6
#
# This script checks if there are channels in reserved conferences
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# 50810-1532 - Added database server variable definitions lookup
# 50823-1456 - Added commandline arguments for debug at runtime
@@ -16,6 +16,7 @@
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
# 100811-2054 - Added --no-vc-3way-check flag to use when AST_conf_update_3way.pl script is used
# 100928-1506 - Changed from hard-coded 60 minute limit to servers.vicidial_recording_limit
# 130108-1712 - Changes for Asterisk 1.8 compatibility
#
# constants
@@ -119,7 +120,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vicidial_recording_limit FROM servers where server_ip = '$server_ip';";
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vicidial_recording_limit,asterisk_version FROM servers where server_ip = '$server_ip';";
if ($DB) {print "|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -140,6 +141,7 @@ if ($sthArows > 0)
$DBSERVER_GMT = $aryA[9];
$DBext_context = $aryA[10];
$vicidial_recording_limit = $aryA[11];
$asterisk_version = $aryA[12];
if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;}
if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;}
if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;}
@@ -238,7 +240,7 @@ if ($no_vc_3way_check < 1)
@aryA = $sthA->fetchrow_array;
$PTextensions[$rec_count] = $aryA[0];
$PT_conf_extens[$rec_count] = $aryA[1];
if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";}
if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";}
$rec_count++;
}
$sthA->finish();
@@ -260,71 +262,81 @@ if ($no_vc_3way_check < 1)
$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";
if ($DB) {print "|$PT_conf_extens[$i]|$COMMAND|\n";}
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/');
$j=0;
$conf_empty[$i]=0;
$conf_users[$i]='';
foreach(@list_channels)
{
if($DB){print "|$list_channels[$j]|\n";}
### mark all empty conferences and conferences with only one channel as empty
if ($list_channels[$j] =~ /No active conferences|No such conference/i)
{$conf_empty[$i]++;}
if ($list_channels[$j] =~ /1 users in that conference/i)
{$conf_empty[$i]++;}
$j++;
}
if($DB){print "Meetme list $PT_conf_extens[$i]- Exten:|$PTextensions[$i]| Empty:|$conf_empty[$i]| ";}
if (!$conf_empty[$i])
{
if($DB){print "CONFERENCE STILL HAS PARTICIPANTS, DOING NOTHING FOR THIS CONFERENCE\n";}
if ($PTextensions[$i] =~ /Xtimeout\d$/i)
if ( !( ( @PTextensions == 1 ) && ( $PTextensions[0] eq '') ) )
{
foreach(@PTextensions)
{
@list_channels=@MT;
$t->buffer_empty;
$COMMAND = "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n";
if ($DB) {print "|$PTextensions[$i]|$PT_conf_extens[$i]|$COMMAND|\n";}
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$PTextensions[$i] =~ s/Xtimeout\d$//gi;
$stmtA = "UPDATE vicidial_conferences set extension='$PTextensions[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/');
}
else
{
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Success\nPing: Pong.*/');
}
$j=0;
$conf_empty[$i]=0;
$conf_users[$i]='';
foreach(@list_channels)
{
if($DB){print "|$list_channels[$j]|\n";}
### mark all empty conferences and conferences with only one channel as empty
if ($list_channels[$j] =~ /No active conferences|No active MeetMe conferences|No such conference/i)
{$conf_empty[$i]++;}
if ($list_channels[$j] =~ /1 users in that conference/i)
{$conf_empty[$i]++;}
$j++;
}
if($DB){print "Meetme list $PT_conf_extens[$i]- Exten:|$PTextensions[$i]| Empty:|$conf_empty[$i]| ";}
if (!$conf_empty[$i])
{
if($DB){print "CONFERENCE STILL HAS PARTICIPANTS, DOING NOTHING FOR THIS CONFERENCE\n";}
if ($PTextensions[$i] =~ /Xtimeout\d$/i)
{
$PTextensions[$i] =~ s/Xtimeout\d$//gi;
$stmtA = "UPDATE vicidial_conferences set extension='$PTextensions[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
if($DB){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
}
else
{
$NEWexten[$i] = $PTextensions[$i];
$leave_3waySQL='1';
if ($PTextensions[$i] =~ /Xtimeout3$/i) {$NEWexten[$i] =~ s/Xtimeout3$/Xtimeout2/gi;}
if ($PTextensions[$i] =~ /Xtimeout2$/i) {$NEWexten[$i] =~ s/Xtimeout2$/Xtimeout1/gi;}
if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = ''; $leave_3waySQL='0';}
if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';}
if ($NEWexten[$i] =~ /Xtimeout1$/i)
{
### Kick all participants if there are any left in the conference so it can be reused
$local_DEF = 'Local/5555';
$local_AMP = '@';
$kick_local_channel = "$local_DEF$PT_conf_extens[$i]$local_AMP$ext_context";
$queryCID = "ULGC36$TDnum";
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Originate','$queryCID','Channel: $kick_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','','');";
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
if($DB){print STDERR "\n|$affected_rows|$stmtA|\n";}
}
$stmtA = "UPDATE vicidial_conferences set extension='$NEWexten[$i]',leave_3way='$leave_3waySQL' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
if($DB){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
$i++;
### sleep for 10 hundredths of a second
usleep(1*100*1000);
}
else
{
$NEWexten[$i] = $PTextensions[$i];
$leave_3waySQL='1';
if ($PTextensions[$i] =~ /Xtimeout3$/i) {$NEWexten[$i] =~ s/Xtimeout3$/Xtimeout2/gi;}
if ($PTextensions[$i] =~ /Xtimeout2$/i) {$NEWexten[$i] =~ s/Xtimeout2$/Xtimeout1/gi;}
if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = ''; $leave_3waySQL='0';}
if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';}
if ($NEWexten[$i] =~ /Xtimeout1$/i)
{
### Kick all participants if there are any left in the conference so it can be reused
$local_DEF = 'Local/5555';
$local_AMP = '@';
$kick_local_channel = "$local_DEF$PT_conf_extens[$i]$local_AMP$ext_context";
$queryCID = "ULGC36$TDnum";
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Originate','$queryCID','Channel: $kick_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','','');";
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
if($DB){print STDERR "\n|$affected_rows|$stmtA|\n";}
}
$stmtA = "UPDATE vicidial_conferences set extension='$NEWexten[$i]',leave_3way='$leave_3waySQL' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
if($DB){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
$i++;
### sleep for 10 hundredths of a second
usleep(1*100*1000);
}
$t->buffer_empty;
@@ -379,64 +391,75 @@ $t->waitfor('/Authentication accepted/'); # waitfor auth accepted
$i=0;
foreach(@PTextensions)
if ( !( ( @PTextensions == 1 ) && ( $PTextensions[0] eq '') ) )
{
if (length($PT_conf_extens[$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";
if ($DB) {print "|$PT_conf_extens[$i]|$COMMAND|\n";}
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/');
$j=0;
$conf_empty[$i]=0;
$conf_users[$i]='';
foreach(@list_channels)
if (length($PT_conf_extens[$i]) > 0)
{
if($DB){print "|$list_channels[$j]|\n";}
if ($list_channels[$j] =~ /No active conferences|No such conference/i)
{$conf_empty[$i]++;}
# if ($list_channels[$j] =~ /^User /i)
# {
# $userx = '';
# $userx = $list_channels[$j];
# $userx =~ s/User \#: //gi;
# $conf_users[$i] .= "$userx|";
# }
$j++;
}
if($DB){print "Meetme list $PT_conf_extens[$i]- Exten:|$PTextensions[$i]| Empty:|$conf_empty[$i]| ";}
if (!$conf_empty[$i])
{
if($DB){print "CONFERENCE STILL HAS PARTICIPANTS, DOING NOTHING FOR THIS CONFERENCE\n";}
if ($PTextensions[$i] =~ /Xtimeout\d$/i)
@list_channels=@MT;
$t->buffer_empty;
$COMMAND = "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n";
if ($DB) {print "|$PT_conf_extens[$i]|$COMMAND|\n";}
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$PTextensions[$i] =~ s/Xtimeout\d$//gi;
$stmtA = "UPDATE conferences set extension='$PTextensions[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/');
}
else
{
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Success\nPing: Pong.*/');
}
$j=0;
$conf_empty[$i]=0;
$conf_users[$i]='';
foreach(@list_channels)
{
if($DB){print "|$list_channels[$j]|\n";}
if ($list_channels[$j] =~ /No active conferences|No active MeetMe conferences|No such conference/i)
{$conf_empty[$i]++;}
# if ($list_channels[$j] =~ /^User /i)
# {
# $userx = '';
# $userx = $list_channels[$j];
# $userx =~ s/User \#: //gi;
# $conf_users[$i] .= "$userx|";
# }
$j++;
}
if($DB){print "Meetme list $PT_conf_extens[$i]- Exten:|$PTextensions[$i]| Empty:|$conf_empty[$i]| ";}
if (!$conf_empty[$i])
{
if($DB){print "CONFERENCE STILL HAS PARTICIPANTS, DOING NOTHING FOR THIS CONFERENCE\n";}
if ($PTextensions[$i] =~ /Xtimeout\d$/i)
{
$PTextensions[$i] =~ s/Xtimeout\d$//gi;
$stmtA = "UPDATE conferences set extension='$PTextensions[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
if($DB){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
}
else
{
$NEWexten[$i] = $PTextensions[$i];
if ($PTextensions[$i] =~ /Xtimeout3$/i) {$NEWexten[$i] =~ s/Xtimeout3$/Xtimeout2/gi;}
if ($PTextensions[$i] =~ /Xtimeout2$/i) {$NEWexten[$i] =~ s/Xtimeout2$/Xtimeout1/gi;}
if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = '';}
if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';}
$stmtA = "UPDATE conferences set extension='$NEWexten[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
if($DB){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
}
else
{
$NEWexten[$i] = $PTextensions[$i];
if ($PTextensions[$i] =~ /Xtimeout3$/i) {$NEWexten[$i] =~ s/Xtimeout3$/Xtimeout2/gi;}
if ($PTextensions[$i] =~ /Xtimeout2$/i) {$NEWexten[$i] =~ s/Xtimeout2$/Xtimeout1/gi;}
if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = '';}
if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';}
$stmtA = "UPDATE conferences set extension='$NEWexten[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
if($DB){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
}
$i++;
$i++;
### sleep for 10 hundredths of a second
usleep(1*100*1000);
}
}
@@ -452,3 +475,45 @@ if($DB){print "DONE... Exiting... Goodbye... See you later... \n";}
exit;
# 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 );
}
+58 -5
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_conf_update_3way.pl version 2.4
# AST_conf_update_3way.pl version 2.6
#
# This script checks leave 3way vicidial_conferences for participants
# This is a constantly running script that is in the keepalive_ALL script, to
@@ -11,10 +11,11 @@
# script's crontab entry that does some of these functions:
# AST_conf_update.pl --no-vc-3way-check
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# 100811-2119 - First build, based upon AST_conf_update.pl script
# 100928-1506 - Changed from hard-coded 60 minute limit to servers.vicidial_recording_limit
# 130108-1707 - Changes for Asterisk 1.8 compatibility
#
# constants
@@ -138,7 +139,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vicidial_recording_limit FROM servers where server_ip = '$server_ip';";
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vicidial_recording_limit,asterisk_version FROM servers where server_ip = '$server_ip';";
if ($DB) {print "|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -159,6 +160,7 @@ if ($sthArows > 0)
$DBSERVER_GMT = $aryA[9];
$DBext_context = $aryA[10];
$vicidial_recording_limit = $aryA[11];
$asterisk_version = $aryA[12];
if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;}
if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;}
if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;}
@@ -252,7 +254,15 @@ while ($loops > $loop_counter)
$t->buffer_empty;
$COMMAND = "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n";
if ($DBX) {print "|$PT_conf_extens[$i]|$COMMAND|\n";}
@list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/');
%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.*/');
}
$j=0;
$conf_empty[$i]=0;
@@ -261,7 +271,7 @@ while ($loops > $loop_counter)
{
if($DBX){print "|$list_channels[$j]|\n";}
### mark all empty conferences and conferences with only one channel as empty
if ($list_channels[$j] =~ /No active conferences|No such conference/i)
if ($list_channels[$j] =~ /No active conferences|No active MeetMe conferences|No such conference/i)
{$conf_empty[$i]++;}
if ($list_channels[$j] =~ /1 users in that conference/i)
{$conf_empty[$i]++;}
@@ -354,3 +364,46 @@ if($DB){print "DONE... Exiting... Goodbye... See you later... \n";}
exit;
# 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 );
}
+821 -408
View File
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_send_action_child.pl version 2.4
# AST_send_action_child.pl version 2.6
#
# Part of the Asterisk Central Queue System (ACQS)
#
@@ -14,7 +14,7 @@
# to be executed. connect to the manager interface, send the action and logoff
# then exit.
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 50810-1547 - Added database server variable definitions lookup
@@ -30,6 +30,7 @@
# 80418-0927 - Added man_id to logging output for better tracking, raised sleep times
# 100625-1141 - Added waitfors after orginate and logout to fix broken pipe errors in asterisk <MikeC>
# 100625-1206 - Use strict is a performance hit and should only be uncommented for debugging <MikeC>
# 130108-1714 - Changes for Asterisk 1.8 compatibility
#
$|++;
@@ -249,7 +250,7 @@ if ($action) {
$tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$tn->buffer_empty;
$tn->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$tn->waitfor(Match => '/Message:.*\n\n/', Timeout => 15);
if ($FULL_LOG and $SYSLOG) {
my $event_string = $man_id . "|2|" . $data1 . "|";
+8 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_update.pl version 2.4
# AST_update.pl version 2.6
#
# DESCRIPTION:
# uses the Asterisk Manager interface and Net::MySQL to update the live_channels
@@ -30,7 +30,7 @@
#
# It is recommended that you run this program on the local Asterisk machine
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# version changes:
# 41228-1659 - modified to compensate for manager output response hiccups
@@ -60,9 +60,10 @@
# 90604-1127 - Added support for DAHDI channels
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
# 101004-1042 - Updated parked_channels checking for changes to parked calls functions
# 130108-1710 - Changes for Asterisk 1.8 compatibility
#
$build = '101004-1042';
$build = '130108-1710';
# constants
$SYSPERF=0; # system performance logging to MySQL server_performance table every 5 seconds
@@ -289,6 +290,8 @@ $sthA->finish();
$show_channels_format = 1;
if ($AST_ver =~ /^1\.0/i) {$show_channels_format = 0;}
if ($AST_ver =~ /^1\.4/i) {$show_channels_format = 2;}
if ($AST_ver =~ /^1\.6/i) {$show_channels_format = 3;}
if ($AST_ver =~ /^1\.8/i) {$show_channels_format = 4;}
print STDERR "SHOW CHANNELS format: $show_channels_format\n";
@@ -848,7 +851,8 @@ while($one_day_interval > 0)
# $bridged = $list_chan_12[11];
}
$extension =~ s/^SIP\/|-\S+$//gi;
$extension =~ s/\|.*//gi;
$extension =~ s/\|.*//gi; # remove everything after the |
$extension =~ s/,.*//gi; # remove everything after the ,
$QRYchannel = "$channel$US$extension";
if( ($DB) or ($UD_bad_grab) ){print "channel: |$channel|\n";}
+130 -36
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_vm_update.pl version 2.4
# AST_vm_update.pl version 2.6
#
# DESCRIPTION:
# uses the Asterisk Manager interface to update the count of voicemail messages
@@ -12,7 +12,7 @@
# more than this either change the cron when this script is run or change the
# wait interval below
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# 50823-1422 - Added database server variable definitions lookup
# 50823-1452 - Added commandline arguments for debug at runtime
@@ -20,6 +20,7 @@
# 60715-2301 - Changed to use /etc/astguiclient.conf for configs
# 90919-1739 - Added other voicemail checking from vicidial_voicemail table
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
# 130108-1713 - Changes for Asterisk 1.8 compatibility
#
# constants
@@ -111,7 +112,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';";
$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,asterisk_version FROM servers where server_ip = '$server_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
if ($DB) {print "|$stmtA|\n";}
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -120,17 +121,18 @@ $rec_count=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$DBtelnet_host = "$aryA[0]";
$DBtelnet_port = "$aryA[1]";
$DBASTmgrUSERNAME = "$aryA[2]";
$DBASTmgrSECRET = "$aryA[3]";
$DBASTmgrUSERNAMEupdate = "$aryA[4]";
$DBASTmgrUSERNAMElisten = "$aryA[5]";
$DBASTmgrUSERNAMEsend = "$aryA[6]";
$DBmax_vicidial_trunks = "$aryA[7]";
$DBanswer_transfer_agent= "$aryA[8]";
$DBSERVER_GMT = "$aryA[9]";
$DBext_context = "$aryA[10]";
$DBtelnet_host = $aryA[0];
$DBtelnet_port = $aryA[1];
$DBASTmgrUSERNAME = $aryA[2];
$DBASTmgrSECRET = $aryA[3];
$DBASTmgrUSERNAMEupdate = $aryA[4];
$DBASTmgrUSERNAMElisten = $aryA[5];
$DBASTmgrUSERNAMEsend = $aryA[6];
$DBmax_vicidial_trunks = $aryA[7];
$DBanswer_transfer_agent= $aryA[8];
$DBSERVER_GMT = $aryA[9];
$DBext_context = $aryA[10];
$asterisk_version = $aryA[11];
if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;}
if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;}
if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;}
@@ -177,26 +179,49 @@ $t->waitfor('/[01]\n$/'); # print login
$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n");
$t->waitfor('/Authentication accepted/'); # waitfor auth accepted
$i=0;
foreach(@PTextensions)
{
@list_channels=@MT;
$t->buffer_empty;
@list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/');
$j=0;
foreach(@list_channels)
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/)
@list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/');
$j=0;
foreach(@list_channels)
{
$NEW_messages[$i] = "$list_channels[$j+1]";
$NEW_messages[$i] =~ s/NewMessages: |\n//gi;
$OLD_messages[$i] = "$list_channels[$j+2]";
$OLD_messages[$i] =~ s/OldMessages: |\n//gi;
if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/)
{
$NEW_messages[$i] = "$list_channels[$j+1]";
$NEW_messages[$i] =~ s/NewMessages: |\n//gi;
$OLD_messages[$i] = "$list_channels[$j+2]";
$OLD_messages[$i] =~ s/OldMessages: |\n//gi;
}
$j++;
}
}
else
{
@list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Success\nPing: Pong.*/');
$j=0;
foreach(@list_channels)
{
if($DB){print "$j - $list_channels[$j]";}
if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/)
{
$URG_messages[$i] = "$list_channels[$j+1]";
$URG_messages[$i] =~ s/UrgMessages: |\n//gi;
$NEW_messages[$i] = "$list_channels[$j+2]";
$NEW_messages[$i] =~ s/NewMessages: |\n//gi;
$OLD_messages[$i] = "$list_channels[$j+3]";
$OLD_messages[$i] =~ s/OldMessages: |\n//gi;
}
$j++;
$j++;
}
}
if($DB){print "MailboxCount- $PTvoicemail_ids[$i] NEW:|$NEW_messages[$i]| OLD:|$OLD_messages[$i]| ";}
@@ -258,21 +283,46 @@ if ($active_voicemail_server > 0)
{
@list_channels=@MT;
$t->buffer_empty;
@list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/');
$j=0;
foreach(@list_channels)
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/)
@list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/');
$j=0;
foreach(@list_channels)
{
$NEW_messages[$i] = "$list_channels[$j+1]";
$NEW_messages[$i] =~ s/NewMessages: |\n//gi;
$OLD_messages[$i] = "$list_channels[$j+2]";
$OLD_messages[$i] =~ s/OldMessages: |\n//gi;
if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/)
{
$NEW_messages[$i] = "$list_channels[$j+1]";
$NEW_messages[$i] =~ s/NewMessages: |\n//gi;
$OLD_messages[$i] = "$list_channels[$j+2]";
$OLD_messages[$i] =~ s/OldMessages: |\n//gi;
}
$j++;
}
$j++;
}
else
{
@list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Success\nPing: Pong.*/');
$j=0;
foreach(@list_channels)
{
if($DB){print "$j - $list_channels[$j]";}
if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/)
{
$URG_messages[$i] = "$list_channels[$j+1]";
$URG_messages[$i] =~ s/UrgMessages: |\n//gi;
$NEW_messages[$i] = "$list_channels[$j+2]";
$NEW_messages[$i] =~ s/NewMessages: |\n//gi;
$OLD_messages[$i] = "$list_channels[$j+3]";
$OLD_messages[$i] =~ s/OldMessages: |\n//gi;
}
$j++;
}
}
if($DB){print "MailboxCount- $PTvoicemail_ids[$i] NEW:|$NEW_messages[$i]| OLD:|$OLD_messages[$i]| ";}
if ( ($NEW_messages[$i] eq $PTmessages[$i]) && ($OLD_messages[$i] eq $PTold_messages[$i]) )
@@ -309,3 +359,47 @@ $dbhA->disconnect();
if($DB){print "DONE... Exiting... Goodbye... See you later... \n";}
exit;
# 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 );
}
+3
View File
@@ -81,6 +81,9 @@ groups, most of these fields work in the same way) and submit the new email
account. When you are ready to have Vicidial start checking it for emails, be
sure the "Active" setting is set to "Y".
Also make sure that any campaigns that you want to have email handling active on
should have the "Allow Emails" setting set to Y.
The checking of email accounts is handled by a cron job that should only be
active on ONLY ONE server on your Vicidial installation:
@@ -0,0 +1,666 @@
[general]
static=yes
writeprotect=no
[globals]
CONSOLE=Console/dsp ; Console interface for demo
TRUNK=DAHDI/r1 ; Trunk interface
TRUNKX=DAHDI/r2 ; 2nd trunk interface
TRUNKIAX=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface
TRUNKIAX1=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface
TRUNKBINFONE=IAX2/1112223333:PASSWORD@iax.binfone.com ; IAX trunk interface
SIPtrunk=SIP/1234:PASSWORD@sip.provider.net ; SIP trunk
#include extensions-vicidial.conf
[trunkinbound]
; DID call routing process
; exten => _XXXXXXXXXX,1,AGI(agi-DID_route.agi) ; use this one instead of the one below if you are having delay issues, and match to number of received digits
exten => _X.,1,AGI(agi-DID_route.agi)
exten => _X.,n,Hangup()
; If you have DIDs that arrive with a plus sign at the beginning then uncomment
;exten => _+X.,1,AGI(agi-DID_route.agi)
;exten => _+X.,n,Hangup()
; FastAGI for VICIDIAL/astGUIclient call logging
exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
[loopback-no-log]
; This context is to accept calls that have already been logged in another context in Vicidial
; and has been sent through one of the loopbacks. This is why this context is missing the h extension.
; Do not put any extensions in this context unless you specifically understand what this means.
;exten => _91NXXNXXXXXX,1,Dial(${TRUNKX}/${EXTEN:1},,To)
;exten => _91NXXNXXXXXX,n,Hangup()
; special Canadian PRI callerIDname settings FOR USE IN LOOPBACK CONTEXT ONLY
;exten => _91NXXNXXXXXX,1,Set(CALLERID(name)="ACME Widgets")
;exten => _91NXXNXXXXXX,n,AGI(agi-CANADA_PRI_CIDname.agi)
;exten => _91NXXNXXXXXX,n,Dial(${TRUNKX}/${EXTEN:1},,To)
;exten => _91NXXNXXXXXX,n,Hangup()
exten => _999XX11112,1,Wait(2)
exten => _999XX11112,n,Answer()
exten => _999XX11112,n,Playback(ss-noservice)
exten => _999XX11112,n,Playback(vm-goodbye)
exten => _999XX11112,n,Hangup()
[default]
include => vicidial-auto
; Local agent alert extensions
exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
exten => _8600XXX*.,n,Hangup()
exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
exten => _78600XXX*.,n,Hangup()
; Local blind monitoring
exten => _08600XXX,1,Dial(${TRUNKblind}/6${EXTEN:1},55,To)
exten => _08600XXX,n,Hangup()
; playback of recorded prompts
exten => _851XXXXX,1,Answer()
exten => _851XXXXX,n,Playback(${EXTEN})
exten => _851XXXXX,n,Hangup()
; this is used for playing a message to an answering machine forwarded from AMD in VICIDIAL
exten => _6851XXXXX,1,Answer()
exten => _6851XXXXX,n,WaitForSilence(2000,1,90)
exten => _6851XXXXX,n,Playback(sip-silence)
exten => _6851XXXXX,n,Playback(${EXTEN:1})
exten => _6851XXXXX,n,Hangup()
exten => _7851XXXXX,1,WaitForSilence(2000,2) ; AMD got machine. leave message after recording
exten => _7851XXXXX,n,Playback(${EXTEN:1})
exten => _7851XXXXX,n,AGI(VD_amd_post.agi,${EXTEN:1})
exten => _7851XXXXX,n,Hangup()
; FastAGI for VICIDIAL/astGUIclient call logging
exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
; Example phone extensions
; 100-350 phone extensions now auto-generated, so no need to uncommend them
; extensions for other SIP and IAX call center phones
; cc100-cc150 SIP Phones
;exten => _1[0-5]X,1,Dial(sip/cc${EXTEN},20,to)
;exten => _1[0-5]X,n,Hangup()
; cc300-cc350 IAX Phones
;exten => _3[0-5]X,1,Dial(IAX2/cc${EXTEN},20,to)
;exten => _3[0-5]X,n,Hangup()
; extensions if using a T1 channelbank
;exten => _19XX,1,Dial(Zap/${EXTEN:2},30,o)
;exten => _19XX,n,Hangup()
; Extension 4001 rings Zap phone (this example for FXS on Zap port 1)
;exten => 4001,1,Dial(Zap/1,30,o) ; ring Zap device 1
;exten => 4001,n,Voicemail(u4001) ; Send to voicemail...
;exten => 4001,n,Hangup()
; # timeout invalid rules
exten => #,1,Playback(invalid) ; "Thanks for trying the demo"
exten => #,2,Hangup() ; Hang them up.
exten => t,1,Goto(#,1) ; If they take too long, give up
exten => t,n,Hangup()
exten => i,1,Playback(invalid) ; "That's not valid, try again"
exten => i,n,Hangup()
; Extensions for performance testing
;exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _91999NXXXXXX,n,Dial(${TRUNKloop}/${EXTEN:2},,tTo)
;exten => _91999NXXXXXX,n,Hangup()
;exten => 999999999999,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => 999999999999,n,Dial(${TRUNKloop}/${EXTEN:1},,tTo)
;exten => 999999999999,n,Hangup()
; This is a loopback dialaround to allow for hearing of ringing for 3way calls
exten => _881NXXNXXXXXX,1,Answer()
exten => _881NXXNXXXXXX,n,Dial(${TRUNKloop}/9${EXTEN:2},,To)
exten => _881NXXNXXXXXX,n,Hangup()
; Vtiger fax and email log extensions
exten => _9118XXXXXXXX,1,Dial(${TRUNKblind}/9998818112,55,to)
exten => _9118XXXXXXXX,n,Hangup()
exten => _9119XXXXXXXX,1,Dial(${TRUNKblind}/9998819112,55,to)
exten => _9119XXXXXXXX,n,Hangup()
; CARRIER DIALING EXTENSIONS, USE THE ADMIN INTERFACE TO PROGRAM THESE
; dial an 800 outbound number
;exten => _91800NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _91800NXXXXXX,n,Dial(${TRUNK}/${EXTEN:1},,To)
;exten => _91800NXXXXXX,n,Hangup()
;exten => _91888NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _91888NXXXXXX,n,Dial(${TRUNK}/${EXTEN:1},,To)
;exten => _91888NXXXXXX,n,Hangup()
;exten => _91877NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _91877NXXXXXX,n,Dial(${TRUNK}/${EXTEN:1},,To)
;exten => _91877NXXXXXX,n,Hangup()
;exten => _91866NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _91866NXXXXXX,n,Dial(${TRUNK}/${EXTEN:1},,To)
;exten => _91866NXXXXXX,n,Hangup()
;exten => _91855NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _91855NXXXXXX,n,Dial(${TRUNK}/${EXTEN:1},,To)
;exten => _91855NXXXXXX,n,Hangup()
; dial a long distance outbound number
; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls
;exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _91NXXNXXXXXX,n,Dial(${TRUNKX}/${EXTEN:1},,To)
;exten => _91NXXNXXXXXX,n,Hangup()
; dial a local outbound number (modified because of only LD T1)
;exten => _9NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _9NXXXXXX,n,Dial(${TRUNK}/1727${EXTEN:1},,To)
;exten => _9NXXXXXX,n,Hangup()
; dial a local 727 outbound number with area code
;exten => _9727NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _9727NXXXXXX,n,Dial(${TRUNK}/1${EXTEN:1},,To)
;exten => _9727NXXXXXX,n,Hangup()
; dial a long distance outbound number to the UK
; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls,
;exten => _901144XXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _901144XXXXXXXXXX,n,Dial(${TRUNKX}/${EXTEN:1},55,To)
;exten => _901144XXXXXXXXXX,n,Hangup()
; dial a long distance outbound number to Australia
; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls,
;exten => _901161XXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
;exten => _901161XXXXXXXXX,n,Dial(${TRUNKX}/${EXTEN:1},,To)
;exten => _901161XXXXXXXXX,n,Hangup()
; dial a long distance outbound number through BINFONE
; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91NXXNXXXXXX,n,Dial(${TRUNKIAX}/${EXTEN:1},55,To)
; exten => _91NXXNXXXXXX,n,Hangup()
; dial a long distance outbound number through a SIP provider
; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91NXXNXXXXXX,n,Dial(sip/${EXTEN:1}@SIPtrunk,55,o)
; exten => _91NXXNXXXXXX,n,Hangup()
; special extensions for North America to catch invalid phone numbers
; exten => _91XXX[0-1]XXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXX[0-1]XXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXX[0-1]XXXXXX,n,Hangup()
; exten => _91[0-1]XXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91[0-1]XXXXXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91[0-1]XXXXXXXXX,n,Hangup()
; exten => _91XXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXXXXX,n,Hangup()
; exten => _91XXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXXXXXX,n,Hangup()
; exten => _91XXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXXXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXXXXXXX,n,Hangup()
; exten => _91XXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXXXXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXXXXXXXX,n,Hangup()
; exten => _91XXXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXXXXXXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXXXXXXXXXX,n,Hangup()
; exten => _91XXXXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXXXXXXXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXXXXXXXXXXX,n,Hangup()
; exten => _91XXXXXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91XXXXXXXXXXXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91XXXXXXXXXXXXX,n,Hangup()
; block calls to 555 numbers
; exten => _91NXX555NXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91NXX555NXXX,n,Dial(${TRUNKloop}/8889990011112,,to)
; exten => _91NXX555NXXX,n,Hangup()
; dial a USA long distance outbound number through the loopback-no-log context
; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => _91NXXNXXXXXX,n,Dial(${TRUNKloop}/888${EXTEN:2},55,o)
; exten => _91NXXNXXXXXX,n,Hangup()
;exten => _888NXXNXXXXXX,1,Goto(loopback-no-log,91${EXTEN:3},1)
;exten => _888NXXNXXXXXX,n,Hanguo()
exten => 8889990011112,1,Goto(loopback-no-log,9990011112,1)
exten => 8889990011112,n,Hanguo()
; Inbound call from BINFONE
; exten => 1112223333,1,AGI(agi://127.0.0.1:4577/call_log)
; exten => 1112223333,n,Dial(sip/gs102,55,o)
; exten => 1112223333,n,Hangup()
; Extension 7275551212 - Inbound local number from PRI with 10 digit delivery
;exten => 7275551212,1,Ringing()
;exten => 7275551212,n,Wait(1)
;exten => 7275551212,n,AGI(agi://127.0.0.1:4577/call_log--fullCID--${EXTEN}-----${CALLERID(all)}-----${CALLERID(num)}-----${CALLERID(name)})
;exten => 7275551212,n,Answer()
;exten => 7275551212,n,Dial(sip/spa2000&sip/spa2001,30,To)
;exten => 7275551212,n,Voicemail(u2000)
;exten => 7275551212,n,Hangup()
; parameters for call_inbound.agi (7 fields separated by five dashes "-----"):
; 1. the extension of the phone to ring as defined in the asterisk.phones table
; 2. the phone number that was called, for the live_inbound/_log entry
; 3. a text description of the number that was called in
; 4-7. optional fields, they are also passed as fields in the GUI to web browser
; This is not part of VICIDIAL, it is for astGUIclient agent use only
; Extension 3429 - Inbound 800 number (1-800-555-3429) example of RBS T1
; with 10 digit ANI and 4 digit DNIS star separated
;exten => _**3429,1,Ringing
;exten => _**3429,n,AGI(agi://127.0.0.1:4577/call_log)
;exten => _**3429,n,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w)
;exten => _**3429,n,Answer()
;exten => _**3429,n,Dial(sip/spa2000&sip/spa2001,30,to)
;exten => _**3429,n,Voicemail(u2000)
;exten => _**3429,n,Hangup()
; Extension 3429 - with ANI [callerID]
;exten => _*NXXNXXXXXX*3429,1,Ringing
;exten => _*NXXNXXXXXX*3429,n,AGI(agi://127.0.0.1:4577/call_log)
;exten => _*NXXNXXXXXX*3429,n,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w)
;exten => _*NXXNXXXXXX*3429,n,Answer()
;exten => _*NXXNXXXXXX*3429,n,Dial(sip/spa2000&sip/spa2001,30,to)
;exten => _*NXXNXXXXXX*3429,n,Voicemail(u2000)
;exten => _*NXXNXXXXXX*3429,n,Hangup()
; parameters for agi-VDAD_ALL_inbound.agi (upto 12 fields separated by five dashes "-----"):
; Below are the parameters needed for the script to be run properly
; 1. the method of call handling for the script:
; - CID - CID received, add record with phone number
; - CIDLOOKUP - Lookup CID to find record in whole system
; - CIDLOOKUPRL - Restrict lookup to one list
; - CIDLOOKUPRC - Restrict lookup to one campaign's lists
; - CLOSER - Closer calls from VICIDIAL fronters
; - ANI - ANI received, add record with phone number (based on RBS T1s)
; - ANILOOKUP - Lookup ANI to find record in whole system
; - ANILOOKUPRL - Restrict lookup to one list
; - ANILOOKUPRC - Restrict lookup to one campaign's lists
; - VID - Add record with Vendor Lead Code received as argument 12
; - VIDLOOKUP - Lookup Vendor Lead Code received as argument 12 to find record in whole system
; - VIDLOOKUPRL - Restrict lookup to one list (argument 12)
; - VIDLOOKUPRC - Restrict lookup to one campaign's lists (argument 12)
; - VIDPROMPT - Prompt Vendor Lead Code to User with IVR to add record with Vendor Lead Code
; - VIDPROMPTLOOKUP - Prompt Vendor Lead Code to User with IVR to find record in whole system
; - VIDPROMPTLOOKUPRL - Restrict lookup to one list
; - VIDPROMPTLOOKUPRC - Restrict lookup to one campaign's lists
; - 3DIGITID - Enter 3 digit code to go to agent
; - 4DIGITID - Enter 4 digit code to go to agent
; - XDIGITID - Enter X digit code to go to agent(variable, i.e. 9DIGITID, 12DIGITID, etc...)
; 2. the method of searching for an available agent:
; - LO - Load Balance Overflow only (priority to home server)
; - LB - <default> Load Balance total system
; - SO - Home server only
; 3. the full name of the IN GROUP to be used in vicidial for the inbound call
; 4. the phone number that was called, for the log entry
; 5. the callerID or lead_id of the person that called(usually overridden)
; 6. the park extension audio file name if used
; 7. the status of the call initially(usually not used)
; 8. the list_id to insert the new lead under if it is new (and CID/ANI available)
; 9. the phone dialing code to insert with the new lead if new (and CID/ANI available)
; 10. the campaign_id to search within lists if CIDLOOKUPRC
; 11. the user to queue the call to for AGENTDIRECT in-group calls
; 12. vendor_lead_code if external mechanism like custom IVR is used to prompt user for ID
;
; inbound VICIDIAL call with CID delivery through T1 PRI
;exten => 1234,1,Answer() ; Answer the line
;exten => 1234,n,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----CL_GALLERIA-----7274515134-----Closer-----park----------999-----1)
;exten => 1234,n,Hangup()
; inbound VICIDIAL transfer calls [can arrive through PRI T1 crossover, IAX or SIP channel]
exten => _90009.,1,Answer() ; Answer the line
exten => _90009.,n,Dial(${TRUNKloop}/9${EXTEN},,to)
exten => _90009.,n,Hangup()
exten => _990009.,1,Answer() ; Answer the line, Sometimes needs to be removed
exten => _990009.,n,AGI(agi-VDAD_ALL_inbound.agi,CLOSER-----LB-----CL_TESTCAMP-----7275551212-----Closer-----park----------999-----1)
exten => _990009.,n,Hangup()
; DID forwarded calls
exten => _99909*.,1,Answer()
exten => _99909*.,n,AGI(agi-VDAD_ALL_inbound.agi)
exten => _99909*.,n,Hangup()
; barge monitoring extension
exten => 8159,1,ZapBarge()
exten => 8159,n,Hangup()
; ZapBarge direct channel extensions
exten => _86120XX,1,ZapBarge(${EXTEN:5})
exten => _86120XX,n,Hangup()
; MeetMe Adjustment Extensions
exten => _X48600XXX,1,MeetMeAdmin(${EXTEN:2},T,${EXTEN:0:1})
exten => _X48600XXX,2,Hangup()
exten => _X38600XXX,1,MeetMeAdmin(${EXTEN:2},t,${EXTEN:0:1})
exten => _X38600XXX,2,Hangup()
exten => _X28600XXX,1,MeetMeAdmin(${EXTEN:2},m,${EXTEN:0:1})
exten => _X28600XXX,2,Hangup()
exten => _X18600XXX,1,MeetMeAdmin(${EXTEN:2},M,${EXTEN:0:1})
exten => _X18600XXX,2,Hangup()
exten => _55558600XXX,1,MeetMeAdmin(${EXTEN:4},K)
exten => _55558600XXX,2,Hangup()
; immediate hangup extension
exten => 8300,1,Hangup()
; astGUIclient conferences
exten => _86000[0-4]X,1,Meetme(${EXTEN},q)
exten => _86000[0-4]X,n,Hangup()
; VICIDIAL conferences
exten => _86000[5-9]X,1,Meetme(${EXTEN},F)
exten => _86000[5-9]X,n,Hangup()
exten => _8600[1-2]XX,1,Meetme(${EXTEN},F)
exten => _8600[1-2]XX,n,Hangup()
; quiet entry and leaving conferences for VICIDIAL (inbound announce, SendDTMF and ring-agent)
exten => _78600XXX,1,Meetme(${EXTEN:1},Fq)
exten => _78600XXX,n,Hangup()
; quiet monitor-only extensions for meetme rooms (for room managers)
exten => _68600XXX,1,Meetme(${EXTEN:1},Fmq)
exten => _68600XXX,n,Hangup()
; Asterisk 1.8 workaround
exten => _58600XXX,1,Meetme(${EXTEN:1},Fmq)
exten => _58600XXX,n,Hangup()
; quiet monitor-only entry and leaving conferences for VICIDIAL (recording)
exten => _558600XXX,1,Meetme(${EXTEN:2},Fmq)
exten => _558600XXX,n,Hangup()
; voicelab exten
exten => _86009XX,1,Meetme(${EXTEN},Fmq)
; voicelab exten moderator
exten => _986009XX,1,Meetme(${EXTEN:1})
; park channel for client GUI parking, hangup after 30 minutes
; create a GSM formatted audio file named "park.gsm" that is 30 minutes long
; and put it in /var/lib/asterisk/sounds
exten => 8301,1,Answer()
exten => 8301,n,AGI(park_CID.agi)
exten => 8301,n,Playback(park)
exten => 8301,n,Hangup()
exten => 8303,1,Answer()
exten => 8303,n,AGI(park_CID.agi)
exten => 8303,n,Playback(conf)
exten => 8303,n,Hangup()
; park channel for client GUI conferencing, hangup after 30 minutes
; create a GSM formatted audio file named "conf.gsm" that is 30 minutes long
; and put it in /var/lib/asterisk/sounds
exten => 8302,1,Answer()
exten => 8302,n,Playback(conf)
exten => 8302,n,Hangup()
exten => 8304,1,Answer()
exten => 8304,n,Playback(ding)
exten => 8304,n,Hangup()
; default audio for safe harbor 2-second-after-hello message then hangup
; create a GSM formatted audio file complies with safe harbor rules
; and put it in /var/lib/asterisk/sounds then change filename below
exten => 8307,1,Answer()
exten => 8307,n,Playback(vm-goodbye)
exten => 8307,n,Hangup()
; this is used for playing a message to an answering machine forwarded from AMD in VICIDIAL
exten => 8320,1,AGI(VD_amd.agi,${EXTEN}-----YES)
exten => 8320,n,Hangup()
exten => _8320*.,1,AGI(VD_amd.agi,${EXTEN}-----YES)
exten => _8320*.,n,Hangup()
; these are used for the ring_all function in VICIDIAL
exten => _8331*.,1,Playback(sip-silence)
exten => _8331*.,n,AGI(agi-VDAD_RINGALL.agi,${EXTEN})
exten => _8331*.,n,AGI(agi-VDAD_RINGALL.agi,${EXTEN})
exten => _8331*.,n,AGI(agi-VDAD_RINGALL.agi,${EXTEN})
exten => _8331*.,n,Hangup()
; use for selective CallerID hangup by area code(hard-coded)
exten => 8352,1,AGI(agi-VDADselective_CID_hangup.agi,${EXTEN})
exten => 8352,n,Playback(safe_harbor)
exten => 8352,n,Hangup()
; this is used for sending DTMF signals within conference calls, the client app
; sends the digits to be played in the callerID field
; sound files must be placed in /var/lib/asterisk/sounds
exten => 8500998,1,Answer()
exten => 8500998,n,Playback(silence)
exten => 8500998,n,AGI(agi-dtmf.agi)
exten => 8500998,n,Hangup()
; multi-remote-monitor entry extensions
exten => 8162,1,Dial(${TRUNKblind}/34567890123456789,55,to)
exten => 8162,n,Hangup()
exten => 34567890123456789,1,Answer()
exten => 34567890123456789,n,Goto(monitor,s,1)
exten => 34567890123456789,n,Hangup()
;#### VDAD STANDARD TRANSFER ENTRIES ####
; Below are the parameters needed for the agi-VDAD_ALL_outbound.agi script to be run properly
; 1. the method of call handling for the script:
; - NORMAL - <default> Standard outbound routing to agent
; - TEST - For performance testing only
; - BROADCAST - For no-agent broadcast dialing
; - SURVEY - For survery question then on to agent
; - REMINDER - Reminder campaign
; - REMINDX - Reminder with transfer to agent
; 2. the method of searching for an available agent:
; - LB - <default> Load Balance total system
; - LO - Load Balance Overflow only (priority to home server)
; - SO - Home server only
; 3. the sound file to play when doing a SURVEY, REMINDER, REMINDX campaign
; 4. the acceptible dtmf digits for a SURVEY
; 5. the out-opt digit for a SURVEY (must be in the digit map)
; 6. the sound file to play for a SURVEY when transfering to an agent
; 7. the sound file to play for a SURVEY when DNCing the call
; 8. OPTIN or OPTOUT: if OPTIN call is only sent to agent with button press
; if OPTOUT call is sent to agent if no button press at all
; 9. the status that is use for a SURVEY when someone opts out
; if the status is DNC it will also add them to the internal dnc table
; VICIDIAL_auto_dialer transfer script for no-agent campaigns:
exten => 8364,1,Playback(sip-silence)
exten => 8364,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8364,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8364,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8364,n,Hangup()
; VICIDIAL_auto_dialer transfer script:
exten => 8365,1,Playback(sip-silence)
exten => 8365,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8365,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----SO)
exten => 8365,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----SO)
exten => 8365,n,Hangup()
; VICIDIAL_auto_dialer transfer script SURVEY at beginning:
exten => 8366,1,Playback(sip-silence)
exten => 8366,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8366,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8366,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8366,n,Hangup()
; VICIDIAL_auto_dialer transfer script Load Balance Overflow:
exten => 8367,1,Playback(sip-silence)
exten => 8367,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8367,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LO)
exten => 8367,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LO)
exten => 8367,n,Hangup()
; VICIDIAL_auto_dialer transfer script Load Balanced:
exten => 8368,1,Playback(sip-silence)
exten => 8368,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8368,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8368,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8368,n,Hangup()
; VICIDIAL_auto_dialer transfer script AMD with Load Balanced:
exten => 8369,1,Playback(sip-silence)
exten => 8369,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8369,n,AMD(2000|2000|1000|5000|120|50|4|256)
exten => 8369,n,AGI(VD_amd.agi,${EXTEN})
exten => 8369,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8369,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8369,n,Hangup()
; VICIDIAL auto-dial reminder script
exten => 8372,1,Playback(sip-silence)
exten => 8372,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8372,n,AGI(agi-VDADautoREMINDER.agi,${EXTEN})
exten => 8372,n,AGI(agi-VDADautoREMINDER.agi,${EXTEN})
exten => 8372,n,Hangup()
; VICIDIAL SURVEY transfer script AMD with Load Balanced:
exten => 8373,1,Playback(sip-silence)
exten => 8373,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8373,n,AMD(2000|2000|1000|5000|120|50|4|256)
exten => 8373,n,AGI(VD_amd.agi,${EXTEN})
exten => 8373,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8373,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8373,n,Hangup()
; VICIDIAL SURVEY transfer script with Cepstral names:
exten => 8374,1,Playback(sip-silence)
exten => 8374,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8374,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB)
exten => 8374,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB)
exten => 8374,n,Hangup()
; VICIDIAL SURVEY transfer script AMD with Cepstral variables:
exten => 8375,1,Playback(sip-silence)
exten => 8375,n,AGI(agi://127.0.0.1:4577/call_log)
exten => 8375,n,AMD(2000|2000|1000|5000|120|50|4|256)
exten => 8375,n,AGI(VD_amd.agi,${EXTEN})
exten => 8375,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB)
exten => 8375,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB)
exten => 8375,n,Hangup()
; PERFORMANCE TESTING
exten => _999XXXXXX1,1,Answer()
exten => _999XXXXXX1,n,Wait(2)
exten => _999XXXXXX1,n,Playback(vicidial-welcome)
exten => _999XXXXXX1,n,Hangup()
exten => _999XX11112,1,Wait(2)
exten => _999XX11112,n,Answer()
exten => _999XX11112,n,Playback(ss-noservice)
exten => _999XX11112,n,Playback(vm-goodbye)
exten => _999XX11112,n,Hangup()
exten => _999XX18112,1,Wait(2)
exten => _999XX18112,n,Answer()
exten => _999XX18112,n,Playback(vtiger-fax)
exten => _999XX18112,n,Playback(vtiger-fax)
exten => _999XX18112,n,Hangup()
exten => _999XX19112,1,Wait(2)
exten => _999XX19112,n,Answer()
exten => _999XX19112,n,Playback(vtiger-email)
exten => _999XX19112,n,Playback(vtiger-email)
exten => _999XX19112,n,Hangup()
exten => _999XXXX112,1,Wait(5)
exten => _999XXXX112,n,Answer()
exten => _999XXXX112,n,Playback(demo-instruct)
exten => _999XXXX112,n,Playback(demo-instruct)
exten => _999XXXX112,n,Hangup()
exten => _999XXXXXX2,1,Wait(8)
exten => _999XXXXXX2,n,Answer()
exten => _999XXXXXX2,n,Playback(demo-instruct)
exten => _999XXXXXX2,n,Hangup()
exten => _999XXXXXX3,1,Set(PRI_CAUSE=1)
exten => _999XXXXXX3,n,Hangup()
exten => _999XXXXXX4,1,Set(PRI_CAUSE=27)
exten => _999XXXXXX4,n,Hangup()
exten => _999XXXXXX5,1,Wait(120)
exten => _999XXXXXX5,n,Hangup()
exten => _999XXXXXX6,1,Wait(10)
exten => _999XXXXXX6,n,Answer()
exten => _999XXXXXX6,n,Playback(demo-instruct)
exten => _999XXXXXX6,n,Hangup()
exten => _999XXXXXX7,1,Wait(12)
exten => _999XXXXXX7,n,Answer()
exten => _999XXXXXX7,n,Playback(demo-enterkeywords)
exten => _999XXXXXX7,n,Hangup()
exten => _999XXXXXX8,1,Set(PRI_CAUSE=17)
exten => _999XXXXXX8,n,Hangup()
exten => _999XXXXXX9,1,Wait(6)
exten => _999XXXXXX9,n,Answer()
exten => _999XXXXXX9,n,Playback(demo-abouttotry)
exten => _999XXXXXX9,n,Hangup()
exten => _999XXXXXX0,1,Wait(5)
exten => _999XXXXXX0,n,Answer()
exten => _999XXXXXX0,n,Playback(vm-goodbye)
exten => _999XXXXXX0,n,Hangup()
;exten => 99999999999,1,Answer()
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Playback(conf)
;exten => 99999999999,n,Hangup()
[monitor]
exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
exten => s,1,Set(TIMEOUT(digit)=10)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Set(MEETME_EXIT_CONTEXT=monitor_exit)
exten => s,n,Background(vm-extension) ; need audio prompt.
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => i,1,Goto(monitor_exit,s,1)
exten => i,n,Hangup()
exten => #,1,Goto(monitor_exit,s,1)
exten => #,n,Hangup()
exten => t,1,Goto(monitor_exit,s,1)
exten => t,n,Hangup()
exten => _8[0-2]XX,1,Meetme(8600${EXTEN:1},mqX) ; Listen
exten => _8[0-2]XX,n,Hangup()
exten => _99[0-2]XX,1,Meetme(8600${EXTEN:2},X) ; Barge
exten => _99[0-2]XX,n,Hangup()
[monitor_exit]
exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
exten => _X,1,Goto(monitor,s,1)
exten => _X,n,Hangup()
exten => i,1,Goto(monitor,s,1)
exten => i,n,Hangup()
exten => #,1,Goto(monitor,s,1)
exten => #,n,Hangup()
exten => t,1,Goto(monitor,s,1)
exten => t,n,Hangup()
@@ -0,0 +1,25 @@
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
[cron]
secret = 1234
read = system,call,log,verbose,command,agent,user,originate
write = system,call,log,verbose,command,agent,user,originate
[updatecron]
secret = 1234
read = command
write = command
[listencron]
secret = 1234
read = system,call,log,verbose,command,agent,user
;read = all
write = command
[sendcron]
secret = 1234
read = command
write = system,call,log,verbose,command,agent,user,originate
+4 -2
View File
@@ -85,6 +85,8 @@ voicemail_options VARCHAR(255) default '',
user_group VARCHAR(20) default '---ALL---',
voicemail_greeting VARCHAR(100) default '',
index (server_ip),
index (voicemail_id),
index (dialplan_number),
unique index extenserver (extension, server_ip)
);
@@ -93,7 +95,7 @@ server_id VARCHAR(10) NOT NULL,
server_description VARCHAR(255),
server_ip VARCHAR(15) NOT NULL,
active ENUM('Y','N'),
asterisk_version VARCHAR(20) default '1.4.21.1',
asterisk_version VARCHAR(20) default '1.4.21.2',
max_vicidial_trunks SMALLINT(4) default '23',
telnet_host VARCHAR(20) NOT NULL default 'localhost',
telnet_port INT(5) NOT NULL default '5038',
@@ -3088,4 +3090,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1337',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1338',db_schema_update_date=NOW();
+5
View File
@@ -291,3 +291,8 @@ ALTER TABLE vicidial_users ADD modify_email_accounts ENUM('0','1') default '0';
ALTER TABLE vicidial_live_agents MODIFY status ENUM('READY','QUEUE','INCALL','PAUSED','CLOSER','MQUEUE') default 'PAUSED';
UPDATE system_settings SET db_schema_version='1337',db_schema_update_date=NOW() where db_schema_version < 1337;
CREATE INDEX pvmid on phones (voicemail_id);
CREATE INDEX pdpn on phones (dialplan_number);
UPDATE system_settings SET db_schema_version='1338',db_schema_update_date=NOW() where db_schema_version < 1338;
+17 -5
View File
@@ -2,7 +2,7 @@
# install.pl version 2.6
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
@@ -28,6 +28,7 @@
# 120224-1614 - Added function to clear out web auth log files
# 121027-1750 - Added svn logging information
# 121215-2059 - Added keepalive option E for email process
# 130108-1853 - Added Asterisk 1.8 option with default conf files copy
#
############################################
@@ -1824,9 +1825,10 @@ else
while ($continue =~/NO/)
{
print "\nEnter the Asterisk version that you are installing VICIDIAL for\n";
print "(value should be listing of characters with no spaces: 123456)\n";
print "(value should be only one of the options below:)\n";
print " 1.2\n";
print " 1.4\n";
print " 1.8\n";
print "Enter asterisk version or press enter for default: [$VARasterisk_version] ";
$PROMPTasterisk_version = <STDIN>;
chomp($PROMPTasterisk_version);
@@ -2676,9 +2678,19 @@ if ( ($PROMPTcopy_conf_files =~ /y/i) || ($CLIcopy_conf_files =~ /y/i) )
}
else
{
`cp -f ./docs/conf_examples/extensions.conf.sample-1.4 /etc/asterisk/extensions.conf`;
`cp -f ./docs/conf_examples/iax.conf.sample-1.4 /etc/asterisk/iax.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-1.4 /etc/asterisk/sip.conf`;
if ($VARasterisk_version =~ /^1.8/)
{
`cp -f ./docs/conf_examples/extensions.conf.sample-1.8 /etc/asterisk/extensions.conf`;
`cp -f ./docs/conf_examples/manager.conf.sample-1.8 /etc/asterisk/manager.conf`;
`cp -f ./docs/conf_examples/iax.conf.sample-1.4 /etc/asterisk/iax.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-1.4 /etc/asterisk/sip.conf`;
}
else
{
`cp -f ./docs/conf_examples/extensions.conf.sample-1.4 /etc/asterisk/extensions.conf`;
`cp -f ./docs/conf_examples/iax.conf.sample-1.4 /etc/asterisk/iax.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-1.4 /etc/asterisk/sip.conf`;
}
}
`cp -f ./docs/conf_examples/meetme.conf.sample /etc/asterisk/meetme.conf`;
`cp -f ./docs/conf_examples/manager.conf.sample /etc/asterisk/manager.conf`;
+5 -4
View File
@@ -1,7 +1,7 @@
<?php
# manager_send.php version 2.6
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
@@ -112,10 +112,11 @@
# 120810-0030 - Added external_recording
# 120831-1458 - Added vicidial_dial_log outbound call logging
# 121120-0848 - Added QM socket-send functionality
# 130108-1641 - Change for Asterisk 1.8 compatibility
#
$version = '2.6-59';
$build = '121120-0848';
$version = '2.6-60';
$build = '130108-1641';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=119;
$one_mysql_log=0;
@@ -2051,7 +2052,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") )
}
# find and hang up all recordings going on in this conference # and extension = '$exten'
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";";
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and (channel LIKE \"%,1\" or channel LIKE \"%;1\");";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02080',$user,$server_ip,$session_name,$one_mysql_log);}