Added web-configurable meetme and musiconhold

several bug fixes

git-svn-id: svn://192.168.202.10@1213 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-09-04 10:49:03 +00:00
parent d8b169496d
commit fce1999697
13 changed files with 1321 additions and 574 deletions
+234 -22
View File
@@ -11,6 +11,7 @@
# CHANGELOG
# 90513-0458 - First Build
# 90518-2107 - Added force-upload option
# 90831-1349 - Added music-on-hold sync
#
# constants
@@ -19,6 +20,8 @@ $US='__';
$MT[0]='';
$uploaded=0;
$downloaded=0;
$force_moh_rebuild=0;
$new_file_moh_rebuild=0;
$secT = time();
$now_date_epoch = $secT;
@@ -56,6 +59,7 @@ if (length($ARGV[0])>1)
print " [--force-download] = force download of everything from audio store\n";
print " [--force-upload] = force upload of all local audio files to the audio store\n";
print " [--settings-override] = ignore database settings and run sync anyway\n";
print " [--force-moh-rebuild] = ignore database settings and rebuild Music On Hold\n";
print "\n";
exit;
}
@@ -86,6 +90,11 @@ if (length($ARGV[0])>1)
$settings_override=1;
if ($DB) {print "\n----- SETTINGS OVERRIDE -----\n\n";}
}
if ($args =~ /--force-moh-rebuild/i)
{
$force_moh_rebuild=1;
if ($DB) {print "\n----- FORCE MUSIC ON HOLD REBUILD -----\n\n";}
}
if ($args =~ /--debugX/i)
{
$DBX=1;
@@ -151,30 +160,30 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
### 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();
$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();
$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) )
{
@@ -280,6 +289,7 @@ while ($i <= $#list)
&event_logger;
$downloaded++;
$new_file_moh_rebuild++;
}
else
{
@@ -376,6 +386,208 @@ if ($uploaded > 0)
}
###### BEGIN Music on hold rebuild #####
$wav = '.wav';
$gsm = '.gsm';
$stmtA = "SELECT rebuild_music_on_hold 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;
$rebuild_music_on_hold = $aryA[0];
}
$sthA->finish();
if ( ($force_moh_rebuild > 0) || ($new_file_moh_rebuild > 0) || ($rebuild_music_on_hold =~ /Y/i) )
{
$stmtA="UPDATE servers SET rebuild_music_on_hold='N' where server_ip = '$VARserver_ip';";
$affected_rows = $dbhA->do($stmtA);
### Find music on hold contexts to remove
$stmtA = "SELECT moh_id FROM vicidial_music_on_hold where remove='Y' and moh_id NOT IN('astdb','sounds','agi-bin','keys');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsM=$sthA->rows;
@remove_moh_id=@MT;
$j=0;
while ($sthArowsM > $j)
{
@aryA = $sthA->fetchrow_array;
$remove_moh_id[$j] = $aryA[0];
$j++;
}
$sthA->finish();
### Remove flagged music on hold contexts
$j=0;
while ($sthArowsM > $j)
{
$stmtA="DELETE from vicidial_music_on_hold where moh_id='$remove_moh_id[$j]' and remove='Y' and moh_id NOT IN('astdb','sounds','agi-bin','keys');";
$affected_rowsX = $dbhA->do($stmtA);
$stmtB="DELETE from vicidial_music_on_hold_files where moh_id='$remove_moh_id[$j]' and moh_id NOT IN('astdb','sounds','agi-bin','keys');";
$affected_rowsY = $dbhA->do($stmtB);
if ($affected_rowsX > 0)
{`rm -fr /var/lib/asterisk/$remove_moh_id[$j]`;}
if ($DBX)
{
print "Deleting Existing MoH: $affected_rowsX|$affected_rowsY|$stmtA|$stmtB|rm -fr /var/lib/asterisk/$remove_moh_id[$j]\n";
}
$j++;
}
### Find active music on hold contexts
$stmtA = "SELECT moh_id,moh_name,random FROM vicidial_music_on_hold where active='Y' and moh_id NOT IN('astdb','sounds','agi-bin','keys');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsC=$sthA->rows;
@remove_moh_id=@MT;
$j=0;
while ($sthArowsC > $j)
{
@aryA = $sthA->fetchrow_array;
$moh_id[$j] = $aryA[0];
$moh_name[$j] = $aryA[1];
$random[$j] = $aryA[2];
$j++;
}
$sthA->finish();
### Go through each context and check the files in the folders
$j=0;
while ($sthArowsC > $j)
{
$filelist_names = '|';
$MoH_directory = "/var/lib/asterisk/$moh_id[$j]";
### Check if directory exists, if not, create it
if ( -e ("$MoH_directory")) {$mohpath = "$MoH_directory";}
else
{
`mkdir $MoH_directory`;
$mohpath = "$MoH_directory";
if ($DBX)
{
print "Creating New MoH: $MoH_directory\n";
}
}
opendir(sounds, "$PATHsounds");
@sounds= readdir(sounds);
closedir(sounds);
### copy over files that are not in place currently
$stmtA = "SELECT filename,rank FROM vicidial_music_on_hold_files where moh_id='$moh_id[$j]' order by rank;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsF=$sthA->rows;
@remove_moh_id=@MT;
$m=0;
while ($sthArowsF > $m)
{
@aryA = $sthA->fetchrow_array;
$filename[$m] = $aryA[0];
$rank[$m] = $aryA[1];
$filerank[$m] = sprintf("%04d",$rank[$m]) . "_";
$fileexists[$m] = 0;
$filesize_moh[$m] = 0;
$filesize_original[$m] = 0;
$filelist_names .= "$filerank[$m]$filename[$m]|";
if ( (-e "$MoH_directory/$filerank[$m]$filename[$m]$wav") || (-e "$MoH_directory/$filerank[$m]$filename[$m]$gsm") )
{
if (-e "$MoH_directory/$filerank[$m]$filename[$m]$wav")
{
$temp_filesize_moh = (-s "$MoH_directory/$filerank[$m]$filename[$m]$wav");
$temp_filesize_original = (-s "$PATHsounds/$filename[$m]$wav");
$filesize_moh[$m] = ($filesize_moh[$m] + $temp_filesize_moh);
$filesize_original[$m] = ($filesize_original[$m] + $temp_filesize_original);
if ($DBX)
{
print "WAV check existing:\n";
print "$temp_filesize_moh|$filesize_moh[$m]|$MoH_directory/$filerank[$m]$filename[$m]$wav\n";
print "$temp_filesize_original|$filesize_original[$m]|$PATHsounds/$filename[$m]$wav\n";
}
}
if (-e "$MoH_directory/$filerank[$m]$filename[$m]$gsm")
{
$temp_filesize_moh = (-s "$MoH_directory/$filerank[$m]$filename[$m]$gsm");
$temp_filesize_original = (-s "$PATHsounds/$filename[$m]$gsm");
$filesize_moh[$m] = ($filesize_moh[$m] + $temp_filesize_moh);
$filesize_original[$m] = ($filesize_original[$m] + $temp_filesize_original);
if ($DBX)
{
print "GSM check existing:\n";
print "$temp_filesize_moh|$filesize_moh[$m]|$MoH_directory/$filerank[$m]$filename[$m]$gsm\n";
print "$temp_filesize_original|$filesize_original[$m]|$PATHsounds/$filename[$m]$gsm\n";
}
}
if ( ($filesize_moh[$m] == $filesize_original[$m]) && ($filesize_moh[$m] > 0) )
{$fileexists[$m]++;}
}
if ($fileexists[$m] < 1)
{
$d=0;
foreach(@sounds)
{
if ($sounds[$d] =~ /^$filename[$m]\./)
{
`cp $PATHsounds/$sounds[$d] $MoH_directory/$filerank[$m]$sounds[$d]`;
$fileexists[$m]++;
if ($DBX)
{print "Copy new file: $PATHsounds/$sounds[$d] $MoH_directory/$filerank[$m]$sounds[$d]\n";}
}
$d++;
}
}
$m++;
}
$sthA->finish();
opendir(mohdir, "$MoH_directory");
@MoH_files= readdir(mohdir);
closedir(mohdir);
### Check for files not in MoH context and delete them
$d=0;
foreach(@MoH_files)
{
$MoH_files_check[$d] = $MoH_files[$d];
$MoH_files_check[$d] =~ s/\..*$//gi;
if ($DBX)
{print "Checking file: $MoH_files[$d] $MoH_files_check[$d] $filelist_names\n";}
if ( (length($MoH_files[$d]) > 4) && (-f "$MoH_directory/$MoH_files[$d]") && ($filelist_names !~ /\|$MoH_files_check[$d]\|/) )
{
`rm -f $MoH_directory/$MoH_files[$d]`;
if ($DBX)
{print "Deleting file: $MoH_directory/$MoH_files[$d] $filelist_names\n";}
}
$d++;
}
$j++;
}
### reloading moh in Asterisk
if ($DBX)
{print "reloading moh in asterisk\n";}
`screen -XS asterisk eval 'stuff "moh reload\015"'`;
}
###### END Music on hold rebuild #####
if($DB)
{
print "AUDIO FILES ON SERVER: $total_files\n";
+234 -30
View File
@@ -40,6 +40,7 @@
# 90722-1102 - Added list reset by time option
# 90812-0053 - Added clear out non-used vicidial_conferences sessions
# 90821-1246 - Fixed central voicemail server conf file, changed voicemail to use phone password
# 90903-1626 - Added musiconhold and meetme conf file generation
#
$DB=0; # Debug flag
@@ -682,7 +683,8 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
}
$sthA->finish();
##### Get the server_ips and server_ids of all VICIDIAL servers on the network #####
##### BEGIN Generate the server_ips and server_ids of all VICIDIAL servers on the network for load balancing #####
$stmtA = "SELECT server_ip,server_id FROM servers where server_ip!='$server_ip' and active_asterisk_server='Y' order by server_ip;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -726,8 +728,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
$sthA->finish();
##### END Generate the server_ips and server_ids of all VICIDIAL servers on the network for load balancing #####
##### Create Voicemail extensions for this server_ip
##### BEGIN Create Voicemail extensions for this server_ip #####
if ( ($THISserver_voicemail > 0) || (length($voicemail_server_id) < 1) )
{
$Vext .= "; Voicemail Extensions:\n";
@@ -792,9 +797,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
else
{$Vext .= "exten => 83047777777777,2,Playback(\${CALLERID(name)})\n";}
$Vext .= "exten => 83047777777777,3,Hangup\n";
##### END Create Voicemail extensions for this server_ip #####
##### Get the IAX carriers for this server_ip #####
##### BEGIN Generate the IAX carriers for this server_ip #####
$stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry FROM vicidial_server_carriers where server_ip='$server_ip' and active='Y' and protocol='IAX2' order by carrier_id;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -844,10 +851,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
##### END Generate the IAX carriers for this server_ip #####
##### Get the SIP carriers for this server_ip #####
##### BEGIN Generate the SIP carriers for this server_ip #####
$stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry FROM vicidial_server_carriers where server_ip='$server_ip' and active='Y' and protocol='SIP' order by carrier_id;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -897,12 +905,14 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
##### BEGIN Generate the SIP carriers for this server_ip #####
$Pext .= "\n";
$Pext .= "; Phones direct dial extensions:\n";
##### Get the IAX phone entries #####
##### BEGIN Generate the IAX phone entries #####
$stmtA = "SELECT extension,dialplan_number,voicemail_id,pass,template_id,conf_override,email,template_id,conf_override,outbound_cid,fullname,phone_context,phone_ring_timeout,conf_secret FROM phones where server_ip='$server_ip' and protocol='IAX2' and active='Y' order by extension;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -982,9 +992,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
##### END Generate the IAX phone entries #####
##### Get the SIP phone entries #####
##### BEGIN Generate the SIP phone entries #####
$stmtA = "SELECT extension,dialplan_number,voicemail_id,pass,template_id,conf_override,email,template_id,conf_override,outbound_cid,fullname,phone_context,phone_ring_timeout,conf_secret FROM phones where server_ip='$server_ip' and protocol='SIP' and active='Y' order by extension;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -1063,12 +1075,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
##### END Generate the SIP phone entries #####
##### Get the Call Menu entries #####
##### BEGIN Generate the Call Menu entries #####
$stmtA = "SELECT menu_id,menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group FROM vicidial_call_menu order by menu_id;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -1399,9 +1410,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
##### END Generate the Call Menu entries #####
### generate voicemail accounts for all distinct phones on dedicated voicemail server
##### BEGIN generate voicemail accounts for all distinct phones on dedicated voicemail server
if ($THISserver_voicemail > 0)
{
$vm='';
@@ -1444,15 +1457,106 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
}
##### END generate voicemail accounts for all distinct phones on dedicated voicemail server
##### BEGIN generate meetme entries for this server
$mm = "; ViciDial Conferences:\n";
### Find vicidial_conferences on this server
$stmtA = "SELECT conf_exten FROM vicidial_conferences where server_ip='$server_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsVC=$sthA->rows;
$j=0;
while ($sthArowsVC > $j)
{
@aryA = $sthA->fetchrow_array;
$vc_meetme[$j] = $aryA[0];
$j++;
}
$sthA->finish();
$j=0;
while ($sthArowsVC > $j)
{
$mm .= "conf => $vc_meetme[$j]\n";
$j++;
}
$mm .= "\n";
$mm .= "; Conferences:\n";
### Find conferences on this server
$stmtA = "SELECT conf_exten FROM conferences where server_ip='$server_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsC=$sthA->rows;
$j=0;
while ($sthArowsC > $j)
{
@aryA = $sthA->fetchrow_array;
$meetme[$j] = $aryA[0];
$j++;
}
$sthA->finish();
$j=0;
while ($sthArowsC > $j)
{
$mm .= "conf => $meetme[$j]\n";
$j++;
}
##### END generate meetme entries for this server
##### BEGIN generate music on hold entries for this server
$moh='';
### Find music on hold contexts
$stmtA = "SELECT moh_id,moh_name,random FROM vicidial_music_on_hold where remove='N' and active='Y' and moh_id NOT IN('astdb','sounds','agi-bin','keys');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsM=$sthA->rows;
$j=0;
while ($sthArowsM > $j)
{
@aryA = $sthA->fetchrow_array;
$moh_id[$j] = $aryA[0];
$moh_name[$j] = $aryA[1];
$random[$j] = $aryA[2];
$j++;
}
$sthA->finish();
$j=0;
while ($sthArowsM > $j)
{
$moh .= "; $moh_name[$j]\n";
$moh .= "[$moh_id[$j]]\n";
$moh .= "mode=files\n";
$moh .= "directory=/var/lib/asterisk/$moh_id[$j]\n";
if ($random[$j] =~ /Y/)
{$moh .= "random=yes\n";}
$moh .= "\n";
$j++;
}
##### END generate music on hold entries for this server
if ($DB) {print "writing auto-gen conf files\n";}
open(ext, ">/etc/asterisk/extensions-vicidial.conf") || die "can't open /etc/asterisk/extensions-vicidial.conf: $!\n";
open(iax, ">/etc/asterisk/iax-vicidial.conf") || die "can't open /etc/asterisk/iax-vicidial.conf: $!\n";
open(sip, ">/etc/asterisk/sip-vicidial.conf") || die "can't open /etc/asterisk/sip-vicidial.conf: $!\n";
open(vm, ">/etc/asterisk/voicemail-vicidial.conf") || die "can't open /etc/asterisk/voicemail-vicidial.conf: $!\n";
open(ext, ">/etc/asterisk/BUILDextensions-vicidial.conf") || die "can't open /etc/asterisk/BUILDextensions-vicidial.conf: $!\n";
open(iax, ">/etc/asterisk/BUILDiax-vicidial.conf") || die "can't open /etc/asterisk/BUILDiax-vicidial.conf: $!\n";
open(sip, ">/etc/asterisk/BUILDsip-vicidial.conf") || die "can't open /etc/asterisk/BUILDsip-vicidial.conf: $!\n";
open(vm, ">/etc/asterisk/BUILDvoicemail-vicidial.conf") || die "can't open /etc/asterisk/BUILDvoicemail-vicidial.conf: $!\n";
open(moh, ">/etc/asterisk/BUILDmusiconhold-vicidial.conf") || die "can't open /etc/asterisk/BUILDmusiconhold-vicidial.conf: $!\n";
open(mm, ">/etc/asterisk/BUILDmeetme-vicidial.conf") || die "can't open /etc/asterisk/BUILDmeetme-vicidial.conf: $!\n";
print ext "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print ext "$ext\n";
@@ -1463,26 +1567,63 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
print ext "$Lext\n";
print ext "$Vext\n";
print ext "$Pext\n";
print ext "\n; END OF FILE\n";
print iax "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print iax "$iax\n";
print iax "$Liax\n";
print iax "$Piax\n";
print iax "\n; END OF FILE\n";
print sip "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print sip "$sip\n";
print sip "$Lsip\n";
print sip "$Psip\n";
print sip "\n; END OF FILE\n";
print vm "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
# print vm "[vicidial-auto]\n";
print vm "$vm\n";
print vm "\n; END OF FILE\n";
print moh "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print moh "$moh\n";
print moh "\n; END OF FILE\n";
print mm "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print mm "$mm\n";
print mm "\n; END OF FILE\n";
close(ext);
close(iax);
close(sip);
close(vm);
close(moh);
close(mm);
### find cmp binary
$cmpbin = '';
if ( -e ('/bin/cmp')) {$cmpbin = '/bin/cmp';}
else
{
if ( -e ('/usr/bin/cmp')) {$cmpbin = '/usr/bin/cmp';}
else
{
if ( -e ('/usr/local/bin/cmp')) {$cmpbin = '/usr/local/bin/cmp';}
else
{
print "Can't find cmp binary! Exiting...\n";
exit;
}
}
}
$extCMP = `$cmpbin /etc/asterisk/BUILDextensions-vicidial.conf /etc/asterisk/extensions-vicidial.conf`;
$iaxCMP = `$cmpbin /etc/asterisk/BUILDiax-vicidial.conf /etc/asterisk/iax-vicidial.conf`;
$sipCMP = `$cmpbin /etc/asterisk/BUILDsip-vicidial.conf /etc/asterisk/sip-vicidial.conf`;
$vmCMP = `$cmpbin /etc/asterisk/BUILDvoicemail-vicidial.conf /etc/asterisk/voicemail-vicidial.conf`;
$mohCMP = `$cmpbin /etc/asterisk/BUILDmusiconhold-vicidial.conf /etc/asterisk/musiconhold-vicidial.conf`;
$mmCMP = `$cmpbin /etc/asterisk/BUILDmeetme-vicidial.conf /etc/asterisk/meetme-vicidial.conf`;
sleep(1);
@@ -1490,27 +1631,90 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
if ($DB) {print "reloading asterisk\n";}
if ($asterisk_version =~ /^1.2/)
{
`screen -XS asterisk eval 'stuff "sip reload\015"'`;
sleep(1);
`screen -XS asterisk eval 'stuff "iax2 reload\015"'`;
sleep(1);
`screen -XS asterisk eval 'stuff "extensions reload\015"'`;
sleep(1);
`screen -XS asterisk eval 'stuff "reload app_voicemail.so\015"'`;
sleep(1);
if (length($extCMP) > 10)
{
`cp /etc/asterisk/BUILDextensions-vicidial.conf /etc/asterisk/extensions-vicidial.conf`;
`screen -XS asterisk eval 'stuff "extensions reload\015"'`;
sleep(1);
}
if (length($sipCMP) > 10)
{
`cp /etc/asterisk/BUILDsip-vicidial.conf /etc/asterisk/sip-vicidial.conf`;
`screen -XS asterisk eval 'stuff "sip reload\015"'`;
sleep(1);
}
if (length($iaxCMP) > 10)
{
`cp /etc/asterisk/BUILDiax-vicidial.conf /etc/asterisk/iax-vicidial.conf`;
`screen -XS asterisk eval 'stuff "iax2 reload\015"'`;
sleep(1);
}
if (length($vmCMP) > 10)
{
`cp /etc/asterisk/BUILDvoicemail-vicidial.conf /etc/asterisk/voicemail-vicidial.conf`;
`screen -XS asterisk eval 'stuff "reload app_voicemail.so\015"'`;
sleep(1);
}
if (length($mohCMP) > 10)
{
`cp /etc/asterisk/BUILDmusiconhold-vicidial.conf /etc/asterisk/musiconhold-vicidial.conf`;
`screen -XS asterisk eval 'stuff "moh reload\015"'`;
sleep(1);
}
if (length($mmCMP) > 10)
{
`cp /etc/asterisk/BUILDmeetme-vicidial.conf /etc/asterisk/meetme-vicidial.conf`;
`screen -XS asterisk eval 'stuff "reload app_meetme.so\015"'`;
sleep(1);
}
}
else
{
`screen -XS asterisk eval 'stuff "sip reload\015"'`;
sleep(1);
`screen -XS asterisk eval 'stuff "iax2 reload\015"'`;
sleep(1);
`screen -XS asterisk eval 'stuff "dialplan reload\015"'`;
sleep(1);
`screen -XS asterisk eval 'stuff "module reload app_voicemail.so\015"'`;
sleep(1);
if (length($extCMP) > 10)
{
`cp /etc/asterisk/BUILDextensions-vicidial.conf /etc/asterisk/extensions-vicidial.conf`;
`screen -XS asterisk eval 'stuff "dialplan reload\015"'`;
sleep(1);
}
if (length($sipCMP) > 10)
{
`cp /etc/asterisk/BUILDsip-vicidial.conf /etc/asterisk/sip-vicidial.conf`;
`screen -XS asterisk eval 'stuff "sip reload\015"'`;
sleep(1);
}
if (length($iaxCMP) > 10)
{
`cp /etc/asterisk/BUILDiax-vicidial.conf /etc/asterisk/iax-vicidial.conf`;
`screen -XS asterisk eval 'stuff "iax2 reload\015"'`;
sleep(1);
}
if (length($vmCMP) > 10)
{
`cp /etc/asterisk/BUILDvoicemail-vicidial.conf /etc/asterisk/voicemail-vicidial.conf`;
`screen -XS asterisk eval 'stuff "module reload app_voicemail.so\015"'`;
sleep(1);
}
if (length($mohCMP) > 10)
{
`cp /etc/asterisk/BUILDmusiconhold-vicidial.conf /etc/asterisk/musiconhold-vicidial.conf`;
`screen -XS asterisk eval 'stuff "moh reload\015"'`;
sleep(1);
}
if (length($mmCMP) > 10)
{
`cp /etc/asterisk/BUILDmeetme-vicidial.conf /etc/asterisk/meetme-vicidial.conf`;
`screen -XS asterisk eval 'stuff "module reload app_meetme.so\015"'`;
sleep(1);
}
}
`rm -f /etc/asterisk/BUILDextensions-vicidial.conf`;
`rm -f /etc/asterisk/BUILDiax-vicidial.conf`;
`rm -f /etc/asterisk/BUILDsip-vicidial.conf`;
`rm -f /etc/asterisk/BUILDvoicemail-vicidial.conf`;
`rm -f /etc/asterisk/BUILDmusiconhold-vicidial.conf`;
`rm -f /etc/asterisk/BUILDmeetme-vicidial.conf`;
}
################################################################################
##### END Creation of auto-generated conf files
+44 -5
View File
@@ -24,7 +24,8 @@
# 90731-0555 - Added call time scheme restriction
# 90807-1632 - Fixed call time bug and call length bug
# 90825-1249 - Added without-camp and without-in options
#
# 90902-0437 - Added outbound-calltime-ignore and ftp-norun options
#
$txt = '.txt';
$US = '_';
@@ -44,7 +45,7 @@ $VARREPORT_dir = 'REPORTS';
$campaign = 'TESTCAMP';
$sale_statuses = 'SALE-UPSELL';
$output_format = 'pipe-standard';
$outbound_calltime_ignore=0;
$secX = time();
$time = $secX;
@@ -104,8 +105,10 @@ if (length($ARGV[0])>1)
print " [--with-inbound=XXX-XXY] = include the following inbound groups\n";
print " [--without-in=XXX-XXY] = inbound groups that will be excluded from ALL\n";
print " [--calltime=XXX] = filter results to only include those calls during this call time\n";
print " [--outbound-calltime-ignore] = for outbound calls ignores call time\n";
print " [--ftp-transfer] = Send results file by FTP to another server\n";
print " [--ftp-audio-transfer] = Send associated audio files to FTP server, dated directories\n";
print " [--ftp-norun] = Stop program when you get to the FTP transfer\n";
print " [--with-transfer-audio] = Different method for finding audio, also grabs transfer audio filenames\n";
print " [--with-did-lookup] = Looks up the DID pattern and name the call came in on if possible\n";
print " [--email-list=test@test.com:test2@test.com] = send email results to these addresses\n";
@@ -243,6 +246,12 @@ if (length($ARGV[0])>1)
$call_time = $data_in[1];
$call_time =~ s/ .*$//gi;
}
if ($args =~ /--outbound-calltime-ignore/i)
{
$outbound_calltime_ignore=1;
if (!$Q)
{print "\n----- IGNORE CALLTIME FOR OUTBOUND -----\n\n";}
}
if ($args =~ /-ftp-transfer/i)
{
if (!$Q)
@@ -293,6 +302,12 @@ if (length($ARGV[0])>1)
## remove old audio files from directory
`$findbin $tempdir/ -maxdepth 1 -type f -mtime +0 -print | xargs rm -f`;
}
if ($args =~ /-ftp-norun/i)
{
if (!$Q)
{print "\n----- FTP NORUN MODE -----\n\n";}
$ftp_norun=1;
}
if ($args =~ /-with-transfer-audio/i)
{
if (!$Q)
@@ -521,7 +536,10 @@ else
########### CURRENT DAY SALES GATHERING outbound-only: vicidial_log ######
###########################################################################
$stmtA = "select vicidial_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,vicidial_list.email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_log.list_id,title,address3,last_local_call_time,uniqueid,length_in_sec,vicidial_list.list_id,vicidial_list.list_id,UNIX_TIMESTAMP(vicidial_log.call_date),vicidial_campaigns.campaign_name,vicidial_campaigns.campaign_cid from vicidial_list,vicidial_log,vicidial_users,vicidial_campaigns where $campaignSQL $sale_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_log.user and vicidial_log.campaign_id=vicidial_campaigns.campaign_id order by call_date;";
#$stmtA = "select vicidial_users.user,first_name,last_name,address1,address2,city,state,postal_code,phone_number,email,security_phrase,comments,last_local_call_time,lead_id,vicidial_users.full_name,status,vendor_lead_code,source_id,list_id,title,address3,last_local_call_time from vicidial_list,vicidial_users where list_id NOT IN('999','998') $sale_statusesSQL and called_count > 0 and vicidial_users.user=vicidial_list.user;";
if ($output_format =~ /^tab-QMcustomUSA$/)
{
$stmtA = "select vicidial_log.user,8,8,8,8,8,8,8,vicidial_log.phone_number,8,8,8,call_date,vicidial_log.lead_id,vicidial_users.full_name,vicidial_log.status,8,8,vicidial_log.list_id,8,8,call_date,uniqueid,length_in_sec,vicidial_log.list_id,vicidial_log.list_id,UNIX_TIMESTAMP(vicidial_log.call_date),vicidial_campaigns.campaign_name,vicidial_campaigns.campaign_cid from vicidial_log,vicidial_users,vicidial_campaigns where $campaignSQL $sale_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_users.user=vicidial_log.user and vicidial_log.campaign_id=vicidial_campaigns.campaign_id order by call_date;";
}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -578,6 +596,10 @@ if (length($with_inboundSQL)>3)
########### CURRENT DAY SALES GATHERING inbound-only: vicidial_closer_log ######
###########################################################################
$stmtA = "select vicidial_closer_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,vicidial_list.email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_closer_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_closer_log.list_id,campaign_id,title,address3,last_local_call_time,xfercallid,closecallid,uniqueid,length_in_sec,queue_seconds,vicidial_list.list_id,vicidial_list.list_id,UNIX_TIMESTAMP(vicidial_closer_log.call_date),agent_alert_delay from vicidial_list,vicidial_closer_log,vicidial_users,vicidial_inbound_groups where $with_inboundSQL $close_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_closer_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_closer_log.user and vicidial_inbound_groups.group_id=vicidial_closer_log.campaign_id order by call_date;";
if ($output_format =~ /^tab-QMcustomUSA$/)
{
$stmtA = "select vicidial_closer_log.user,8,8,8,8,8,8,8,vicidial_closer_log.phone_number,8,8,8,call_date,vicidial_closer_log.lead_id,vicidial_users.full_name,vicidial_closer_log.status,8,8,vicidial_closer_log.list_id,campaign_id,8,8,call_date,xfercallid,closecallid,uniqueid,length_in_sec,queue_seconds,vicidial_closer_log.list_id,vicidial_closer_log.list_id,UNIX_TIMESTAMP(vicidial_closer_log.call_date),agent_alert_delay from vicidial_closer_log,vicidial_users,vicidial_inbound_groups where $with_inboundSQL $close_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_users.user=vicidial_closer_log.user and vicidial_inbound_groups.group_id=vicidial_closer_log.campaign_id order by call_date;";
}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -700,6 +722,7 @@ if ( (length($Ealert)>5) && (length($email_list) > 3) )
# $VARREPORT_user = 'cron';
# $VARREPORT_pass = 'test';
# $VARREPORT_dir = '';
$NODATEDIR = 0; # Don't use dated directories for audio
$YEARDIR = 1; # put dated directories in a year directory first
@@ -715,13 +738,26 @@ if ($ftp_transfer > 0)
$ftp->quit;
}
if ( ($DB) && ($output_format =~ /^tab-QMcustomUSA$/) )
{
$OUTtalkmin = ($OUTtalk / 60);
$INtalkmin = ($INtalk / 60);
print "OUTBOUND CALLS: $OUTcalls\n";
print "OUTBOUND TIME: $OUTtalk $OUTtalkmin\n";
print "INBOUND CALLS: $INcalls\n";
print "INBOUND TIME: $INtalk $INtalkmin\n";
}
if ($ftp_audio_transfer > 0)
{
use Net::FTP;
opendir(FILE, "$tempdir/");
@FILES = readdir(FILE);
if (!$Q) {print "Sending Audio Over FTP: $$#FILES\n";}
if (!$Q) {print "Sending Audio Over FTP: $#FILES\n";}
if ($ftp_norun > 0)
{exit;}
$i=0;
foreach(@FILES)
@@ -806,7 +842,7 @@ sub select_format_loop
}
}
if ($within_calltime > 0)
if ( ($within_calltime > 0) || ( ($outbound_calltime_ignore > 0) && ($outbound =~ /Y/) ) )
{
$str='';
if ($T)
@@ -1144,6 +1180,9 @@ sub select_format_loop
$uniqueidLIST .= "$uniqueid|";
if ($DBX > 0) {print "UNIQUE: -----$uniqueidLIST-----$uniqueid";}
if ($outbound =~ /Y/) {$OUTtalk = ($OUTtalk + $talk_seconds); $OUTcalls++;}
else {$INtalk = ($INtalk + $talk_seconds); $INcalls++;}
}
}
@@ -2,313 +2,4 @@
conf => 8600
conf => 8601,1234
conf => 8600001
conf => 8600002
conf => 8600003
conf => 8600004
conf => 8600005
conf => 8600006
conf => 8600007
conf => 8600008
conf => 8600009
conf => 8600010
conf => 8600011
conf => 8600012
conf => 8600013
conf => 8600014
conf => 8600015
conf => 8600016
conf => 8600017
conf => 8600018
conf => 8600019
conf => 8600020
conf => 8600021
conf => 8600022
conf => 8600023
conf => 8600024
conf => 8600025
conf => 8600026
conf => 8600027
conf => 8600028
conf => 8600029
conf => 8600030
conf => 8600031
conf => 8600032
conf => 8600033
conf => 8600034
conf => 8600035
conf => 8600036
conf => 8600037
conf => 8600038
conf => 8600039
conf => 8600040
conf => 8600041
conf => 8600042
conf => 8600043
conf => 8600044
conf => 8600045
conf => 8600046
conf => 8600047
conf => 8600048
conf => 8600049
conf => 8600050
conf => 8600051
conf => 8600052
conf => 8600053
conf => 8600054
conf => 8600055
conf => 8600056
conf => 8600057
conf => 8600058
conf => 8600059
conf => 8600060
conf => 8600061
conf => 8600062
conf => 8600063
conf => 8600064
conf => 8600065
conf => 8600066
conf => 8600067
conf => 8600068
conf => 8600069
conf => 8600070
conf => 8600071
conf => 8600072
conf => 8600073
conf => 8600074
conf => 8600075
conf => 8600076
conf => 8600077
conf => 8600078
conf => 8600079
conf => 8600080
conf => 8600081
conf => 8600082
conf => 8600083
conf => 8600084
conf => 8600085
conf => 8600086
conf => 8600087
conf => 8600088
conf => 8600089
conf => 8600090
conf => 8600091
conf => 8600092
conf => 8600093
conf => 8600094
conf => 8600095
conf => 8600096
conf => 8600097
conf => 8600098
conf => 8600099
conf => 8600100
conf => 8600101
conf => 8600102
conf => 8600103
conf => 8600104
conf => 8600105
conf => 8600106
conf => 8600107
conf => 8600108
conf => 8600109
conf => 8600110
conf => 8600111
conf => 8600112
conf => 8600113
conf => 8600114
conf => 8600115
conf => 8600116
conf => 8600117
conf => 8600118
conf => 8600119
conf => 8600120
conf => 8600121
conf => 8600122
conf => 8600123
conf => 8600124
conf => 8600125
conf => 8600126
conf => 8600127
conf => 8600128
conf => 8600129
conf => 8600130
conf => 8600131
conf => 8600132
conf => 8600133
conf => 8600134
conf => 8600135
conf => 8600136
conf => 8600137
conf => 8600138
conf => 8600139
conf => 8600140
conf => 8600141
conf => 8600142
conf => 8600143
conf => 8600144
conf => 8600145
conf => 8600146
conf => 8600147
conf => 8600148
conf => 8600149
conf => 8600150
conf => 8600151
conf => 8600152
conf => 8600153
conf => 8600154
conf => 8600155
conf => 8600156
conf => 8600157
conf => 8600158
conf => 8600159
conf => 8600160
conf => 8600161
conf => 8600162
conf => 8600163
conf => 8600164
conf => 8600165
conf => 8600166
conf => 8600167
conf => 8600168
conf => 8600169
conf => 8600170
conf => 8600171
conf => 8600172
conf => 8600173
conf => 8600174
conf => 8600175
conf => 8600176
conf => 8600177
conf => 8600178
conf => 8600179
conf => 8600180
conf => 8600181
conf => 8600182
conf => 8600183
conf => 8600184
conf => 8600185
conf => 8600186
conf => 8600187
conf => 8600188
conf => 8600189
conf => 8600190
conf => 8600191
conf => 8600192
conf => 8600193
conf => 8600194
conf => 8600195
conf => 8600196
conf => 8600197
conf => 8600198
conf => 8600199
conf => 8600200
conf => 8600201
conf => 8600202
conf => 8600203
conf => 8600204
conf => 8600205
conf => 8600206
conf => 8600207
conf => 8600208
conf => 8600209
conf => 8600210
conf => 8600211
conf => 8600212
conf => 8600213
conf => 8600214
conf => 8600215
conf => 8600216
conf => 8600217
conf => 8600218
conf => 8600219
conf => 8600220
conf => 8600221
conf => 8600222
conf => 8600223
conf => 8600224
conf => 8600225
conf => 8600226
conf => 8600227
conf => 8600228
conf => 8600229
conf => 8600230
conf => 8600231
conf => 8600232
conf => 8600233
conf => 8600234
conf => 8600235
conf => 8600236
conf => 8600237
conf => 8600238
conf => 8600239
conf => 8600240
conf => 8600241
conf => 8600242
conf => 8600243
conf => 8600244
conf => 8600245
conf => 8600246
conf => 8600247
conf => 8600248
conf => 8600249
conf => 8600250
conf => 8600251
conf => 8600252
conf => 8600253
conf => 8600254
conf => 8600255
conf => 8600256
conf => 8600257
conf => 8600258
conf => 8600259
conf => 8600260
conf => 8600261
conf => 8600262
conf => 8600263
conf => 8600264
conf => 8600265
conf => 8600266
conf => 8600267
conf => 8600268
conf => 8600269
conf => 8600270
conf => 8600271
conf => 8600272
conf => 8600273
conf => 8600274
conf => 8600275
conf => 8600276
conf => 8600277
conf => 8600278
conf => 8600279
conf => 8600280
conf => 8600281
conf => 8600282
conf => 8600283
conf => 8600284
conf => 8600285
conf => 8600286
conf => 8600287
conf => 8600288
conf => 8600289
conf => 8600290
conf => 8600291
conf => 8600292
conf => 8600293
conf => 8600294
conf => 8600295
conf => 8600296
conf => 8600297
conf => 8600298
conf => 8600299
conf => 8600900
conf => 8600901
conf => 8600902
conf => 8600903
conf => 8600904
conf => 8600905
conf => 8600906
conf => 8600907
conf => 8600908
conf => 8600909
#include meetme-vicidial.conf
@@ -2,14 +2,16 @@
; Music on Hold -- Sample Configuration
;
[default]
[old-default]
mode=files
directory=/var/lib/asterisk/mohmp3
[quiet]
[old-quiet]
mode=files
directory=/var/lib/asterisk/quiet-mp3
#include musiconhold-vicidial.conf
; valid mode options:
; quietmp3 -- default
; mp3 -- loud
+27
View File
@@ -493,3 +493,30 @@ UPDATE system_settings SET db_schema_version='1168';
ALTER TABLE vicidial_lists ADD agent_script_override VARCHAR(10) default '';
UPDATE system_settings SET db_schema_version='1169';
CREATE TABLE vicidial_music_on_hold (
moh_id VARCHAR(100) PRIMARY KEY NOT NULL,
moh_name VARCHAR(255),
active ENUM('Y','N') default 'N',
random ENUM('Y','N') default 'N',
remove ENUM('Y','N') default 'N'
);
CREATE TABLE vicidial_music_on_hold_files (
filename VARCHAR(255) NOT NULL,
moh_id VARCHAR(100) NOT NULL,
rank SMALLINT(5),
unique index mohfile (filename, moh_id)
);
INSERT INTO vicidial_music_on_hold SET moh_id='default',moh_name='Default Music On Hold',active='Y',random='N';
INSERT INTO vicidial_music_on_hold_files SET moh_id='default',filename='conf',rank='1';
ALTER TABLE servers ADD rebuild_music_on_hold ENUM('Y','N') default 'Y';
ALTER TABLE servers ADD active_agent_login_server ENUM('Y','N') default 'Y';
UPDATE system_settings SET db_schema_version='1170';
@@ -261,6 +261,40 @@ Inbound Summary Hourly Report||
orders by the amount of time agent has been actively waiting for a call||
Agent Script Override||
If this field is set, this will be the script that the agent sees on their screen instead of the campaign script when the lead is from this list. Default is not set||
Music On Hold||
ADD NEW MUSIC ON HOLD ENTRY||
ADDING NEW MUSIC ON HOLD ENTRY||
MODIFY MUSIC ON HOLD ENTRY||
DELETE MUSIC ON HOLD ENTRY||
MUSIC ON HOLD ENTRY LIST||
We STRONGLY recommend uploading only 16bit 8k PCM WAV audio files||
Music On Hold ID||
This is the short name of a Music On Hold entry. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 100 characters, minimum of 2 characters||
Music On Hold Name||
This is a more descriptive name of the Music On Hold entry. This is a short summary of the Music On Hold context and will show as a comment in the musiconhold-vicidial.conf file. max 255 characters, minimum of 2 characters||
This option allows you to set the Music On Hold entry to active or inactive. Inactive will remove the entry from the conf files||
Random Order||
This option allows you to define the playback of the audio files in a random order. If set to N then the defined order will be used||
To add a new audio file to a Music On Hold entry the file must first be in the audio store, then you can select the file and click submit to add it to the file list. Music on hold is updated once per minute if there have been changes made. Any files not listed in a music on hold entry that are present in the music on hold folder will be deleted||
MUSIC ON HOLD ENTRY NOT ADDED||
there is already a moh entry in the system with this ID||
MUSIC ON HOLD ENTRY ADDED||
Click here to see Admin chages to this Music On Hold entry||
Audio Files||
Add An Audio File||
Rank: ||
MUSIC ON HOLD ENTRY NOT MODIFIED||
MUSIC ON HOLD ENTRY MODIFIED||
Add A New MOH Entry||
Show MOH Entries||
Active Agent Server||
Setting this option to N will prevent agents from being able to login to this server through the vicidial agent screen. This is very useful when using a phone login load balanced setup. Default is Y||
Rebuild Music On Hold||
If you want to force a rebuilding of the music on hold files or if the music on hold entries or server entries have changed then this should be set to Y. After the music on hold files have been synchronized and reloaded then this will be changed to N. Default is Y||
MUSIC ON HOLD ENTRY NOT DELETED||
MUSIC ON HOLD ENTRY DELETION CONFIRMATION||
Click here to delete music on hold entry||
MUSIC ON HOLD DELETION COMPLETED||
add-file: user_territories.php
+6 -4
View File
@@ -249,10 +249,11 @@
# 90814-0829 - Moved mute button next to hotkeys button
# 90827-0133 - Reworked Script display code
# 90827-1549 - Added list script override option, original_phone_login variable
# 90831-1456 - Added active_agent_login_server option for servers
#
$version = '2.2.0-226';
$build = '90827-1549';
$version = '2.2.0-227';
$build = '90831-1456';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=61;
$one_mysql_log=0;
@@ -1449,7 +1450,8 @@ if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) )
else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";}
$authphone=0;
$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';";
#$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';";
$stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01020',$VD_login,$server_ip,$session_name,$one_mysql_log);}
@@ -1515,7 +1517,7 @@ else
$row=mysql_fetch_row($rslt);
### find out whether the server is set to active
$stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y';";
$stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y' and active_agent_login_server='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
@@ -16,6 +16,8 @@ $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_GET["print_calls"])) {$print_calls=$_GET["print_calls"];}
elseif (isset($_POST["print_calls"])) {$print_calls=$_POST["print_calls"];}
if (isset($_GET["exclude_rollover"])) {$exclude_rollover=$_GET["exclude_rollover"];}
elseif (isset($_POST["exclude_rollover"])) {$exclude_rollover=$_POST["exclude_rollover"];}
if (isset($_GET["inbound_rate"])) {$inbound_rate=$_GET["inbound_rate"];}
@@ -206,6 +208,7 @@ if ($bareformat < 1)
echo "<INPUT TYPE=HIDDEN NAME=inbound_rate VALUE=\"$inbound_rate\">\n";
echo "<INPUT TYPE=HIDDEN NAME=outbound_rate VALUE=\"$outbound_rate\">\n";
echo "<INPUT TYPE=HIDDEN NAME=costformat VALUE=\"$costformat\">\n";
echo "<INPUT TYPE=HIDDEN NAME=print_calls VALUE=\"$print_calls\">\n";
echo "Date Range:<BR>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo " to <INPUT TYPE=TEXT NAME=end_date SIZE=10 MAXLENGTH=10 VALUE=\"$end_date\">\n";
@@ -383,7 +386,7 @@ else
$hTOTmax_queue_seconds = 0;
$hTOTdrop_count = 0;
$stmt = "SELECT status,length_in_sec,queue_seconds,call_date,UNIX_TIMESTAMP(call_date) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';";
$stmt = "SELECT status,length_in_sec,queue_seconds,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$calls_to_parse = mysql_num_rows($rslt);
@@ -441,6 +444,12 @@ else
else
{$Hanswer_count[$Chour]++;}
$Hcalltime[$Chour]++;
if ($print_calls > 0)
{
echo "$row[5]\t$row[6]\t$TEMPtalk\n";
$PCtemptalk = ($PCtemptalk + $TEMPtalk);
}
$q++;
}
else
@@ -458,6 +467,12 @@ else
else
{$queue_avg[$i] = 0;}
if ($print_calls > 0)
{
$PCtemptalkmin = ($PCtemptalk / 60);
echo "$q\t$PCtemptalk\t$PCtemptalkmin\n";
}
$TOTcalls_count = ($TOTcalls_count + $calls_count[$i]);
$TOTanswer_count = ($TOTanswer_count + $answer_count[$i]);
$TOTtalk_sec = ($TOTtalk_sec + $talk_sec[$i]);
+114 -26
View File
@@ -32,6 +32,8 @@ require("functions.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_GET["print_calls"])) {$print_calls=$_GET["print_calls"];}
elseif (isset($_POST["print_calls"])) {$print_calls=$_POST["print_calls"];}
if (isset($_GET["outbound_rate"])) {$outbound_rate=$_GET["outbound_rate"];}
elseif (isset($_POST["outbound_rate"])) {$outbound_rate=$_POST["outbound_rate"];}
if (isset($_GET["costformat"])) {$costformat=$_GET["costformat"];}
@@ -243,6 +245,7 @@ echo "<INPUT TYPE=HIDDEN NAME=agent_hours VALUE=\"$agent_hours\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=outbound_rate VALUE=\"$outbound_rate\">\n";
echo "<INPUT TYPE=HIDDEN NAME=costformat VALUE=\"$costformat\">\n";
echo "<INPUT TYPE=HIDDEN NAME=print_calls VALUE=\"$print_calls\">\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<BR> to <BR><INPUT TYPE=TEXT NAME=end_date SIZE=10 MAXLENGTH=10 VALUE=\"$end_date\">\n";
echo "</TD><TD VALIGN=TOP> Campaigns:<BR>";
@@ -356,16 +359,32 @@ else
$inTOTALcallsRAW=0;
if (eregi("YES",$include_rollover))
{
$stmt="select count(*),sum(length_in_sec),sum(queue_seconds),sum(agent_alert_delay) from vicidial_closer_log,vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id $group_drop_SQLand;";
$length_in_secZ=0;
$queue_secondsZ=0;
$agent_alert_delayZ=0;
$stmt="select length_in_sec,queue_seconds,agent_alert_delay from vicidial_closer_log,vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id $group_drop_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$row=mysql_fetch_row($rslt);
if ($DB) {echo "$stmt\n";}
$INallcalls_to_printZ = mysql_num_rows($rslt);
$y=0;
while ($y < $INallcalls_to_printZ)
{
$row=mysql_fetch_row($rslt);
$inTOTALcallsRAW = $row[0];
$TOTALdelay = round($row[3] / 1000);
$inTOTALsec = (($row[1] - $row[2]) - $TOTALdelay);
if ($inTOTALsec < 0)
{$inTOTALsec = 0;}
$length_in_secZ = $row[0];
$queue_secondsZ = $row[1];
$agent_alert_delayZ = $row[2];
$TOTALdelay = round($agent_alert_delayZ / 1000);
$thiscallsec = (($length_in_secZ - $queue_secondsZ) - $TOTALdelay);
if ($thiscallsec < 0)
{$thiscallsec = 0;}
$inTOTALsec = ($inTOTALsec + $thiscallsec);
$y++;
}
$inTOTALcallsRAW = $y;
$TOTALsec = ($TOTALsec + $inTOTALsec);
$inTOTALcalls = sprintf("%10s", $inTOTALcallsRAW);
}
@@ -398,16 +417,32 @@ else
if (eregi("YES",$include_rollover))
{
$stmt="select count(*),sum(length_in_sec),sum(queue_seconds),sum(agent_alert_delay) from vicidial_closer_log vcl,vicidial_inbound_groups vig where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id and vcl.status IN($customer_interactive_statuses) $group_drop_SQLand;";
$length_in_secZ=0;
$queue_secondsZ=0;
$agent_alert_delayZ=0;
$stmt="select length_in_sec,queue_seconds,agent_alert_delay from vicidial_closer_log,vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id and vicidial_closer_log.status IN($customer_interactive_statuses) $group_drop_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$row=mysql_fetch_row($rslt);
if ($DB) {echo "$stmt\n";}
$INallcalls_to_printZ = mysql_num_rows($rslt);
$y=0;
while ($y < $INallcalls_to_printZ)
{
$row=mysql_fetch_row($rslt);
$inCIcallsRAW = $row[0];
$CIdelay = round($row[3] / 1000);
$inCIsec = (($row[1] - $row[2]) - $CIdelay);
if ($inCIsec < 0)
{$inCIsec = 0;}
$length_in_secZ = $row[0];
$queue_secondsZ = $row[1];
$agent_alert_delayZ = $row[2];
$CIdelay = round($agent_alert_delayZ / 1000);
$thiscallsec = (($length_in_secZ - $queue_secondsZ) - $CIdelay);
if ($thiscallsec < 0)
{$thiscallsec = 0;}
$inCIsec = ($inCIsec + $thiscallsec);
$y++;
}
$inCIcallsRAW = $y;
$CIsec = ($CIsec + $inCIsec);
$CIcallsRAW = ($CIcallsRAW + $inCIcallsRAW);
}
@@ -1005,16 +1040,32 @@ else
}
if (eregi("YES",$include_rollover))
{
$stmt="select count(*),sum(length_in_sec),sum(queue_seconds),sum(agent_alert_delay) from vicidial_closer_log vcl,vicidial_inbound_groups vig where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id and vcl.user='$RAWuser[$i]' $group_drop_SQLand;";
$length_in_secZ=0;
$queue_secondsZ=0;
$agent_alert_delayZ=0;
$stmt="select length_in_sec,queue_seconds,agent_alert_delay from vicidial_closer_log,vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id and vcl.user='$RAWuser[$i]' $group_drop_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$row=mysql_fetch_row($rslt);
if ($DB) {echo "$stmt\n";}
$INallcalls_to_printZ = mysql_num_rows($rslt);
$y=0;
while ($y < $INallcalls_to_printZ)
{
$row=mysql_fetch_row($rslt);
$inCIcallsRAW = $row[0];
$CIdelay = round($row[3] / 1000);
$inCIsec = (($row[1] - $row[2]) - $CIdelay);
if ($inCIsec < 0)
{$inCIsec = 0;}
$length_in_secZ = $row[0];
$queue_secondsZ = $row[1];
$agent_alert_delayZ = $row[2];
$CIdelay = round($agent_alert_delayZ / 1000);
$thiscallsec = (($length_in_secZ - $queue_secondsZ) - $CIdelay);
if ($thiscallsec < 0)
{$thiscallsec = 0;}
$inCIsec = ($inCIsec + $thiscallsec);
$y++;
}
$inCIcallsRAW = $y;
$RAWuser_talk[$i] = ($RAWuser_talk[$i] + $inCIsec);
$RAWuser_calls[$i] = ($RAWuser_calls[$i] + $inCIcallsRAW);
@@ -1072,12 +1123,49 @@ else
if ($costformat > 0)
{
$stmt="select campaign_id,phone_number,length_in_sec from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' $group_SQLand and vicidial_log.user=vicidial_users.user;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$allcalls_to_print = mysql_num_rows($rslt);
$w=0;
while ($w < $allcalls_to_print)
{
$row=mysql_fetch_row($rslt);
if ($print_calls > 0)
{echo "$row[0]\t$row[1]\t$row[2]\n";}
$tempTALK = ($tempTALK + $row[2]);
$w++;
}
if (eregi("YES",$include_rollover))
{
$stmt="select campaign_id,phone_number,length_in_sec,queue_seconds,agent_alert_delay from vicidial_closer_log,vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id $group_drop_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$INallcalls_to_print = mysql_num_rows($rslt);
$w=0;
while ($w < $INallcalls_to_print)
{
$row=mysql_fetch_row($rslt);
if ($print_calls > 0)
{ echo "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\n";}
$newTALK = ($row[2] - $row[3] - ($row[4] / 1000) );
if ($newTALK < 0) {$newTALK = 0;}
$tempTALK = ($tempTALK + $newTALK);
$w++;
}
}
$tempTALKmin = ($tempTALK / 60);
if ($print_calls > 0)
{echo "$w\t$tempTALK\t$tempTALKmin\n";}
echo "</PRE>\n<B>";
$rawTOTtalk_min = round($rawTOTtime / 60);
$rawTOTtalk_min = round($tempTALK / 60);
$outbound_cost = ($rawTOTtalk_min * $outbound_rate);
$outbound_cost = sprintf("%8.2f", $outbound_cost);
echo "OUTBOUND $query_date to $end_date, &nbsp; $rawTOTtalk_min minutes at \$$outbound_rate = \$$outbound_cost\n";
echo "OUTBOUND $query_date to $end_date, &nbsp; $rawTOTtalk_min minutes at \$$outbound_rate = \$$outbound_cost</B>\n";
exit;
}
File diff suppressed because it is too large Load Diff
+23 -13
View File
@@ -14,6 +14,7 @@
# 90635-0943 - Added javascript for dynamic menus in In-Groups
# 90627-0548 - Added no-agent-no-queue options
# 90628-1016 - Added Text-to-speech options
# 90830-2213 - Added Music On Hold options
#
@@ -1089,27 +1090,29 @@ $SSenable_tts_integration = $row[1];
<?php
if (strlen($admin_hh) > 1)
{
if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # pink
if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";}
else {$times_sh=''; $times_fc='BLACK';}
if ($sh=='shifts') {$shifts_sh="bgcolor=\"$shifts_color\""; $shifts_fc="$shifts_font";} # pink
if ($sh=='shifts') {$shifts_sh="bgcolor=\"$shifts_color\""; $shifts_fc="$shifts_font";}
else {$shifts_sh=''; $shifts_fc='BLACK';}
if ($sh=='templates') {$templates_sh="bgcolor=\"$templates_color\""; $templates_fc="$templates_font";} # pink
if ($sh=='templates') {$templates_sh="bgcolor=\"$templates_color\""; $templates_fc="$templates_font";}
else {$templates_sh=''; $templates_fc='BLACK';}
if ($sh=='carriers') {$carriers_sh="bgcolor=\"$carriers_color\""; $carriers_fc="$carriers_font";} # pink
if ($sh=='carriers') {$carriers_sh="bgcolor=\"$carriers_color\""; $carriers_fc="$carriers_font";}
else {$carriers_sh=''; $carriers_fc='BLACK';}
if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink
if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";}
else {$phones_sh=''; $phones_fc='BLACK';}
if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink
if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";}
else {$server_sh=''; $server_fc='BLACK';}
if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink
if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";}
else {$conference_sh=''; $conference_fc='BLACK';}
if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink
if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";}
else {$settings_sh=''; $settings_fc='BLACK';}
if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink
if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";}
else {$status_sh=''; $status_fc='BLACK';}
if ($sh=='audio') {$audio_sh="bgcolor=\"$audio_color\""; $audio_fc="$audio_font";} # pink
if ($sh=='audio') {$audio_sh="bgcolor=\"$audio_color\""; $audio_fc="$audio_font";}
else {$audio_sh=''; $audio_fc='BLACK';}
if ($sh=='tts') {$tts_sh="bgcolor=\"$tts_color\""; $tts_fc="$tts_font";} # pink
if ($sh=='moh') {$moh_sh="bgcolor=\"$moh_color\""; $moh_fc="$moh_font";}
else {$moh_sh=''; $moh_fc='BLACK';}
if ($sh=='tts') {$tts_sh="bgcolor=\"$tts_color\""; $tts_fc="$tts_font";}
else {$tts_sh=''; $tts_fc='BLACK';}
?>
@@ -1137,14 +1140,17 @@ $SSenable_tts_integration = $row[1];
{ ?>
<TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $audio_sh ?>> &nbsp;
<a href="audio_store.php"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $audio_fc ?> SIZE=<?php echo $header_font_size ?>> Audio Store </a></TD>
</TR>
</TR>
<TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $moh_sh ?>> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=160000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $moh_fc ?> SIZE=<?php echo $header_font_size ?>> Music On Hold </a></TD>
</TR>
<?php }
if ($SSenable_tts_integration > 0)
{ ?>
<TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $tts_sh ?>> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=150000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $tts_fc ?> SIZE=<?php echo $header_font_size ?>> Text To Speech </a></TD>
</TR>
</TR>
<?php }
}
@@ -1212,6 +1218,10 @@ $SSenable_tts_integration = $row[1];
?>
<TR BGCOLOR=<?php echo $tts_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=150000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show TTS Entries </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=151111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add A New TTS Entry </a></TD></TR>
<?php }
if ( (strlen($moh_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $moh_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=160000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show MOH Entries </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=161111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add A New MOH Entry </a></TD></TR>
<?php }
if (strlen($settings_sh) > 1) {
?>
<TR BGCOLOR=<?php echo $settings_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=311111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> System Settings </a></TD></TR>
+3 -1
View File
@@ -300,6 +300,8 @@ if ($action == "MANUALUPLOAD")
<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>
<BR><BR>
<CENTER><a href="javascript:launch_chooser('sample_prompt','date',30);">audio file list</a></CENTER>
<CENTER><B>We STRONGLY recommend uploading only 16bit 8k PCM WAV audio files(.wav)
<BR><BR>
<a href="javascript:launch_chooser('sample_prompt','date',30);">audio file list</a></CENTER>
</TD></TR></TABLE>