From a5fa22d34abb91735dcd10595a79d912e78ecc15 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 17 Jun 2009 14:41:27 +0000 Subject: [PATCH] Allow multiple prompts in call menu prompt fields separated by pipes Allow zero wait time for exten in call menus git-svn-id: svn://192.168.202.10@1156 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/ADMIN_keepalive_ALL.pl | 95 +++++++++++++++++-- extras/upgrade_2.2.0.sql | 9 ++ .../TO_BE_TRANSLATED_2.2.0.txt | 2 + www/vicidial/admin.php | 20 ++-- 4 files changed, 107 insertions(+), 19 deletions(-) diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 3e2aa281..ce1f91a2 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -1047,16 +1047,56 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $option_value[$j] = 't'; if ( (length($menu_timeout_prompt[$i])>0) && ($menu_timeout_prompt[$i] !~ /NONE/) ) { - $call_menu_line .= "exten => t,1,Playback($menu_timeout_prompt[$i])\n"; - $PRI++; + $menu_timeout_prompt_ext=''; + if ($menu_timeout_prompt[$i] =~ /\|/) + { + @menu_timeout_prompts_array = split(/\|/,$menu_timeout_prompt[$i]); + $w=0; + foreach(@menu_timeout_prompts_array) + { + if (length($menu_timeout_prompts_array[$w])>0) + { + $menu_timeout_prompt_ext .= "exten => t,$PRI,Playback($menu_timeout_prompts_array[$w])\n"; + $PRI++; + } + $w++; + } + } + else + { + $menu_timeout_prompt_ext .= "exten => t,1,Playback($menu_timeout_prompt[$i])\n"; + $PRI++; + } + + $call_menu_line .= "$menu_timeout_prompt_ext"; } } if ($option_value[$j] =~ /INVALID/) { if ( (length($menu_invalid_prompt[$i])>0) && ($menu_invalid_prompt[$i] !~ /NONE/) ) { - $call_menu_line .= "exten => i,1,Playback($menu_invalid_prompt[$i])\n"; - $PRI++; + $menu_invalid_prompt_ext=''; + if ($menu_invalid_prompt[$i] =~ /\|/) + { + @menu_invalid_prompts_array = split(/\|/,$menu_invalid_prompt[$i]); + $w=0; + foreach(@menu_invalid_prompts_array) + { + if (length($menu_invalid_prompts_array[$w])>0) + { + $menu_invalid_prompt_ext .= "exten => i,$PRI,Playback($menu_invalid_prompts_array[$w])\n"; + $PRI++; + } + $w++; + } + } + else + { + $menu_invalid_prompt_ext .= "exten => i,1,Playback($menu_invalid_prompt[$i])\n"; + $PRI++; + } + + $call_menu_line .= "$menu_invalid_prompt_ext"; } $option_value[$j] = 'i'; } @@ -1096,7 +1136,28 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r { if ( (length($option_route_value[$j])>0) && ($option_route_value[$j] !~ /NONE/) ) { - $call_menu_line .= "exten => $option_value[$j],$PRI,Playback($option_route_value[$j])\n"; + $hangup_prompt_ext=''; + if ($option_route_value[$j] =~ /\|/) + { + @hangup_prompts_array = split(/\|/,$option_route_value[$j]); + $w=0; + foreach(@hangup_prompts_array) + { + if (length($hangup_prompts_array[$w])>0) + { + $hangup_prompt_ext .= "exten => $option_value[$j],$PRI,Playback($hangup_prompts_array[$w])\n"; + $PRI++; + } + $w++; + } + } + else + { + $hangup_prompt_ext .= "exten => $option_value[$j],1,Playback($option_route_value[$j])\n"; + $PRI++; + } + + $call_menu_line .= "$hangup_prompt_ext"; $call_menu_line .= "exten => $option_value[$j],n,Hangup\n"; } else @@ -1150,18 +1211,34 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r } $sthA->finish(); + $menu_prompt_ext=''; + if ($menu_prompt[$i] =~ /\|/) + { + @menu_prompts_array = split(/\|/,$menu_prompt[$i]); + $w=0; + foreach(@menu_prompts_array) + { + if (length($menu_prompts_array[$w])>0) + {$menu_prompt_ext .= "exten => s,n,Background($menu_prompts_array[$w])\n";} + $w++; + } + } + else + {$menu_prompt_ext .= "exten => s,n,Background($menu_prompt[$i])\n";} $call_menu_ext .= "\n"; $call_menu_ext .= "; $menu_name[$i]\n"; $call_menu_ext .= "[$menu_id[$i]]\n"; $call_menu_ext .= "exten => s,1,AGI(agi-VDAD_inbound_calltime_check.agi,-----$track_in_vdac[$i]-----$menu_id[$i]-----$time_check_scheme-----$time_check_route-----$time_check_route_value-----$time_check_route_context)\n"; - $call_menu_ext .= "exten => s,n,Background($menu_prompt[$i])\n"; - $call_menu_ext .= "exten => s,n,WaitExten($menu_timeout[$i])\n"; + $call_menu_ext .= "$menu_prompt_ext"; + if ($menu_timeout[$i] > 0) + {$call_menu_ext .= "exten => s,n,WaitExten($menu_timeout[$i])\n";} $k=0; while ($k < $menu_repeat[$i]) { - $call_menu_ext .= "exten => s,n,Background($menu_prompt[$i])\n"; - $call_menu_ext .= "exten => s,n,WaitExten($menu_timeout[$i])\n"; + $call_menu_ext .= "$menu_prompt_ext"; + if ($menu_timeout[$i] > 0) + {$call_menu_ext .= "exten => s,n,WaitExten($menu_timeout[$i])\n";} $k++; } # $call_menu_ext .= "exten => s,n,Hangup\n"; diff --git a/extras/upgrade_2.2.0.sql b/extras/upgrade_2.2.0.sql index 798bf0db..c2fd1f24 100644 --- a/extras/upgrade_2.2.0.sql +++ b/extras/upgrade_2.2.0.sql @@ -189,3 +189,12 @@ ALTER TABLE vicidial_call_menu ADD custom_dialplan_entry TEXT; ALTER TABLE phones ADD phone_ring_timeout SMALLINT(3) default '60'; UPDATE system_settings SET db_schema_version='1152'; + + +ALTER TABLE vicidial_call_menu MODIFY menu_prompt VARCHAR(255); +ALTER TABLE vicidial_call_menu MODIFY menu_timeout_prompt VARCHAR(255) default 'NONE'; +ALTER TABLE vicidial_call_menu MODIFY menu_invalid_prompt VARCHAR(255) default 'NONE'; + +ALTER TABLE vicidial_call_menu_options MODIFY option_route_value VARCHAR(255); + +UPDATE system_settings SET db_schema_version='1153'; diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt index 6f38690b..577157a5 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt @@ -171,6 +171,8 @@ Allow Custom Dialplan Entries|| This option allows you to enter custom dialplan lines into Call Menus. Default is 0 for inactive|| Custom Dilplan Entry|| This field allows you to enter in any dialplan elements that you want for the Call Menu|| +You can enter multiple propmts in this field and the other prompt fields by separating them with a pipe character|| +Setting this field to zero 0 will mean that there will be no wait time after the prompt is played|| add-file: user_territories.php diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 32786fdd..141a8c58 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1470,9 +1470,9 @@ if ($non_latin < 1) $phone_context = ereg_replace("[^-_0-9a-zA-Z]","",$phone_context); ### ALPHA-NUMERIC and underscore and dash and slash and dot - $menu_prompt = ereg_replace("[^-\/\._0-9a-zA-Z]","",$menu_prompt); - $menu_timeout_prompt = ereg_replace("[^-\/\._0-9a-zA-Z]","",$menu_timeout_prompt); - $menu_invalid_prompt = ereg_replace("[^-\/\._0-9a-zA-Z]","",$menu_invalid_prompt); + $menu_prompt = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$menu_prompt); + $menu_timeout_prompt = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$menu_timeout_prompt); + $menu_invalid_prompt = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$menu_invalid_prompt); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); @@ -4102,12 +4102,12 @@ if ($SSqc_features_active > 0)

-Menu Prompt - This field contains the file name of the audio prompt to play at the beginning of this menu. +Menu Prompt - This field contains the file name of the audio prompt to play at the beginning of this menu. You can enter multiple propmts in this field and the other prompt fields by separating them with a pipe character.

-Menu Timeout - This field is where you set the timeout in seconds that the menu will wait for the caller to enter in a DTMF choice. +Menu Timeout - This field is where you set the timeout in seconds that the menu will wait for the caller to enter in a DTMF choice. Setting this field to zero 0 will mean that there will be no wait time after the prompt is played.
@@ -11265,7 +11265,7 @@ if ($ADD==4511) $option_value = ereg_replace("[^-\_0-9A-Z]","",$option_value); $option_description = ereg_replace("[^- \:\/\_0-9a-zA-Z]","",$option_description); $option_route = ereg_replace("[^-_0-9a-zA-Z]","",$option_route); - $option_route_value = ereg_replace("[^-\/\_\#\*\,\.\_0-9a-zA-Z]","",$option_route_value); + $option_route_value = ereg_replace("[^-\/\|\_\#\*\,\.\_0-9a-zA-Z]","",$option_route_value); $option_route_value_context = ereg_replace("[^,-_0-9a-zA-Z]","",$option_route_value_context); } @@ -17923,10 +17923,10 @@ if ($ADD==3511) echo "
\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "
Menu ID: $menu_id $NWB#vicidial_call_menu-menu_id$NWE
Menu Name: $NWB#vicidial_call_menu-menu_name$NWE
Menu Prompt: audio chooser $NWB#vicidial_call_menu-menu_prompt$NWE
Menu Prompt: audio chooser $NWB#vicidial_call_menu-menu_prompt$NWE
Menu Timeout: $NWB#vicidial_call_menu-menu_timeout$NWE
Menu Timeout Prompt: audio chooser $NWB#vicidial_call_menu-menu_timeout_prompt$NWE
Menu Invalid Prompt: audio chooser $NWB#vicidial_call_menu-menu_invalid_prompt$NWE
Menu Timeout Prompt: audio chooser $NWB#vicidial_call_menu-menu_timeout_prompt$NWE
Menu Invalid Prompt: audio chooser $NWB#vicidial_call_menu-menu_invalid_prompt$NWE
Menu Repeat: $NWB#vicidial_call_menu-menu_repeat$NWE
Menu Time Check: audio chooser\n"; + echo "Audio File: audio chooser\n"; } if ($option_route=='EXTENSION') {