added flag option to install.pl to not show any prompts
added signalonly option to send dtmf AGI to only send signal, not audio git-svn-id: svn://192.168.202.10@1072 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+88
-46
@@ -7,19 +7,43 @@
|
|||||||
# Accepted values are: 1 2 3 4 5 6 7 8 9 0 # * ,
|
# Accepted values are: 1 2 3 4 5 6 7 8 9 0 # * ,
|
||||||
# comma means pause for 1 second
|
# comma means pause for 1 second
|
||||||
#
|
#
|
||||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# exten => 8500998,1,Answer
|
||||||
|
# exten => 8500998,2,Playback(silence)
|
||||||
|
# exten => 8500998,3,AGI(agi-dtmf.agi)
|
||||||
|
#; exten => 8500998,3,AGI(agi-dtmf.agi,signalonly) ; optional signal only DTMF
|
||||||
|
# exten => 8500998,4,Hangup
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
|
#
|
||||||
|
# CHANGES
|
||||||
|
# 90312-1534 - Added signalonly option
|
||||||
#
|
#
|
||||||
|
|
||||||
|
$signalonly=0;
|
||||||
|
### begin parsing run-time options ###
|
||||||
|
if (length($ARGV[0])>1)
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
while ($#ARGV >= $i)
|
||||||
|
{
|
||||||
|
$args = "$args $ARGV[$i]";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ARGV[0] =~ /signalonly/)
|
||||||
|
{$signalonly=1;}
|
||||||
|
}
|
||||||
|
|
||||||
$|=1;
|
$|=1;
|
||||||
while(<STDIN>) {
|
while(<STDIN>)
|
||||||
|
{
|
||||||
chomp;
|
chomp;
|
||||||
last unless length($_);
|
last unless length($_);
|
||||||
if (/^agi_(\w+)\:\s+(.*)$/) {
|
if (/^agi_(\w+)\:\s+(.*)$/)
|
||||||
$AGI{$1} = $2;
|
{$AGI{$1} = $2;}
|
||||||
}
|
|
||||||
if (/^agi_callerid\:\s+(.*)$/) {$caller_id = $1;}
|
if (/^agi_callerid\:\s+(.*)$/) {$caller_id = $1;}
|
||||||
if (/^agi_calleridname\:\s+(.*)$/) {$caller_idname = $1;}
|
if (/^agi_calleridname\:\s+(.*)$/) {$caller_idname = $1;}
|
||||||
}
|
}
|
||||||
|
|
||||||
print STDERR "AGI Environment Dump:\n";
|
print STDERR "AGI Environment Dump:\n";
|
||||||
foreach $i (sort keys %AGI) {
|
foreach $i (sort keys %AGI) {
|
||||||
@@ -37,6 +61,63 @@ my $clidname = $agi->get_variable('CALLERIDNAME');
|
|||||||
print STDERR "X. |$clid|$caller_id|$clidname|\n";
|
print STDERR "X. |$clid|$caller_id|$clidname|\n";
|
||||||
|
|
||||||
|
|
||||||
|
### sleep for 5 tenths of a second
|
||||||
|
usleep(1*500*1000);
|
||||||
|
|
||||||
|
print "STREAM FILE silence \"\"\n";
|
||||||
|
|
||||||
|
$caller_id = "$caller_id$caller_idname";
|
||||||
|
|
||||||
|
@CALLERID_DIGITS = split(//, $caller_id);
|
||||||
|
|
||||||
|
foreach (@CALLERID_DIGITS)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($CALLERID_DIGITS[$g] =~ /\d/)
|
||||||
|
{
|
||||||
|
if ($signalonly > 0)
|
||||||
|
{print "EXEC SendDTMF $CALLERID_DIGITS[$g] \"\"\n";}
|
||||||
|
else
|
||||||
|
{print "STREAM FILE $CALLERID_DIGITS[$g] \"\"\n";}
|
||||||
|
print STDERR "DIGIT: $CALLERID_DIGITS[$g]\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($CALLERID_DIGITS[$g] =~ /\#/)
|
||||||
|
{
|
||||||
|
if ($signalonly > 0)
|
||||||
|
{print "EXEC SendDTMF \# \"\"\n";}
|
||||||
|
else
|
||||||
|
{print "STREAM FILE hash \"\"\n";}
|
||||||
|
}
|
||||||
|
if ($CALLERID_DIGITS[$g] =~ /\*/)
|
||||||
|
{
|
||||||
|
if ($signalonly > 0)
|
||||||
|
{print "EXEC SendDTMF \* \"\"\n";}
|
||||||
|
else
|
||||||
|
{print "STREAM FILE star \"\"\n";}
|
||||||
|
}
|
||||||
|
if ($CALLERID_DIGITS[$g] =~ /\,/)
|
||||||
|
{sleep(1);}
|
||||||
|
print STDERR "NON-DIGIT: $CALLERID_DIGITS[$g]\n";
|
||||||
|
}
|
||||||
|
$g++;
|
||||||
|
|
||||||
|
### sleep for 20 hundredths of a second
|
||||||
|
usleep(1*150*1000);
|
||||||
|
|
||||||
|
print "STREAM FILE silence \"\"\n";
|
||||||
|
|
||||||
|
### sleep for 10 hundredths of a second
|
||||||
|
usleep(1*100*1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "STREAM FILE silence \"\"\n";
|
||||||
|
$result = <STDIN>;
|
||||||
|
checkresult($result);
|
||||||
|
|
||||||
|
exit;
|
||||||
|
|
||||||
sub checkresult {
|
sub checkresult {
|
||||||
my ($res) = @_;
|
my ($res) = @_;
|
||||||
my $retval;
|
my $retval;
|
||||||
@@ -57,42 +138,3 @@ sub checkresult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
### sleep for 5 tenths of a second
|
|
||||||
usleep(1*500*1000);
|
|
||||||
|
|
||||||
print "STREAM FILE silence \"\"\n";
|
|
||||||
|
|
||||||
$caller_id = "$caller_id$caller_idname";
|
|
||||||
|
|
||||||
@CALLERID_DIGITS = split(//, $caller_id);
|
|
||||||
|
|
||||||
foreach (@CALLERID_DIGITS)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ($CALLERID_DIGITS[$g] =~ /\d/)
|
|
||||||
{
|
|
||||||
print "STREAM FILE $CALLERID_DIGITS[$g] \"\"\n";
|
|
||||||
print STDERR "DIGIT: $CALLERID_DIGITS[$g]\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($CALLERID_DIGITS[$g] =~ /\#/) {print "STREAM FILE hash \"\"\n";}
|
|
||||||
if ($CALLERID_DIGITS[$g] =~ /\*/) {print "STREAM FILE star \"\"\n";}
|
|
||||||
if ($CALLERID_DIGITS[$g] =~ /\,/) {sleep(1);}
|
|
||||||
print STDERR "NON-DIGIT: $CALLERID_DIGITS[$g]\n";
|
|
||||||
}
|
|
||||||
$g++;
|
|
||||||
|
|
||||||
### sleep for 20 hundredths of a second
|
|
||||||
usleep(1*150*1000);
|
|
||||||
|
|
||||||
print "STREAM FILE silence \"\"\n";
|
|
||||||
|
|
||||||
### sleep for 10 hundredths of a second
|
|
||||||
usleep(1*100*1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
print "STREAM FILE silence \"\"\n";
|
|
||||||
$result = <STDIN>;
|
|
||||||
checkresult($result);
|
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ if (-e "/root/asterisk_command_reload_iax2")
|
|||||||
}
|
}
|
||||||
|
|
||||||
`$findbin /root/ -maxdepth 1 -name "asterisk_command*" -print | xargs rm -f`;
|
`$findbin /root/ -maxdepth 1 -name "asterisk_command*" -print | xargs rm -f`;
|
||||||
|
|
||||||
|
`ulimit -n 65536`;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($SYSLOG)
|
if ($SYSLOG)
|
||||||
|
|||||||
+19
-21
@@ -16,6 +16,7 @@
|
|||||||
# 80316-2208 - Added $PATHlogs/archive for backups
|
# 80316-2208 - Added $PATHlogs/archive for backups
|
||||||
# 80526-1345 - Added Timeclock auto-logout option 9
|
# 80526-1345 - Added Timeclock auto-logout option 9
|
||||||
# 90210-0319 - Added option to prompt for Asterisk version
|
# 90210-0319 - Added option to prompt for Asterisk version
|
||||||
|
# 90312-1256 - Added CLI flag for automatic configuration
|
||||||
#
|
#
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
@@ -142,6 +143,7 @@ if (length($ARGV[0])>1)
|
|||||||
print " [--help] = this help screen\n";
|
print " [--help] = this help screen\n";
|
||||||
print " [--test] = test (will not copy files)\n";
|
print " [--test] = test (will not copy files)\n";
|
||||||
print " [--debug] = verbose debug messages\n";
|
print " [--debug] = verbose debug messages\n";
|
||||||
|
print " [--no-prompt] = do not ask questions, just install\n";
|
||||||
print " [--web-only] = only copy files/directories for web server install\n";
|
print " [--web-only] = only copy files/directories for web server install\n";
|
||||||
print " [--without-web] = do not copy web files/directories\n\n";
|
print " [--without-web] = do not copy web files/directories\n\n";
|
||||||
print "configuration options:\n";
|
print "configuration options:\n";
|
||||||
@@ -196,27 +198,19 @@ if (length($ARGV[0])>1)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($args =~ /--debug/i) # Debug flag
|
if ($args =~ /--debug/i) # Debug flag
|
||||||
{
|
{$DB=1;}
|
||||||
$DB=1;
|
|
||||||
}
|
|
||||||
if ($args =~ /--test/i) # test flag
|
if ($args =~ /--test/i) # test flag
|
||||||
{
|
{$TEST=1; $T=1;}
|
||||||
$TEST=1; $T=1;
|
|
||||||
}
|
|
||||||
if ($args =~ /--web-only/i) # web-only flag
|
if ($args =~ /--web-only/i) # web-only flag
|
||||||
{
|
{$WEBONLY=1; }
|
||||||
$WEBONLY=1;
|
|
||||||
}
|
|
||||||
if ($args =~ /--without-web/i) # without web flag
|
if ($args =~ /--without-web/i) # without web flag
|
||||||
{
|
{$NOWEB=1;}
|
||||||
$NOWEB=1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{$NOWEB=0;}
|
||||||
$NOWEB=0;
|
if ($args =~ /--no-prompt/i) # do not ask questions
|
||||||
}
|
{$NOPROMPT=1;}
|
||||||
if ($args =~ /--home=/i) # CLI defined home path
|
if ($args =~ /--home=/i) # CLI defined home path
|
||||||
{
|
{
|
||||||
@CLIhomeARY = split(/--home=/,$args);
|
@CLIhomeARY = split(/--home=/,$args);
|
||||||
@@ -1001,10 +995,13 @@ if (-e "$PATHconf")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print("\nWould you like to use manual configuration and installation(y/n): [y] ");
|
if (!$NOPROMPT)
|
||||||
$manual = <STDIN>;
|
{
|
||||||
chomp($manual);
|
print("\nWould you like to use manual configuration and installation(y/n): [y] ");
|
||||||
if ($manual =~ /n/i)
|
$manual = <STDIN>;
|
||||||
|
chomp($manual);
|
||||||
|
}
|
||||||
|
if ( ($manual =~ /n/i) || ($NOPROMPT > 0) )
|
||||||
{
|
{
|
||||||
$manual=0;
|
$manual=0;
|
||||||
}
|
}
|
||||||
@@ -2237,9 +2234,10 @@ if ($NOWEB < 1)
|
|||||||
`chmod 0777 $PATHweb/vicidial/server_reports/`;
|
`chmod 0777 $PATHweb/vicidial/server_reports/`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($PROMPTcopy_conf_files =~ /y/i)
|
if ( ($PROMPTcopy_conf_files =~ /y/i) || ($CLIcopy_conf_files =~ /y/i) )
|
||||||
{
|
{
|
||||||
print "Copying sample conf files to /etc/asterisk/...\n";
|
print "Copying sample conf files to /etc/asterisk/...\n";
|
||||||
|
`mkdir -p /etc/asterisk`;
|
||||||
if ($VARasterisk_version =~ /^1.2/)
|
if ($VARasterisk_version =~ /^1.2/)
|
||||||
{
|
{
|
||||||
`cp -f ./docs/conf_examples/extensions.conf.sample /etc/asterisk/extensions.conf`;
|
`cp -f ./docs/conf_examples/extensions.conf.sample /etc/asterisk/extensions.conf`;
|
||||||
|
|||||||
Reference in New Issue
Block a user