Added audio store and audio synchronization processes

Fixed bug in AST_VDadapt.pl script

git-svn-id: svn://192.168.202.10@1115 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-05-14 10:53:52 +00:00
parent fcafc07430
commit 0cd21921f0
16 changed files with 2136 additions and 1110 deletions
+5
View File
@@ -36,6 +36,11 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
8. Changed all PHP scripts to use long tags, short tags are depricated in PHP6
9. Added audio upload ability from web interface, choose audio prompts from a
list in the call menu and in-group admin screens, and back-end audio
synchronization utilities have been added for multi-server setups.
+396
View File
@@ -0,0 +1,396 @@
#!/usr/bin/perl
#
# ADMIN_audio_store_sync.pl version 2.2.0
#
# DESCRIPTION:
# syncronizes audio between audio store and this server
#
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 90513-0458 - First Build
#
# constants
$DB=0;
$US='__';
$MT[0]='';
$uploaded=0;
$downloaded=0;
$secT = time();
$now_date_epoch = $secT;
($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) {$Fhour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
$file_date = "$year-$mon-$mday";
$now_date = "$year-$mon-$mday $hour:$min:$sec";
$VDL_date = "$year-$mon-$mday 00:00:01";
$inactive_epoch = ($secT - 60);
$HHMM = "$hour$min";
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--upload] = upload audio not found on audio store\n [--force-download] = force download of everything from audio store\n [--settings-override] = ignore database settings and run sync anyway\n\n";
exit;
}
else
{
if ($args =~ /--debug/i)
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
if ($args =~ /--upload/i)
{
$upload=1;
if ($DB) {print "\n----- UPLOAD -----\n\n";}
}
if ($args =~ /--force-download/i)
{
$force_download=1;
if ($DB) {print "\n----- FORCE DOWNLOAD -----\n\n";}
}
if ($args =~ /--settings-override/i)
{
$settings_override=1;
if ($DB) {print "\n----- SETTINGS OVERRIDE -----\n\n";}
}
if ($args =~ /--debugX/i)
{
$DBX=1;
if ($DB) {print "\n----- SUPER DEBUG -----\n\n";}
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
if ($DB) {print "\n-----TESTING -----\n\n";}
}
}
}
else
{
# print "no command line options set\n";
}
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
if (!$VASLOGfile) {$VASLOGfile = "$PATHlogs/audiostore.$year-$mon-$mday";}
if (!$VARDB_port) {$VARDB_port='3306';}
use DBI;
$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 active_asterisk_server 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;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$active_asterisk_server = "$aryA[0]";
}
$sthA->finish();
### Grab system_settings values from the database
$stmtA = "SELECT sounds_central_control_active,sounds_web_server,sounds_web_directory FROM system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$sounds_central_control_active = "$aryA[0]";
$sounds_web_server = "$aryA[1]";
$sounds_web_directory = "$aryA[2]";
}
$sthA->finish();
if ( ( ($sounds_central_control_active < 1) || ($active_asterisk_server !~ /Y/) ) && ($settings_override < 1) )
{
print "Audio Sync Settings not active, Exiting\n";
exit;
}
$stmtA="UPDATE servers SET sounds_update='N' where server_ip='$VARserver_ip';";
$affected_rows = $dbhA->do($stmtA);
### find wget binary
$wgetbin = '';
if ( -e ('/bin/wget')) {$wgetbin = '/bin/wget';}
else
{
if ( -e ('/usr/bin/wget')) {$wgetbin = '/usr/bin/wget';}
else
{
if ( -e ('/usr/local/bin/wget')) {$wgetbin = '/usr/local/bin/wget';}
else
{
print "Can't find wget binary! Exiting...\n";
exit
}
}
}
### find curl binary
$curlbin = '';
if ( -e ('/bin/curl')) {$curlbin = '/bin/curl';}
else
{
if ( -e ('/usr/bin/curl')) {$curlbin = '/usr/bin/curl';}
else
{
if ( -e ('/usr/local/bin/curl')) {$curlbin = '/usr/local/bin/curl';}
else
{
print "Can't find curl binary! Exiting...\n";
exit
}
}
}
$URL = "http://$sounds_web_server/vicidial/audio_store.php?action=LIST";
$URL =~ s/&/\\&/gi;
if ($DB)
{print "\n$URL\n";}
$audio_list_file = '/tmp/audio_store_list.txt';
`rm -f $audio_list_file`;
`$wgetbin -q --output-document=$audio_list_file $URL `;
open(list, "$audio_list_file") || die "can't open $audio_list_file: $!\n";
@list = <list>;
close(list);
opendir(sounds, "$PATHsounds");
@sounds= readdir(sounds);
closedir(sounds);
####### BEGIN download of audio files
if ($DB > 0) {print "REMOTE AUDIO FILES:\n";}
$i=0;
while ($i <= $#list)
{
chomp($list[$i]);
@file_data = split(/\t/, $list[$i]);
$filename = $file_data[1];
$filedate = $file_data[2];
$filesize = $file_data[3];
$fileepoch = $file_data[4];
if ($DB > 0) {print "$i $filename $filedate $filesize $fileepoch\n";}
$k=0;
$found_file=0;
while ($k <= $#sounds)
{
chomp($sounds[$k]);
$soundname = $sounds[$k];
$soundsize = (-s "$PATHsounds/$sounds[$k]");
if ( ($filename eq "$soundname") && ($filesize eq "$soundsize") )
{
$found_file++;
}
$k++;
}
if ($found_file < 1)
{
`$wgetbin -q --output-document=$PATHsounds/$filename http://$sounds_web_server/$sounds_web_directory/$filename`;
$event_string = "DOWNLOADING: $filename $filesize";
if ($DB > 0) {print " $event_string\n";}
&event_logger;
$downloaded++;
}
else
{
if ($DB > 0) {print " FILE FOUND: $filename\n";}
}
$i++;
}
####### END download of audio files
$total_files = $i;
`rm -f $audio_list_file`;
`$wgetbin -q --output-document=$audio_list_file $URL `;
open(list, "$audio_list_file") || die "can't open $audio_list_file: $!\n";
@list = <list>;
close(list);
opendir(sounds, "$PATHsounds");
@sounds= readdir(sounds);
closedir(sounds);
####### BEGIN upload of audio files
if ($upload > 0)
{
if ($DB > 0) {print "LOCAL AUDIO FILES:\n";}
$k=0;
while ($k <= $#sounds)
{
chomp($sounds[$k]);
if ($sounds[$k] =~ /\.wav$|\.gsm$/)
{
$soundname = $sounds[$k];
$sounddate = (-M "$PATHsounds/$sounds[$k]");
$soundsize = (-s "$PATHsounds/$sounds[$k]");
$soundsec = ($sounddate * 86400);
$soundepoch = ($secT - $soundsec);
if ($DB > 0) {print "$k $soundname $sounddate $soundsize $soundepoch\n";}
$i=0;
$found_file=0;
while ($i <= $#list)
{
chomp($list[$i]);
@file_data = split(/\t/, $list[$i]);
$filename = $file_data[1];
$filedate = $file_data[2];
$filesize = $file_data[3];
$fileepoch = $file_data[4];
if ( ($filename eq "$soundname") && ($filesize eq "$soundsize") )
{
$found_file++;
}
$i++;
}
if ($found_file < 1)
{
$curloptions = "-s 'http://$sounds_web_server/vicidial/audio_store.php?action=AUTOUPLOAD' -F \"audiofile=\@$PATHsounds/$soundname\"";
`$curlbin $curloptions`;
$event_string = "UPLOADING: $soundname $soundsize";
if ($DB > 0) {print " $event_string\n|$curlbin $curloptions|\n";}
&event_logger;
$uploaded++;
}
else
{
if ($DB > 0) {print " FILE FOUND: $soundname\n";}
}
}
$k++;
}
}
####### END upload of audio files
###### If audio was uploaded from this server, set all other servers to update sounds next minute
if ($uploaded > 0)
{
$stmtA="UPDATE servers SET sounds_update='Y' where server_ip NOT IN('$VARserver_ip');";
$affected_rows = $dbhA->do($stmtA);
}
if($DB)
{
print "AUDIO FILES ON SERVER: $total_files\n";
print "NEW DOWNLOADED: $downloaded\n";
print "NEW UPLOADED: $uploaded\n\n";
### calculate time to run script ###
$secY = time();
$secZ = ($secY - $secT);
if (!$q) {print "DONE. Script execution time in seconds: $secZ\n";}
}
$dbhA->disconnect();
exit;
sub event_logger
{
if ($SYSLOG)
{
### open the log file for writing ###
open(Lout, ">>$VASLOGfile")
|| die "Can't open $VASLOGfile: $!\n";
print Lout "$now_date|$event_string|\n";
close(Lout);
}
$event_string='';
}
+47 -13
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# ADMIN_keepalive_ALL.pl version 2.0.5
# ADMIN_keepalive_ALL.pl version 2.2.0
#
# Designed to keep the astGUIclient processes alive and check every minute
# Replaces all other ADMIN_keepalive scripts
@@ -9,7 +9,7 @@
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
#
# CHANGES
# 61011-1348 - First build
# 61120-2011 - Added option 7 for AST_VDauto_dial_FILL.pl
# 80227-1526 - Added option 8 for ip_relay
@@ -20,6 +20,7 @@
# 90327-1421 - Removed [globals] tag from auto-generated extensions file
# 90409-1251 - Fixed voicemail conf file issue
# 90506-1155 - Added Call Menu functionality
# 90513-0449 - Added audio store sync functionality
#
$DB=0; # Debug flag
@@ -493,7 +494,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
##### Get the settings for this server's server_ip #####
$stmtA = "SELECT active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,asterisk_version FROM servers where server_ip='$server_ip';";
$stmtA = "SELECT active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,asterisk_version,sounds_update FROM servers where server_ip='$server_ip';";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -501,11 +502,11 @@ $sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$active_asterisk_server = "$aryA[0]";
$generate_vicidial_conf = "$aryA[1]";
$rebuild_conf_files = "$aryA[2]";
$asterisk_version = "$aryA[3]";
$i++;
$active_asterisk_server = $aryA[0];
$generate_vicidial_conf = $aryA[1];
$rebuild_conf_files = $aryA[2];
$asterisk_version = $aryA[3];
$sounds_update = $aryA[4];
}
$sthA->finish();
@@ -1100,11 +1101,6 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
}
}
################################################################################
##### END Creation of auto-generated conf files
################################################################################
@@ -1113,6 +1109,44 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
################################################################################
##### BEGIN Audio Store sync
################################################################################
if ( ($active_asterisk_server =~ /Y/) && ($sounds_update =~ /Y/) )
{
##### Get the settings from system_settings #####
$stmtA = "SELECT sounds_central_control_active FROM system_settings;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$sounds_central_control_active = "$aryA[0]";
}
$sthA->finish();
if ($sounds_central_control_active > 0)
{
if ($DB) {print "running audio store sync process...\n";}
`/usr/bin/screen -d -m -S AudioStore $PATHhome/ADMIN_audio_store_sync.pl 2>/dev/null 1>&2`;
}
}
################################################################################
##### END Audio Store sync
################################################################################
if ($DB) {print "DONE\n";}
exit;
File diff suppressed because it is too large Load Diff
@@ -705,7 +705,7 @@ while ($sthBrowsC > $i)
if (length($territory)>0)
{
$VL_exists=0;
$stmtA = "SELECT count(*) FROM vicidial_users where user_code='$territory';";
$stmtA = "SELECT count(*) FROM vicidial_user_territories where territory='$territory';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -719,7 +719,7 @@ while ($sthBrowsC > $i)
if ($VL_exists > 0)
{
$user='';
$stmtA = "SELECT user FROM vicidial_users where user_code='$territory';";
$stmtA = "SELECT user FROM vicidial_user_territories where territory='$territory';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -747,7 +747,7 @@ while ($sthBrowsC > $i)
if (length($user_id)>0)
{
$stmtB = "UPDATE vtiger_crmentity SET smownerid='$user_id' where accountid='$crmid[$i]';";
$stmtB = "UPDATE vtiger_crmentity SET smownerid='$user_id' where crmid='$crmid[$i]';";
if ($T < 1) {$affected_rowsB = $dbhB->do($stmtB) or die "Couldn't execute query: |$stmtB|\n";}
if($DB){print "|$affected_rowsB|$stmtB|\n";}
$n++;
+27
View File
@@ -18,6 +18,7 @@ New scripts:
Changes:
80724-1723 - First build
90428-0208 - Added blind_monitor function
90513-1720 - Added sounds_list function
@@ -40,6 +41,32 @@ VERSION: 2.0.5-4|BUILD: 80910-0020|DATE: 2008-09-10 00:26:43|EPOCH: 1221020803
--------------------------------------------------------------------------------
sounds_list - outputs a list of audio files from the audio store
NOTE: api user for this function must have user_level set to 7 or higher
OPTIONAL FIELDS-
format - format of the output(tab, link, selectframe)
stage - how to sort the output(date, size, name)
comments - name of the field to populate
Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=sounds_list&format=selectframe&comments=fieldname&stage=date
Example responses:
<success is inferred by output of audio files list>
ERROR: sounds_list USER DOES NOT HAVE PERMISSION TO VIEW SOUNDS LIST
ERROR: sounds_list CENTRAL SOUND CONTROL IS NOT ACTIVE
--------------------------------------------------------------------------------
blind_monitor - calls user-defined phone and places them in session as blind monitor
+2 -1
View File
@@ -3,7 +3,8 @@ recommended that you read the SCRATCH_INSTALL doc for more information on
installing the package properly.
Requirements for installing astGUIclient/VICIDIAL on an Asterisk server:
- Asterisk 1.2.24 recommended but will work with most older Asterisk versions
- Asterisk 1.2.27 and 1.4.21.2 recommended but will work with most older Asterisk versions
- ViciDial does NOT support Asterisk 1.6.X at this time due to stability issues
- Zap trunks(T1/E1 or PSTN lines), IAX2 trunks or SIP trunks required
- If using VOIP trunks and VICIDIAL auto-dial, you must have trunks registered
- It is strongly suggested that you have a zaptel timer like a PSTN/T1/E1 card or ztdummy
+6 -4
View File
@@ -1,4 +1,4 @@
Ubuntu VICIDIAL Install: 2009-04-23
Ubuntu VICIDIAL Install: 2009-05-12
### NOTE ###
If you just want a quick setup of ViciDial on Ubuntu, take a look at our
@@ -42,6 +42,8 @@ sox (command line encoding and decoding tool)
subversion (code versioning tool)
subversion-tools
unzip
libcurl3
curl
Go to terminal:
@@ -121,9 +123,9 @@ mkdir /usr/src/asterisk
cd /usr/src/asterisk
****FOR 1.2 asterisk run the following
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.30.2.tar.gz
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.27.tar.gz
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.8.tar.gz
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.2.30.2.tar.gz
wget http://downloads.digium.com/pub/zaptel/releases/zaptel-1.2.27.tar.gz
wget http://downloads.digium.com/pub/libpri/releases/libpri-1.2.8.tar.gz
tar xzf asterisk-1.2.30.2.tar.gz
tar xzf zaptel-1.2.27.tar.gz
tar xzf libpri-1.2.8.tar.gz
@@ -104,7 +104,8 @@ outbound_calls_per_second SMALLINT(3) UNSIGNED default '20',
sysload INT(6) NOT NULL default '0',
channels_total SMALLINT(4) UNSIGNED NOT NULL default '0',
cpu_idle_percent SMALLINT(3) UNSIGNED NOT NULL default '0',
disk_usage VARCHAR(255) default '1'
disk_usage VARCHAR(255) default '1',
sounds_update ENUM('Y','N') default 'N'
);
CREATE UNIQUE INDEX server_id on servers (server_id);
@@ -1095,7 +1096,10 @@ qc_features_active ENUM('1','0') default '0',
outbound_autodial_active ENUM('1','0') default '1',
outbound_calls_per_second SMALLINT(3) UNSIGNED default '40',
enable_tts_integration ENUM('0','1') default '0',
agentonly_callback_campaign_lock ENUM('0','1') default '1'
agentonly_callback_campaign_lock ENUM('0','1') default '1',
sounds_central_control_active ENUM('0','1') default '0',
sounds_web_server VARCHAR(15) default '127.0.0.1',
sounds_web_directory VARCHAR(255) default ''
);
CREATE TABLE vicidial_campaigns_list_mix (
@@ -1497,6 +1501,13 @@ index (menu_id),
unique index menuoption (menu_id, option_value)
);
CREATE TABLE vicidial_user_territories (
user VARCHAR(20) NOT NULL,
territory VARCHAR(100) default '',
index (user),
unique index userterritory (user, territory)
);
ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP;
@@ -1593,7 +1604,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number);
CREATE INDEX date_user on vicidial_closer_log (call_date,user);
CREATE INDEX comment_a on live_inbound_log (comment_a);
UPDATE system_settings SET db_schema_version='1141';
UPDATE system_settings SET db_schema_version='1142';
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+16
View File
@@ -83,3 +83,19 @@ UPDATE system_settings SET db_schema_version='1140';
ALTER TABLE system_settings ADD agentonly_callback_campaign_lock ENUM('0','1') default '1';
UPDATE system_settings SET db_schema_version='1141';
ALTER TABLE system_settings ADD sounds_central_control_active ENUM('0','1') default '0';
ALTER TABLE system_settings ADD sounds_web_server VARCHAR(15) default '127.0.0.1';
ALTER TABLE system_settings ADD sounds_web_directory VARCHAR(255) default '';
ALTER TABLE servers ADD sounds_update ENUM('Y','N') default 'N';
CREATE TABLE vicidial_user_territories (
user VARCHAR(20) NOT NULL,
territory VARCHAR(100) default '',
index (user),
unique index userterritory (user, territory)
);
UPDATE system_settings SET db_schema_version='1142';
@@ -104,8 +104,21 @@ Copy Call Menu||
To delete an Option, just set the Route to REMOVE and the option will be deleted when you click the SUBMIT button||
Agent Only Callback Campaign Lock||
This option defines whether AGENTONLY callbacks are locked to the campaign that the agent originally created them under. Setting this to 1 means that the agent can only dial them from the campaign they were set under, 0 means that the agent can access them no matter what campaign they are logged into. Default is 1||
Central Sound Control Active||
This option defines whether the sound synchronization system is active across all servers. Default is 0 for inactive||
Sounds Web Server IP||
This is the IP address of the web server that will be handling the sound files on this system, this must match the server IP of the machine you are trying to access the audio_store.php webpage on or it will not work. Default is 127.0.0.1||
Sounds Web Directory||
This auto-generated directory name is created at random by the system as the place that the audio store will be kept. All audio files will reside in this directory||
Audio Store||
Audio File to Upload||
This utility allows you to upload audio files to the web server so that they can be distributed to all of the ViciDial servers in a multi-server cluster. An important note, only two audio file types will work, .wav files that are PCM 16bit 8k and .gsm files that are 8bit 8k. Please verify that your files are properly formatted before uploading them here||
Sounds Update||
If you want to force a check of the sound files on this server, and the central audio store is enabled as a system setting, then this field will allow the sounds updater to run at the next top of the minute. Any time an audio file is uploaded from the web interface this is automatically set to Y for all servers that have Asterisk active. Default is N||
add-file: audio_store.php
############################################################ CLIENT
You are not allowed to dial into other agent sessions||
+70 -16
View File
@@ -1012,6 +1012,14 @@ if (isset($_GET["source_menu"])) {$source_menu=$_GET["source_menu"];}
elseif (isset($_POST["source_menu"])) {$source_menu=$_POST["source_menu"];}
if (isset($_GET["agentonly_callback_campaign_lock"])) {$agentonly_callback_campaign_lock=$_GET["agentonly_callback_campaign_lock"];}
elseif (isset($_POST["agentonly_callback_campaign_lock"])) {$agentonly_callback_campaign_lock=$_POST["agentonly_callback_campaign_lock"];}
if (isset($_GET["sounds_central_control_active"])) {$sounds_central_control_active=$_GET["sounds_central_control_active"];}
elseif (isset($_POST["sounds_central_control_active"])) {$sounds_central_control_active=$_POST["sounds_central_control_active"];}
if (isset($_GET["sounds_web_server"])) {$sounds_web_server=$_GET["sounds_web_server"];}
elseif (isset($_POST["sounds_web_server"])) {$sounds_web_server=$_POST["sounds_web_server"];}
if (isset($_GET["sounds_web_directory"])) {$sounds_web_directory=$_GET["sounds_web_directory"];}
elseif (isset($_POST["sounds_web_directory"])) {$sounds_web_directory=$_POST["sounds_web_directory"];}
if (isset($_GET["sounds_update"])) {$sounds_update=$_GET["sounds_update"];}
elseif (isset($_POST["sounds_update"])) {$sounds_update=$_POST["sounds_update"];}
if (isset($script_id)) {$script_id= strtoupper($script_id);}
if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);}
@@ -1024,7 +1032,7 @@ if (strlen($dial_status) > 0)
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,enable_queuemetrics_logging,enable_vtiger_integration,qc_features_active,outbound_autodial_active FROM system_settings;";
$stmt = "SELECT use_non_latin,enable_queuemetrics_logging,enable_vtiger_integration,qc_features_active,outbound_autodial_active,sounds_central_control_active FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -1037,6 +1045,7 @@ while ($i < $qm_conf_ct)
$SSenable_vtiger_integration = $row[2];
$SSqc_features_active = $row[3];
$SSoutbound_autodial_active = $row[4];
$SSsounds_central_control_active = $row[5];
$i++;
}
##### END SETTINGS LOOKUP #####
@@ -1201,6 +1210,7 @@ $menu_time_check = ereg_replace("[^0-9]","",$menu_time_check);
$track_in_vdac = ereg_replace("[^0-9]","",$track_in_vdac);
$menu_repeat = ereg_replace("[^0-9]","",$menu_repeat);
$agentonly_callback_campaign_lock = ereg_replace("[^0-9]","",$agentonly_callback_campaign_lock);
$sounds_central_control_active = ereg_replace("[^0-9]","",$sounds_central_control_active);
### DIGITS and COLONS
$shift_length = ereg_replace("[^\:0-9]","",$shift_length);
@@ -1259,6 +1269,7 @@ $dnc = ereg_replace("[^NY]","",$dnc);
$customer_contact = ereg_replace("[^NY]","",$customer_contact);
$not_interested = ereg_replace("[^NY]","",$not_interested);
$unworkable = ereg_replace("[^NY]","",$unworkable);
$sounds_update = ereg_replace("[^NY]","",$sounds_update);
$qc_enabled = ereg_replace("[^0-9NY]","",$qc_enabled);
@@ -1294,6 +1305,7 @@ $shift_enforcement = ereg_replace("[^0-9a-zA-Z]","",$shift_enforcement);
$agent_shift_enforcement_override = ereg_replace("[^0-9a-zA-Z]","",$agent_shift_enforcement_override);
$survey_third_status = ereg_replace("[^0-9a-zA-Z]","",$survey_third_status);
$survey_fourth_status = ereg_replace("[^0-9a-zA-Z]","",$survey_fourth_status);
$sounds_web_directory = ereg_replace("[^0-9a-zA-Z]","",$sounds_web_directory);
### DIGITS and Dots
$server_ip = ereg_replace("[^\.0-9]","",$server_ip);
@@ -1304,6 +1316,7 @@ $old_server_ip = ereg_replace("[^\.0-9]","",$old_server_ip);
$computer_ip = ereg_replace("[^\.0-9]","",$computer_ip);
$queuemetrics_server_ip = ereg_replace("[^\.0-9]","",$queuemetrics_server_ip);
$vtiger_server_ip = ereg_replace("[^\.0-9]","",$vtiger_server_ip);
$sounds_web_server = ereg_replace("[^\.0-9]","",$sounds_web_server);
### ALPHA-NUMERIC and spaces and hash and star and comma
$xferconf_a_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_a_dtmf);
@@ -1743,11 +1756,13 @@ $dialplan_entry = ereg_replace(";","",$dialplan_entry);
# 90430-0154 - Added RANDOM and LAST CALL TIME options to lead order for campaigns
# 90504-0901 - Added Call Menu feature, changed script to use long PHP tags
# 90511-0910 - Added agentonly_callback_campaign_lock to system_settings
# 90512-0440 - Added sounds settings to system_settings table
# 90514-0607 - Added select prompts from list in call menu and in-group screens
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
$admin_version = '2.2.0-183';
$build = '90511-0910';
$admin_version = '2.2.0-185';
$build = '90514-0607';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -4368,6 +4383,14 @@ if ($SSoutbound_autodial_active > 0)
<BR>
<A NAME="audio_store">
<B>Audio Store -</B> This utility allows you to upload audio files to the web server so that they can be distributed to all of the ViciDial servers in a multi-server cluster. An important note, only two audio file types will work, .wav files that are PCM 16bit 8k and .gsm files that are 8bit 8k. Please verify that your files are properly formatted before uploading them here.
<?php
if ($SSoutbound_autodial_active > 0)
{
@@ -4964,6 +4987,11 @@ if ($SSoutbound_autodial_active > 0)
<BR>
<B>Rebuild conf files -</B> If you want to force a rebuilding of the Asterisk conf files or if any of the phones or carrier entries have changed then this should be set to Y. After the conf files have been generated and Asterisk has been reloaded then this will be changed to N. Default is Y.
<BR>
<A NAME="servers-sounds_update">
<BR>
<B>Sounds Update -</B> If you want to force a check of the sound files on this server, and the central audio store is enabled as a system setting, then this field will allow the sounds updater to run at the next top of the minute. Any time an audio file is uploaded from the web interface this is automatically set to Y for all servers that have Asterisk active. Default is N.
@@ -5172,6 +5200,21 @@ FR_SPAC 00 00 00 00 00 - France space separated phone number<BR>
<BR>
<B>Agent Only Callback Campaign Lock -</B> This option defines whether AGENTONLY callbacks are locked to the campaign that the agent originally created them under. Setting this to 1 means that the agent can only dial them from the campaign they were set under, 0 means that the agent can access them no matter what campaign they are logged into. Default is 1.
<BR>
<A NAME="settings-sounds_central_control_active">
<BR>
<B>Central Sound Control Active -</B> This option defines whether the sound synchronization system is active across all servers. Default is 0 for inactive.
<BR>
<A NAME="settings-sounds_web_server">
<BR>
<B>Sounds Web Server IP -</B> This is the IP address of the web server that will be handling the sound files on this system, this must match the server IP of the machine you are trying to access the audio_store.php webpage on or it will not work. Default is 127.0.0.1.
<BR>
<A NAME="settings-sounds_web_directory">
<BR>
<B>Sounds Web Directory -</B> This auto-generated directory name is created at random by the system as the place that the audio store will be kept. All audio files will reside in this directory.
<BR>
<A NAME="settings-qc_features_active">
<BR>
@@ -11267,7 +11310,7 @@ if ($ADD==411111111111)
{
echo "<br>SERVER MODIFIED: $server_ip\n";
$stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active',balance_trunks_offlimits='$balance_trunks_offlimits',recording_web_link='$recording_web_link',alt_server_ip='$alt_server_ip',active_asterisk_server='$active_asterisk_server',generate_vicidial_conf='$generate_vicidial_conf',rebuild_conf_files='$rebuild_conf_files',outbound_calls_per_second='$outbound_calls_per_second' where server_id='$old_server_id';";
$stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active',balance_trunks_offlimits='$balance_trunks_offlimits',recording_web_link='$recording_web_link',alt_server_ip='$alt_server_ip',active_asterisk_server='$active_asterisk_server',generate_vicidial_conf='$generate_vicidial_conf',rebuild_conf_files='$rebuild_conf_files',outbound_calls_per_second='$outbound_calls_per_second',sounds_update='$sounds_update' where server_id='$old_server_id';";
$rslt=mysql_query($stmt, $link);
$stmtA="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y';";
@@ -11519,7 +11562,7 @@ if ($ADD==411111111111111)
echo "<br>VICIDIAL SYSTEM SETTINGS MODIFIED\n";
$stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock';";
$stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory';";
$rslt=mysql_query($stmt, $link);
### LOG INSERTION Admin Log Table ###
@@ -16614,7 +16657,7 @@ if ($ADD==3111)
{$Hgroups_menu .= "<option value=\"---NONE---\">---NONE---</option>\n";}
echo "<br>MODIFY A GROUPS RECORD: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<br>MODIFY A GROUPS RECORD: $row[0]<form action=$PHP_SELF method=POST name=admin_form id=admin_form>\n";
echo "<input type=hidden name=ADD value=4111>\n";
echo "<input type=hidden name=group_id value=\"$row[0]\">\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
@@ -16675,7 +16718,7 @@ if ($ADD==3111)
echo "<tr bgcolor=#CCFFFF><td align=right>After Hours Action: </td><td align=left><select size=1 name=after_hours_action><option>HANGUP</option><option>MESSAGE</option><option>EXTENSION</option><option>VOICEMAIL</option><option>IN_GROUP</option><option SELECTED>$after_hours_action</option></select>$NWB#vicidial_inbound_groups-after_hours_action$NWE</td></tr>\n";
echo "<tr bgcolor=#CCFFFF><td align=right>After Hours Message Filename: </td><td align=left><input type=text name=after_hours_message_filename size=20 maxlength=50 value=\"$after_hours_message_filename\">$NWB#vicidial_inbound_groups-after_hours_message_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#CCFFFF><td align=right>After Hours Message Filename: </td><td align=left><input type=text name=after_hours_message_filename id=after_hours_message_filename size=20 maxlength=50 value=\"$after_hours_message_filename\"> <a href=\"javascript:launch_chooser('after_hours_message_filename','date',400);\">audio chooser</a> $NWB#vicidial_inbound_groups-after_hours_message_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#CCFFFF><td align=right>After Hours Extension: </td><td align=left><input type=text name=after_hours_exten size=10 maxlength=20 value=\"$after_hours_exten\">$NWB#vicidial_inbound_groups-after_hours_exten$NWE</td></tr>\n";
@@ -16685,13 +16728,13 @@ if ($ADD==3111)
echo "$Agroups_menu";
echo "</select>$NWB#vicidial_inbound_groups-afterhours_xfer_group$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Welcome Message Filename: </td><td align=left><input type=text name=welcome_message_filename size=20 maxlength=50 value=\"$welcome_message_filename\">$NWB#vicidial_inbound_groups-welcome_message_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Welcome Message Filename: </td><td align=left><input type=text name=welcome_message_filename id=welcome_message_filename size=20 maxlength=50 value=\"$welcome_message_filename\"> <a href=\"javascript:launch_chooser('welcome_message_filename','date',500);\">audio chooser</a> $NWB#vicidial_inbound_groups-welcome_message_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Play Welcome Message: </td><td align=left><select size=1 name=play_welcome_message><option>ALWAYS</option><option>NEVER</option><option>IF_WAIT_ONLY</option><option>YES_UNLESS_NODELAY</option><option SELECTED>$play_welcome_message</option></select>$NWB#vicidial_inbound_groups-play_welcome_message$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Music On Hold Context: </td><td align=left><input type=text name=moh_context size=10 maxlength=20 value=\"$moh_context\">$NWB#vicidial_inbound_groups-moh_context$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>On Hold Prompt Filename: </td><td align=left><input type=text name=onhold_prompt_filename size=20 maxlength=50 value=\"$onhold_prompt_filename\">$NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>On Hold Prompt Filename: </td><td align=left><input type=text name=onhold_prompt_filename id=onhold_prompt_filename size=20 maxlength=50 value=\"$onhold_prompt_filename\"> <a href=\"javascript:launch_chooser('onhold_prompt_filename','date',600);\">audio chooser</a> $NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>On Hold Prompt Interval: </td><td align=left><input type=text name=prompt_interval size=5 maxlength=5 value=\"$prompt_interval\">$NWB#vicidial_inbound_groups-prompt_interval$NWE</td></tr>\n";
@@ -16711,7 +16754,7 @@ if ($ADD==3111)
echo "$Tgroups_menu";
echo "</select>$NWB#vicidial_inbound_groups-hold_time_option_xfer_group$NWE</td></tr>\n";
echo "<tr bgcolor=#CCFFFF><td align=right>Hold Time Option Callback Filename: </td><td align=left><input type=text name=hold_time_option_callback_filename size=20 maxlength=20 value=\"$hold_time_option_callback_filename\">$NWB#vicidial_inbound_groups-hold_time_option_callback_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#CCFFFF><td align=right>Hold Time Option Callback Filename: </td><td align=left><input type=text name=hold_time_option_callback_filename id=hold_time_option_callback_filename size=20 maxlength=20 value=\"$hold_time_option_callback_filename\"> <a href=\"javascript:launch_chooser('hold_time_option_callback_filename','date',900);\">audio chooser</a> $NWB#vicidial_inbound_groups-hold_time_option_callback_filename$NWE</td></tr>\n";
echo "<tr bgcolor=#CCFFFF><td align=right>Hold Time Option Callback List ID: </td><td align=left><input type=text name=hold_time_option_callback_list_id size=14 maxlength=14 value=\"$hold_time_option_callback_list_id\">$NWB#vicidial_inbound_groups-hold_time_option_callback_list_id$NWE</td></tr>\n";
@@ -17103,16 +17146,16 @@ if ($ADD==3511)
$track_in_vdac = $row[8];
echo "<br>MODIFY A CALL MENU RECORD: $menu_id<form action=$PHP_SELF method=POST>\n";
echo "<br>MODIFY A CALL MENU RECORD: $menu_id<form action=$PHP_SELF method=POST name=admin_form id=admin_form>\n";
echo "<input type=hidden name=ADD value=4511>\n";
echo "<input type=hidden name=menu_id value=\"$menu_id\">\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu ID: </td><td align=left>$menu_id $NWB#vicidial_call_menu-menu_id$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Name: </td><td align=left><input type=text name=menu_name size=40 maxlength=50 value=\"$menu_name\">$NWB#vicidial_call_menu-menu_name$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Prompt: </td><td align=left><input type=text name=menu_prompt size=50 maxlength=100 value=\"$menu_prompt\">$NWB#vicidial_call_menu-menu_prompt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Prompt: </td><td align=left><input type=text name=menu_prompt id=menu_prompt size=50 maxlength=100 value=\"$menu_prompt\"> <a href=\"javascript:launch_chooser('menu_prompt','date',30);\">audio chooser</a> $NWB#vicidial_call_menu-menu_prompt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Timeout: </td><td align=left><input type=text name=menu_timeout size=10 maxlength=5 value=\"$menu_timeout\">$NWB#vicidial_call_menu-menu_timeout$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Timeout Prompt: </td><td align=left><input type=text name=menu_timeout_prompt size=50 maxlength=100 value=\"$menu_timeout_prompt\">$NWB#vicidial_call_menu-menu_timeout_prompt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Invalid Prompt: </td><td align=left><input type=text name=menu_invalid_prompt size=50 maxlength=100 value=\"$menu_invalid_prompt\">$NWB#vicidial_call_menu-menu_invalid_prompt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Timeout Prompt: </td><td align=left><input type=text name=menu_timeout_prompt id=menu_timeout_prompt size=50 maxlength=100 value=\"$menu_timeout_prompt\"> <a href=\"javascript:launch_chooser('menu_timeout_prompt','date',30);\">audio chooser</a> $NWB#vicidial_call_menu-menu_timeout_prompt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Invalid Prompt: </td><td align=left><input type=text name=menu_invalid_prompt id=menu_invalid_prompt size=50 maxlength=100 value=\"$menu_invalid_prompt\"> <a href=\"javascript:launch_chooser('menu_invalid_prompt','date',30);\">audio chooser</a> $NWB#vicidial_call_menu-menu_invalid_prompt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Repeat: </td><td align=left><input type=text name=menu_repeat size=4 maxlength=3 value=\"$menu_repeat\">$NWB#vicidial_call_menu-menu_repeat$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Menu Time Check: </td><td align=left><select size=1 name=menu_time_check>\n";
if ($menu_time_check > 0)
@@ -18239,7 +18282,7 @@ if ($ADD==311111111111)
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT server_id,server_description,server_ip,active,asterisk_version,max_vicidial_trunks,telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,local_gmt,voicemail_dump_exten,answer_transfer_agent,ext_context,sys_perf_log,vd_server_logs,agi_output,vicidial_balance_active,balance_trunks_offlimits,recording_web_link,alt_server_ip,active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,outbound_calls_per_second,sysload,channels_total,cpu_idle_percent,disk_usage from servers where server_id='$server_id' or server_ip='$server_ip';";
$stmt="SELECT server_id,server_description,server_ip,active,asterisk_version,max_vicidial_trunks,telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,local_gmt,voicemail_dump_exten,answer_transfer_agent,ext_context,sys_perf_log,vd_server_logs,agi_output,vicidial_balance_active,balance_trunks_offlimits,recording_web_link,alt_server_ip,active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,outbound_calls_per_second,sysload,channels_total,cpu_idle_percent,disk_usage,sounds_update from servers where server_id='$server_id' or server_ip='$server_ip';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$server_id = $row[0];
@@ -18274,6 +18317,7 @@ if ($ADD==311111111111)
$channels_total = $row[29];
$cpu_idle_percent = $row[30];
$disk_usage = $row[31];
$sounds_update = $row[32];
$cpu = (100 - $cpu_idle_percent);
$disk_usage = preg_replace("/ /"," - ",$disk_usage);
@@ -18317,6 +18361,7 @@ if ($ADD==311111111111)
echo "<tr bgcolor=#B6D3FC><td align=right>Active Asterisk Server: </td><td align=left><select size=1 name=active_asterisk_server><option>Y</option><option>N</option><option selected>$active_asterisk_server</option></select>$NWB#servers-active_asterisk_server$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Generate conf files: </td><td align=left><select size=1 name=generate_vicidial_conf><option>Y</option><option>N</option><option selected>$generate_vicidial_conf</option></select>$NWB#servers-generate_vicidial_conf$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Rebuild conf files: </td><td align=left><select size=1 name=rebuild_conf_files><option>Y</option><option>N</option><option selected>$rebuild_conf_files</option></select>$NWB#servers-rebuild_conf_files$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Sounds Update: </td><td align=left><select size=1 name=sounds_update><option>Y</option><option>N</option><option selected>$sounds_update</option></select>$NWB#servers-sounds_update$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit VALUE=SUBMIT></td></tr>\n";
@@ -18827,7 +18872,7 @@ if ($ADD==311111111111111)
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,agentonly_callback_campaign_lock from system_settings;";
$stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$version = $row[0];
@@ -18865,9 +18910,13 @@ if ($ADD==311111111111111)
$outbound_autodial_active = $row[32];
$outbound_calls_per_second = $row[33];
$agentonly_callback_campaign_lock = $row[34];
$sounds_central_control_active = $row[35];
$sounds_web_server = $row[36];
$sounds_web_directory = $row[37];
echo "<br>MODIFY VICIDIAL SYSTEM SETTINGS<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=411111111111111>\n";
echo "<input type=hidden name=sounds_web_directory value=\"$sounds_web_directory\">\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Version: </td><td align=left> $version</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>DB Schema Version: </td><td align=left> $db_schema_version</td></tr>\n";
@@ -18922,6 +18971,11 @@ if ($ADD==311111111111111)
echo "</select>$NWB#settings-vdc_header_phone_format$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Agent API Active: </td><td align=left><select size=1 name=vdc_agent_api_active><option>1</option><option>0</option><option selected>$vdc_agent_api_active</option></select>$NWB#settings-vdc_agent_api_active$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Agent Only Callback Campaign Lock: </td><td align=left><select size=1 name=agentonly_callback_campaign_lock><option>1</option><option>0</option><option selected>$agentonly_callback_campaign_lock</option></select>$NWB#settings-agentonly_callback_campaign_lock$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Central Sound Control Active: </td><td align=left><select size=1 name=sounds_central_control_active><option>1</option><option>0</option><option selected>$sounds_central_control_active</option></select>$NWB#settings-sounds_central_control_active$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Sounds Web Server IP: </td><td align=left><input type=text name=sounds_web_server size=18 maxlength=15 value=\"$sounds_web_server\">$NWB#settings-sounds_web_server$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Sounds Web Directory: </td><td align=left><a href=\"http://$sounds_web_server/$sounds_web_directory\">$sounds_web_directory</a> $NWB#settings-sounds_web_directory$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>QC Features Active: </td><td align=left><select size=1 name=qc_features_active><option>1</option><option>0</option><option selected>$qc_features_active</option></select>$NWB#settings-qc_features_active$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Outbound Auto-Dial Active: </td><td align=left><select size=1 name=outbound_autodial_active><option>1</option><option>0</option><option selected>$outbound_autodial_active</option></select>$NWB#settings-outbound_autodial_active$NWE</td></tr>\n";
@@ -7,6 +7,7 @@
# CHANGES
# 90310-0709 - First Build
# 90508-0542 - Added Call Menu option, changed script to use long PHP tags
# 90514-0605 - Added audio prompt selection functions
#
@@ -75,6 +76,10 @@ if ($hh=='reports')
echo "</title>\n";
echo "<script language=\"Javascript\">\n";
echo "var field_name = '';\n";
echo "var user = '$PHP_AUTH_USER';\n";
echo "var pass = '$PHP_AUTH_PW';\n";
echo "var epoch = '" . date("U") . "';\n";
if ($TCedit_javascript > 0)
{
@@ -327,6 +332,40 @@ function user_submit()
<?php
}
#### Javascript for auto-generate of user ID Button
else
{
?>
function launch_chooser(fieldname,stage,vposition)
{
var audiolistURL = "./non_agent_api.php";
var audiolistQuery = "source=admin&function=sounds_list&user=" + user + "&pass=" + pass + "&format=selectframe&stage=" + stage + "&comments=" + fieldname;
var Iframe_content = '<IFRAME SRC="' + audiolistURL + '?' + audiolistQuery + '" style="width:560;height:440;background-color:white;" scrolling="NO" frameborder="0" allowtransparency="true" id="audio_chooser_frame' + epoch + '" name="audio_chooser_frame" width="560" height="460" STYLE="z-index:2"> </iframe>';
document.getElementById("audio_chooser_span").style.position = "absolute";
document.getElementById("audio_chooser_span").style.left = "300px";
document.getElementById("audio_chooser_span").style.top = vposition + "px";
document.getElementById("audio_chooser_span").style.visibility = 'visible';
document.getElementById("audio_chooser_span").innerHTML = Iframe_content;
}
function close_chooser()
{
document.getElementById("audio_chooser_span").style.visibility = 'hidden';
document.getElementById("audio_chooser_span").innerHTML = '';
}
function user_submit()
{
var user_field = document.getElementById("user");
user_field.disabled = false;
document.userform.submit();
}
<?php
}
### Javascript for shift end-time calculation and display
if ( ($ADD==131111111) or ($ADD==331111111) or ($ADD==431111111) )
{
@@ -661,7 +700,14 @@ $admin_home_url_LU = $row[0];
</TR><TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $status_sh ?>> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=321111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $status_fc ?> SIZE=<?php echo $header_font_size ?>> System Statuses </a></TD>
</TR>
<?php if ( ($sounds_central_control_active > 0) or ($SSsounds_central_control_active > 0) )
{ ?>
<TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $status_sh ?>> &nbsp;
<a href="audio_store.php"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $status_fc ?> SIZE=<?php echo $header_font_size ?>> Audio Store </a></TD>
</TR>
<?php }
}
?>
<!-- REPORTS NAVIGATION -->
<TR><TD <?php echo $reports_hh ?>>
@@ -671,6 +717,10 @@ $admin_home_url_LU = $row[0];
</TD><TD VALIGN=TOP WIDTH=<?php echo $page_width ?> BGCOLOR=#D9E6FE>
<!-- END SIDEBAR NAVIGATION -->
<span style="position:absolute;left:300px;top:30px;z-index:1;visibility:hidden;" id="audio_chooser_span">
</span>
<TABLE BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0 WIDTH=<?php echo $page_width ?> HEIGHT=15>
<TR BGCOLOR=#015B91><TD ALIGN=LEFT BGCOLOR=#015B91><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><a href="<?php echo $admin_home_url_LU ?>"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=1>HOME</a> | <A HREF="../agc/timeclock.php?referrer=admin"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=1> Timeclock</A> | <a href="<?php echo $ADMIN ?>?force_logout=1"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=1>Logout</a></TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><?php echo date("l F j, Y G:i:s A") ?> &nbsp; </B></TD></TR>
+290
View File
@@ -0,0 +1,290 @@
<?php
# audio_store.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# Central Audio Storage script
#
# CHANGES
# 90511-1325 - first build
#
$version = '2.2.0-1';
$build = '90511-1325';
$MT[0]='';
require("dbconnect.php");
$PHP_SELF=$_SERVER['PHP_SELF'];
$audiofile=$_FILES["audiofile"];
$AF_orig = $_FILES['audiofile']['name'];
$AF_path = $_FILES['audiofile']['tmp_name'];
if (isset($_GET["submit_file"])) {$submit_file=$_GET["submit_file"];}
elseif (isset($_POST["submit_file"])) {$submit_file=$_POST["submit_file"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["overwrite"])) {$overwrite=$_GET["overwrite"];}
elseif (isset($_POST["overwrite"])) {$overwrite=$_POST["overwrite"];}
if (isset($_GET["action"])) {$action=$_GET["action"];}
elseif (isset($_POST["action"])) {$action=$_POST["action"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
if (isset($_GET["audiofile_name"])) {$audiofile_name=$_GET["audiofile_name"];}
elseif (isset($_POST["audiofile_name"])) {$audiofile_name=$_POST["audiofile_name"];}
if (isset($_FILES["audiofile"])) {$audiofile_name=$_FILES["audiofile"]['name'];}
if (isset($_GET["lead_file"])) {$lead_file=$_GET["lead_file"];}
elseif (isset($_POST["lead_file"])) {$lead_file=$_POST["lead_file"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,sounds_central_control_active,sounds_web_server,sounds_web_directory FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ss_conf_ct = mysql_num_rows($rslt);
if ($ss_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$sounds_central_control_active = $row[1];
$sounds_web_server = $row[2];
$sounds_web_directory = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
### check if sounds server matches this server IP, if not then exit with an error
if ( ( (strlen($sounds_web_server)) != (strlen($WEBserver_ip)) ) or (!eregi("$sounds_web_server",$WEBserver_ip) ) )
{
echo "ERROR: server_ip($WEBserver_ip) does not match sounds web server ip($sounds_web_server)\n";
exit;
}
### check if web directory exists, if not generate one
if (strlen($sounds_web_directory) < 30)
{
$sounds_web_directory = '';
$possible = "0123456789cdfghjkmnpqrstvwxyz";
$i = 0;
$length = 30;
while ($i < $length)
{
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
$sounds_web_directory .= $char;
$i++;
}
mkdir("$WeBServeRRooT/$sounds_web_directory");
chmod("$WeBServeRRooT/$sounds_web_directory", 0766);
if ($DB > 0) {echo "$WeBServeRRooT/$sounds_web_directory\n";}
$stmt="UPDATE system_settings set sounds_web_directory='$sounds_web_directory';";
$rslt=mysql_query($stmt, $link);
echo "NOTICE: new web directory created\n";
}
### get list of all servers, if not one of them, then force authentication check
$stmt = "SELECT server_ip FROM servers;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$sv_conf_ct = mysql_num_rows($rslt);
$i=0;
$server_ips ='|';
while ($sv_conf_ct > $i)
{
$row=mysql_fetch_row($rslt);
$server_ips .= "$row[0]|";
$i++;
}
$ip = getenv("REMOTE_ADDR");
if (!preg_match("/\|$ip\|/", $server_ips))
{
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_campaigns='1'";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
}
### list all files in sounds web directory
if ($action == "LIST")
{
$i=0;
$filename_sort=$MT;
$dirpath = "$WeBServeRRooT/$sounds_web_directory";
$dh = opendir($dirpath);
while (false !== ($file = readdir($dh)))
{
# Do not list subdirectories
if ( (!is_dir("$dirpath/$file")) and (preg_match('/\.wav$|\.gsm$/', $file)) )
{
if (file_exists("$dirpath/$file"))
{
$file_names[$i] = $file;
$file_epoch[$i] = filemtime("$dirpath/$file");
$file_dates[$i] = date ("Y-m-d H:i:s.", filemtime("$dirpath/$file"));
$file_sizes[$i] = filesize("$dirpath/$file");
$filename_sort[$i] = $file . "----------" . $i . "----------" . $file_sizes[$i];
$i++;
}
}
}
closedir($dh);
sort($filename_sort);
sleep(1);
$k=0;
while($k < $i)
{
$filename_split = explode('----------',$filename_sort[$k]);
$m = $filename_split[1];
$size = $filename_split[2];
$NOWsize = filesize("$dirpath/$file_names[$m]");
if ($size == $NOWsize)
{
echo "$k\t$file_names[$m]\t$file_dates[$m]\t$file_sizes[$m]\t$file_epoch[$m]\n";
}
$k++;
}
exit;
}
### upload audio file from server to webserver
# curl 'http://10.0.0.4/vicidial/audio_store.php?action=AUTOUPLOAD' -F "audiofile=@/var/lib/asterisk/sounds/beep.gsm"
if ($action == "AUTOUPLOAD")
{
if ($audiofile)
{
copy($AF_path, "$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
chmod("$WeBServeRRooT/$sounds_web_directory/$audiofile_name", 0766);
echo "SUCCESS: $audiofile_name uploaded size:" . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "\n";
exit;
}
else
{
echo "ERROR: no file uploaded\n";
}
exit;
}
?>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<!-- VERSION: <?php echo $version ?> BUILD: <?php echo $build ?> -->
<title>VICIDIAL ADMINISTRATION: Audio Store
<?php
##### BEGIN Set variables to make header show properly #####
$ADD = '311111111111111';
$hh = 'admin';
$LOGast_admin_access = '1';
$ADMIN = 'admin.php';
$page_width='770';
$section_width='750';
$header_font_size='3';
$subheader_font_size='2';
$subcamp_font_size='2';
$header_selected_bold='<b>';
$header_nonselected_bold='';
$admin_color = '#FFFF99';
$admin_font = 'BLACK';
$admin_color = '#E6E6E6';
$subcamp_color = '#C6C6C6';
##### END Set variables to make header show properly #####
require("admin_header.php");
?>
<TABLE WIDTH=<?php echo $page_width ?> BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR BGCOLOR=#E6E6E6><TD ALIGN=LEFT><FONT FACE="ARIAL,HELVETICA" SIZE=2><B> &nbsp; Audio Store</TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" SIZE=2><B> &nbsp; </TD></TR>
<?php
echo "<TR BGCOLOR=\"#F0F5FE\"><TD ALIGN=LEFT COLSPAN=2><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=3><B> &nbsp; \n";
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$FILE_datetime = $STARTtime;
$date = date("r");
$browser = getenv("HTTP_USER_AGENT");
$script_name = getenv("SCRIPT_NAME");
$server_name = getenv("SERVER_NAME");
$server_port = getenv("SERVER_PORT");
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
else {$HTTPprotocol = 'http://';}
$admDIR = "$HTTPprotocol$server_name:$server_port$script_name";
$admDIR = eregi_replace('audio_store.php','',$admDIR);
$admSCR = 'admin.php';
$NWB = " &nbsp; <a href=\"javascript:openNewWindow('$admDIR$admSCR?ADD=99999";
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
$secX = date("U");
$pulldate0 = "$year-$mon-$mday $hour:$min:$sec";
if ($action == "MANUALUPLOAD")
{
if ($audiofile)
{
copy($AF_path, "$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
chmod("$WeBServeRRooT/$sounds_web_directory/$audiofile_name", 0766);
echo "SUCCESS: $audiofile_name uploaded size:" . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "\n";
$stmt="UPDATE servers SET sounds_update='Y';";
$rslt=mysql_query($stmt, $link);
}
else
{
echo "ERROR: no file uploaded\n";
}
}
?>
<form action=<?php echo $PHP_SELF ?> method=post enctype="multipart/form-data">
<input type=hidden name=action value="MANUALUPLOAD">
<table align=center width="700" border=0 cellpadding=5 cellspacing=0 bgcolor=#D9E6FE>
<tr>
<td align=right width="35%"><B><font face="arial, helvetica" size=2>Audio File to Upload:</font></B></td>
<td align=left width="65%"><input type=file name="audiofile" value=""> <?php echo "$NWB#audio_store$NWE"; ?></td>
</tr>
<tr>
<td align=center colspan=2><input type=submit name=submit value=submit></td>
</tr>
<tr><td align=left><font size=1> &nbsp; </font></td><td align=right><font size=1>Audio Store- &nbsp; &nbsp; VERSION: <?php echo $version ?> &nbsp; &nbsp; BUILD: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
</table>
</TD></TR></TABLE>
+2
View File
@@ -16,6 +16,8 @@ foreach ($DBCagc as $DBCline)
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARserver_ip", $DBCline))
{$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
+165 -3
View File
@@ -21,10 +21,11 @@
# 90118-1056 - Added logging of API functions
# 90428-0209 - Added blind_monitor function
# 90508-0642 - Changed to PHP long tags
# 90514-0602 - Added sounds_list function
#
$version = '2.2.0-7';
$build = '90508-0642';
$version = '2.2.0-8';
$build = '90514-0602';
require("dbconnect.php");
@@ -109,6 +110,8 @@ if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -132,6 +135,7 @@ while ($i < $qm_conf_ct)
if ($non_latin < 1)
{
$DB=ereg_replace("[^0-9]","",$DB);
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
$function = ereg_replace("[^-\_0-9a-zA-Z]","",$function);
@@ -186,7 +190,7 @@ if ($non_latin < 1)
$phone_login = ereg_replace("[^0-9a-zA-Z]","",$phone_login);
$session_id = ereg_replace("[^0-9]","",$session_id);
$server_ip = ereg_replace("[^\.0-9]","",$server_ip);
$stage = ereg_replace("[^A-Z]","",$stage);
$stage = ereg_replace("[^a-zA-Z]","",$stage);
}
if (strlen($list_id)<1) {$list_id='999';}
@@ -266,6 +270,164 @@ if ($function == 'version')
################################################################################
### sounds_list - sends a list of the sounds in the audio store
################################################################################
if ($function == 'sounds_list')
{
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 6;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$allowed_user=$row[0];
if ($allowed_user < 1)
{
$result = 'ERROR';
$result_reason = "sounds_list USER DOES NOT HAVE PERMISSION TO VIEW SOUNDS LIST";
echo "$result: $result_reason: |$user|$allowed_user|\n";
$data = "$allowed_user";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,sounds_central_control_active,sounds_web_server,sounds_web_directory FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ss_conf_ct = mysql_num_rows($rslt);
if ($ss_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$sounds_central_control_active = $row[1];
$sounds_web_server = $row[2];
$sounds_web_directory = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($sounds_central_control_active < 1)
{
$result = 'ERROR';
$result_reason = "sounds_list CENTRAL SOUND CONTROL IS NOT ACTIVE";
echo "$result: $result_reason: |$user|$sounds_central_control_active|\n";
$data = "$sounds_central_control_active";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$i=0;
$filename_sort=$MT;
$dirpath = "$WeBServeRRooT/$sounds_web_directory";
$dh = opendir($dirpath);
if ($DB) {echo "$dirpath|$stage|$format\n";}
while (false !== ($file = readdir($dh)))
{
# Do not list subdirectories
if ( (!is_dir("$dirpath/$file")) and (preg_match('/\.wav$|\.gsm$/', $file)) )
{
if (file_exists("$dirpath/$file"))
{
$file_names[$i] = $file;
$file_namesPROMPT[$i] = preg_replace("/\.wav$|\.gsm$/","",$file);
$file_epoch[$i] = filemtime("$dirpath/$file");
$file_dates[$i] = date ("Y-m-d H:i:s.", filemtime("$dirpath/$file"));
$file_sizes[$i] = filesize("$dirpath/$file");
$file_sizesPAD[$i] = sprintf("[%020s]\n",filesize("$dirpath/$file"));
if (eregi('date',$stage)) {$file_sort[$i] = $file_epoch[$i] . "----------" . $i;}
if (eregi('name',$stage)) {$file_sort[$i] = $file_names[$i] . "----------" . $i;}
if (eregi('size',$stage)) {$file_sort[$i] = $file_sizesPAD[$i] . "----------" . $i;}
$i++;
}
}
}
closedir($dh);
if (eregi('date',$stage)) {rsort($file_sort);}
if (eregi('name',$stage)) {sort($file_sort);}
if (eregi('size',$stage)) {rsort($file_sort);}
sleep(1);
$k=0;
$sf=0;
while($k < $i)
{
$file_split = explode('----------',$file_sort[$k]);
$m = $file_split[1];
$NOWsize = filesize("$dirpath/$file_names[$m]");
if ($DB) {echo "$file_sort[$k]|$size|$NOWsize|\n";}
if ($file_sizes[$m] == $NOWsize)
{
if (eregi('tab',$format))
{echo "$k\t$file_names[$m]\t$file_dates[$m]\t$file_sizes[$m]\t$file_epoch[$m]\n";}
if (eregi('link',$format))
{echo "<a href=\"http://$sounds_web_server/$sounds_web_directory/$file_names[$m]\">$file_names[$m]</a><br>\n";}
if (eregi('selectframe',$format))
{
if ($sf < 1)
{
echo "\n";
echo "<HTML><head><title>NON-AGENT API</title>\n";
echo "<script language=\"Javascript\">\n";
echo "function choose_file(filename,fieldname)\n";
echo " {\n";
echo " if (filename.length > 0)\n";
echo " {\n";
echo " parent.document.getElementById(fieldname).value = filename;\n";
echo " document.getElementById(\"selectframe\").innerHTML = '';\n";
echo " document.getElementById(\"selectframe\").style.visibility = 'hidden';\n";
echo " parent.close_chooser();\n";
echo " }\n";
echo " }\n";
echo "function close_file()\n";
echo " {\n";
echo " document.getElementById(\"selectframe\").innerHTML = '';\n";
echo " document.getElementById(\"selectframe\").style.visibility = 'hidden';\n";
echo " parent.close_chooser();\n";
echo " }\n";
echo "</script>\n";
echo "</head>\n\n";
echo "<body>\n";
echo "<a href=\"javascript:close_file();\"><font size=1 face=\"Arial,Helvetica\">close frame</font></a>\n";
echo "<div id='selectframe' style=\"height:400px;width:520px;overflow:scroll;\">\n";
echo "<table border=0 cellpadding=1 cellspacing=2 width=500 bgcolor=white><tr>\n";
echo "<td>#</td>\n";
echo "<td><a href=\"$PHP_SELF?source=admin&function=sounds_list&user=$user&pass=$pass&format=selectframe&comments=$comments&stage=name\"><font color=black>FILENAME</td>\n";
echo "<td><a href=\"$PHP_SELF?source=admin&function=sounds_list&user=$user&pass=$pass&format=selectframe&comments=$comments&stage=date\"><font color=black>DATE</td>\n";
echo "<td><a href=\"$PHP_SELF?source=admin&function=sounds_list&user=$user&pass=$pass&format=selectframe&comments=$comments&stage=size\"><font color=black>SIZE</td>\n";
echo "<td>PLAY</td>\n";
echo "</tr>\n";
}
$sf++;
echo "<tr><td><font size=1 face=\"Arial,Helvetica\">$sf</td>\n";
echo "<td><a href=\"javascript:choose_file('$file_namesPROMPT[$m]','$comments');\"><font size=1 face=\"Arial,Helvetica\">$file_names[$m]</a></td>\n";
echo "<td><font size=1 face=\"Arial,Helvetica\">$file_dates[$m]</td>\n";
echo "<td><font size=1 face=\"Arial,Helvetica\">$file_sizes[$m]</td>\n";
echo "<td><a href=\"http://$sounds_web_server/$sounds_web_directory/$file_names[$m]\" target=\"_blank\"><font size=1 face=\"Arial,Helvetica\">PLAY</a></td></tr>\n";
}
}
$k++;
}
if ($sf > 0)
{
echo "</table></div></body></HTML>\n";
}
exit;
}
}
}
################################################################################
### blind_monitor - sends call to phone from session from listening
################################################################################