From 9ae3cf8da367a5ff3eb9465de37adc8fb64a20b4 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 25 Jan 2023 23:08:38 -0700 Subject: [PATCH] Add destination languages --- app/switch/app_config.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/app/switch/app_config.php b/app/switch/app_config.php index 1d1e6dbde4..c69fbd470e 100644 --- a/app/switch/app_config.php +++ b/app/switch/app_config.php @@ -29,6 +29,39 @@ $apps[$x]['description']['sv-se'] = ""; $apps[$x]['description']['uk-ua'] = ""; + //destination details + $languages = glob($_SESSION["switch"]['sounds']['dir']."/*/*/*"); + foreach ($languages as $key => $path) { + $path = str_replace($_SESSION["switch"]['sounds']['dir'].'/', "", $path); + $path_array = explode('/', $path); + if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) { + unset($languages[$key]); + } + $languages[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$languages[$key]); + if (strlen($languages[$key]) == 0) { + unset($languages[$key]); + } + } + $y=0; + $apps[$x]['destinations'][$y]['type'] = 'array'; + $apps[$x]['destinations'][$y]['label'] = 'languages'; + $apps[$x]['destinations'][$y]['name'] = 'languages'; + $apps[$x]['destinations'][$y]['field']['name'] = 'name'; + $apps[$x]['destinations'][$y]['field']['language'] = 'language'; + $apps[$x]['destinations'][$y]['field']['dialect'] = 'dialect'; + $apps[$x]['destinations'][$y]['field']['voice'] = 'voice'; + $apps[$x]['destinations'][$y]['select_value']['dialplan'] = "multiset:^^,default_language=\${language},default_dialect=\${dialect},default_voice=\${voice}"; + $apps[$x]['destinations'][$y]['select_value']['ivr'] = "menu-exec-app:multiset:^^,default_language=\${language},default_dialect=\${dialect},default_voice=\${voice}"; + $apps[$x]['destinations'][$y]['select_label'] = "\${name}"; + $z=0; + foreach ($languages as $language) { + $apps[$x]['destinations'][$y]['result']['data'][$z]['name'] = str_replace('/', '-', $language); + $apps[$x]['destinations'][$y]['result']['data'][$z]['language'] = explode('/', $language)[0]; + $apps[$x]['destinations'][$y]['result']['data'][$z]['dialect'] = explode('/', $language)[1]; + $apps[$x]['destinations'][$y]['result']['data'][$z]['voice'] = explode('/', $language)[2]; + $z++; + } + //permission details $y=0; $apps[$x]['permissions'][$y]['name'] = "switch_version"; @@ -78,4 +111,4 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = ""; -?> \ No newline at end of file +?>