From 830c8db6b0b8ef38d7ee57ae2853e520343906ba Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 13 Jan 2015 01:20:24 +0000 Subject: [PATCH] Added flag to delete voicemail greeting when changed from an audio file to empty git-svn-id: svn://192.168.202.10@2247 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 4 +-- bin/ADMIN_keepalive_ALL.pl | 57 ++++++++++++++++++++++++++++++++------ www/vicidial/admin.php | 29 ++++++++++++++----- 3 files changed, 72 insertions(+), 18 deletions(-) diff --git a/UPGRADE b/UPGRADE index 09371460..533f1d8d 100644 --- a/UPGRADE +++ b/UPGRADE @@ -63,7 +63,7 @@ OTHER CHANGES: there are no agents available in a specific in-group 4. Added option to DIDs to allow pre-filtering by a specific filter phone group - before the stardard filtering process. The call can be redirected to a + before the standard filtering process. The call can be redirected to a specific DID entry if there is a match. 5. Added Wrapup Bypass option to allow or disallow agents to skip the wrapup @@ -87,7 +87,7 @@ OTHER CHANGES: 12. Added campaign options to limit number of active callbacks 13. Changed all Agent and Administrative interface text output to use a function - instead of echo.(future dynamic other-language interfaces) + instead of echo.(for dynamic other-language interfaces) 14. Added Admin Utility to split lead lists into smaller lists diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 7884e5cd..9f466153 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -15,7 +15,7 @@ # - Auto reset lists at defined times # - Auto restarts Asterisk process if enabled in servers settings # -# Copyright (C) 2014 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # CHANGES # 61011-1348 - First build @@ -97,9 +97,10 @@ # 141113-1555 - Changed FILL process screen from ASTVDautoFILL to ASTVDadFILL for easier admin # 141125-1710 - Added gather_stats_flag for audio sync script launch on voicemail server # 141227-0957 - Changed to clear out old unavail voicemail greetings before copying custom greeting +# 150112-2018 - Added flag to delete voicemail greeting when changed from an audio file to empty # -$build = '141227-0957'; +$build = '150112-2018'; $DB=0; # Debug flag @@ -1512,8 +1513,16 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se while ($sthArows > $vmb_ct) { @aryA = $sthA->fetchrow_array; - $VG_voicemail_id = $aryA[0]; - $VG_voicemail_greeting = $aryA[1]; + $aVG_voicemail_id[$vmb_ct] = $aryA[0]; + $aVG_voicemail_greeting[$vmb_ct] = $aryA[1]; + $vmb_ct++; + } + + $vmb_ct=0; + while ($sthArows > $vmb_ct) + { + $VG_voicemail_id = $aVG_voicemail_id[$vmb_ct]; + $VG_voicemail_greeting = $aVG_voicemail_greeting[$vmb_ct]; $gsm='.gsm'; $wav='.wav'; @@ -1521,6 +1530,7 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se $vm_dir_created=0; $vm_greet_wav_exists=0; $vm_greet_gsm_exists=0; + $vm_delete_greeting=0; if ( !-e ("/var/spool/asterisk/voicemail/default/$VG_voicemail_id")) { `mkdir /var/spool/asterisk/voicemail/default/$VG_voicemail_id`; @@ -1535,8 +1545,12 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se { $vm_greet_gsm_exists++; } + if ($VG_voicemail_greeting =~ /---DELETE---/) + { + $vm_delete_greeting++; + } - if ( ($vm_dir_created < 1) && ( ($vm_greet_wav_exists > 0) || ($vm_greet_gsm_exists > 0) ) ) + if ( ($vm_dir_created < 1) && ( ($vm_greet_wav_exists > 0) || ($vm_greet_gsm_exists > 0) || ($vm_delete_greeting > 0) ) ) { `rm -f /var/spool/asterisk/voicemail/default/$VG_voicemail_id/unavail.wav`; `rm -f /var/spool/asterisk/voicemail/default/$VG_voicemail_id/unavail.WAV`; @@ -1554,6 +1568,12 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se `cp /var/lib/asterisk/sounds/$VG_voicemail_greeting$gsm /var/spool/asterisk/voicemail/default/$VG_voicemail_id/unavail$gsm`; $audio_file_copied++; } + if ($vm_delete_greeting > 0) + { + $stmtA="UPDATE phones SET voicemail_greeting='' where voicemail_greeting='---DELETE---' and voicemail_id='$VG_voicemail_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "resetting vm greeting file to empty: $VG_voicemail_id|$VG_voicemail_greeting|$affected_rows|$stmtA\n";} + } if ($audio_file_copied < 1) {if ($DB) {print "no voicemail greeting copied: $VG_voicemail_id|$VG_voicemail_greeting\n";}} @@ -1571,15 +1591,24 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se while ($sthArows > $vmb_ct) { @aryA = $sthA->fetchrow_array; - $VG_voicemail_id = $aryA[0]; - $VG_voicemail_greeting = $aryA[1]; - + $aVG_voicemail_id[$vmb_ct] = $aryA[0]; + $aVG_voicemail_greeting[$vmb_ct] = $aryA[1]; + $vmb_ct++; + } + + $vmb_ct=0; + while ($sthArows > $vmb_ct) + { + $VG_voicemail_id = $aVG_voicemail_id[$vmb_ct]; + $VG_voicemail_greeting = $aVG_voicemail_greeting[$vmb_ct]; + $gsm='.gsm'; $wav='.wav'; $audio_file_copied=0; $vm_dir_created=0; $vm_greet_wav_exists=0; $vm_greet_gsm_exists=0; + $vm_delete_greeting=0; if ( !-e ("/var/spool/asterisk/voicemail/default/$VG_voicemail_id")) { `mkdir /var/spool/asterisk/voicemail/default/$VG_voicemail_id`; @@ -1594,8 +1623,12 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se { $vm_greet_gsm_exists++; } + if ($VG_voicemail_greeting =~ /---DELETE---/) + { + $vm_delete_greeting++; + } - if ( ($vm_dir_created < 1) && ( ($vm_greet_wav_exists > 0) || ($vm_greet_gsm_exists > 0) ) ) + if ( ($vm_dir_created < 1) && ( ($vm_greet_wav_exists > 0) || ($vm_greet_gsm_exists > 0) || ($vm_delete_greeting > 0) ) ) { `rm -f /var/spool/asterisk/voicemail/default/$VG_voicemail_id/unavail.wav`; `rm -f /var/spool/asterisk/voicemail/default/$VG_voicemail_id/unavail.WAV`; @@ -1613,6 +1646,12 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se `cp /var/lib/asterisk/sounds/$VG_voicemail_greeting$gsm /var/spool/asterisk/voicemail/default/$VG_voicemail_id/unavail$gsm`; $audio_file_copied++; } + if ($vm_delete_greeting > 0) + { + $stmtA="UPDATE vicidial_voicemail SET voicemail_greeting='' where voicemail_greeting='---DELETE---' and voicemail_id='$VG_voicemail_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "resetting vm greeting file to empty: $VG_voicemail_id|$VG_voicemail_greeting|$affected_rows|$stmtA\n";} + } if ($audio_file_copied < 1) {if ($DB) {print "no voicemail greeting copied: $VG_voicemail_id|$VG_voicemail_greeting\n";}} diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index c20ae520..e5d06748 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1762,8 +1762,10 @@ if (isset($_GET["qualify_sql"])) {$qualify_sql=$_GET["qualify_sql"];} elseif (isset($_POST["qualify_sql"])) {$qualify_sql=$_POST["qualify_sql"];} if (isset($_GET["admin_list_counts"])) {$admin_list_counts=$_GET["admin_list_counts"];} elseif (isset($_POST["admin_list_counts"])) {$admin_list_counts=$_POST["admin_list_counts"];} -if (isset($_GET["voicemail_greeting"])) {$voicemail_greeting=$_GET["voicemail_greeting"];} +if (isset($_GET["voicemail_greeting"])) {$voicemail_greeting=$_GET["voicemail_greeting"];} elseif (isset($_POST["voicemail_greeting"])) {$voicemail_greeting=$_POST["voicemail_greeting"];} +if (isset($_GET["old_voicemail_greeting"])) {$old_voicemail_greeting=$_GET["old_voicemail_greeting"];} + elseif (isset($_POST["old_voicemail_greeting"])) {$old_voicemail_greeting=$_POST["old_voicemail_greeting"];} if (isset($_GET["allow_voicemail_greeting"])) {$allow_voicemail_greeting=$_GET["allow_voicemail_greeting"];} elseif (isset($_POST["allow_voicemail_greeting"])) {$allow_voicemail_greeting=$_POST["allow_voicemail_greeting"];} if (isset($_GET["pause_after_next_call"])) {$pause_after_next_call=$_GET["pause_after_next_call"];} @@ -2703,6 +2705,7 @@ if ($non_latin < 1) $survey_fourth_audio_file = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$survey_fourth_audio_file); $safe_harbor_audio_field = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$safe_harbor_audio_field); $voicemail_greeting = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$voicemail_greeting); + $old_voicemail_greeting = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$old_voicemail_greeting); ### ALPHA-NUMERIC and underscore and dash and slash and dot and comma $menu_prompt = preg_replace('/[^-\/\|\,\._0-9a-zA-Z]/','',$menu_prompt); @@ -3423,12 +3426,13 @@ else # 150101-1511 - Updated for 2015 # 150107-1938 - Added ignore_group_on_search user option # 150111-1543 - Added Lists local call time option(Issue #812) and a campaign option for manual_dial_search_filter +# 150112-2005 - Added flag to delete voicemail greeting when changed from an audio file to empty # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.10-467a'; -$build = '150111-1543'; +$admin_version = '2.10-468a'; +$build = '150112-2005'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -14155,6 +14159,9 @@ if ($ADD==41111111111) { echo "
"._QXZ("PHONE MODIFIED").": $extension\n"; + if ( ($voicemail_greeting == '') and (strlen($old_voicemail_greeting) > 0) ) + {$voicemail_greeting = '---DELETE---';} + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysqli_real_escape_string($link, $local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysqli_real_escape_string($link, $VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages', email='$email', template_id='$template_id', conf_override='$conf_override',phone_context='$phone_context',phone_ring_timeout='$phone_ring_timeout',conf_secret='$conf_secret', delete_vm_after_email='$delete_vm_after_email',is_webphone='$is_webphone',use_external_server_ip='$use_external_server_ip',codecs_list='$codecs_list',codecs_with_template='$codecs_with_template',webphone_dialpad='$webphone_dialpad',on_hook_agent='$on_hook_agent',webphone_auto_answer='$webphone_auto_answer',voicemail_timezone='$voicemail_timezone',voicemail_options='$voicemail_options',user_group='$user_group',voicemail_greeting='$voicemail_greeting',voicemail_dump_exten_no_inst='$voicemail_dump_exten_no_inst',voicemail_instructions='$voicemail_instructions' where extension='$old_extension' and server_ip='$old_server_ip';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -14613,6 +14620,8 @@ if ($ADD==471111111111) {echo "
"._QXZ("VOICEMAIL BOX NOT MODIFIED - Please go back and look at the data you entered")."\n";} else { + if ( ($voicemail_greeting == '') and (strlen($old_voicemail_greeting) > 0) ) + {$voicemail_greeting = '---DELETE---';} $stmt="UPDATE vicidial_voicemail set fullname='$fullname',active='$active',pass='$pass',email='$email',delete_vm_after_email='$delete_vm_after_email',voicemail_timezone='$voicemail_timezone',voicemail_options='$voicemail_options',user_group='$user_group',voicemail_greeting='$voicemail_greeting' where voicemail_id='$voicemail_id';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "|$stmt|";} @@ -28282,13 +28291,16 @@ if ($ADD==31111111111) $z++; } echo " $NWB#phones-voicemail_timezone$NWE\n"; - echo ""._QXZ("Voicemail Options").": $NWB#phones-voicemail_options$NWE\n"; + echo ""._QXZ("Voicemail Options").": $NWB#phones-voicemail_options$NWE\n"; if ($SSallow_voicemail_greeting > 0) { echo ""._QXZ("Voicemail Greeting").": "._QXZ("audio chooser")." $NWB#phones-voicemail_greeting$NWE\n"; } else - {echo ""; + echo ""; + } echo ""._QXZ("Voicemail Instructions").": $NWB#phones-voicemail_instructions$NWE\n"; @@ -29290,10 +29302,13 @@ if ($ADD==371111111111) echo ""._QXZ("Delete Voicemail After Email").": $NWB#voicemail-delete_vm_after_email$NWE\n"; if ($SSallow_voicemail_greeting > 0) { - echo ""._QXZ("Voicemail Greeting").": "._QXZ("audio chooser")." $NWB#voicemail-voicemail_greeting$NWE\n"; + echo ""._QXZ("Voicemail Greeting").": "._QXZ("audio chooser")." $NWB#voicemail-voicemail_greeting$NWE\n"; } else - {echo ""; + echo ""; + } echo ""._QXZ("Voicemail Zone").":