From 36741f96cce02cef24c2bc805b2579e4612e6aec Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 22 Jan 2016 13:05:13 +0300 Subject: [PATCH 01/33] Fix. Display modules form if FS does not start. --- app/modules/app_languages.php | 32 +++++++++++++++++++++++++ app/modules/modules.php | 45 ++++++++++++++++++++++++++++------- 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/app/modules/app_languages.php b/app/modules/app_languages.php index 91fbde7c5b..cf89694518 100644 --- a/app/modules/app_languages.php +++ b/app/modules/app_languages.php @@ -44,6 +44,28 @@ $text['label-unload_module']['uk'] = "Вивантажити модуль"; $text['label-unload_module']['sv-se'] = "Ladda av Modul"; $text['label-unload_module']['de-at'] = "Modul deaktivieren"; +$text['label-unknown']['en-us'] = "Unknown"; +$text['label-unknown']['es-cl'] = ""; +$text['label-unknown']['pt-pt'] = ""; +$text['label-unknown']['fr-fr'] = ""; +$text['label-unknown']['pt-br'] = ""; +$text['label-unknown']['he'] = ""; +$text['label-unknown']['pl'] = ""; +$text['label-unknown']['uk'] = ""; +$text['label-unknown']['sv-se'] = ""; +$text['label-unknown']['de-at'] = ""; + +$text['label-none']['en-us'] = "None"; +$text['label-none']['es-cl'] = ""; +$text['label-none']['pt-pt'] = ""; +$text['label-none']['fr-fr'] = ""; +$text['label-none']['pt-br'] = ""; +$text['label-none']['he'] = ""; +$text['label-none']['pl'] = ""; +$text['label-none']['uk'] = ""; +$text['label-none']['sv-se'] = ""; +$text['label-none']['de-at'] = ""; + $text['label-stopped']['en-us'] = "Stopped"; $text['label-stopped']['es-cl'] = "Detenido"; $text['label-stopped']['pt-pt'] = "Parado"; @@ -220,4 +242,14 @@ $text['description-modules']['uk'] = "Модулі розширюють можл $text['description-modules']['sv-se'] = "Moduler utökar funktionerna i systemet. Använd den här sidan för att aktivera eller inaktivera moduler."; $text['description-modules']['de-at'] = "Module erweitern die Funktionalität des Systems. Benutzen Sie diese Seite um Module zu aktivieren oder zu deaktivieren."; +$text['error-event-socket']['en-us'] = "Connection to Event Socket failed."; +$text['error-event-socket']['es-cl'] = "Conexión a Socket de Eventos fallida."; +$text['error-event-socket']['pt-pt'] = "A ligação ao Event Socket falhou."; +$text['error-event-socket']['fr-fr'] = "Connexion à l'Event Socket en echec."; +$text['error-event-socket']['pt-br'] = "A conexão do evento socket falhou"; +$text['error-event-socket']['pl'] = "Połączenie do “Event Socket” nie powiodło się"; +$text['error-event-socket']['sv-se'] = "Kontakten till 'Event Socket' misslyckades."; +$text['error-event-socket']['uk'] = "Помилка підключення до сокета подій"; +$text['error-event-socket']['de-at'] = "Connection to Event Socket failed."; + ?> \ No newline at end of file diff --git a/app/modules/modules.php b/app/modules/modules.php index 47e6c37f3b..6b5317d1b1 100644 --- a/app/modules/modules.php +++ b/app/modules/modules.php @@ -67,6 +67,27 @@ if (strlen($_GET["a"]) > 0) { } } +$esl_alive = false; +if($fp){ + $esl_alive = true; + fclose($fp); +} + +//Warning if FS not start + if(!$esl_alive){ + $msg = "
".$text['error-event-socket']."
"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
".$text['label-message']."
$msg
\n"; + echo "
\n"; + } + //use the module class to get the list of modules from the db and add any missing modules $mod = new modules; $mod->db = $db; @@ -157,18 +178,24 @@ if (strlen($_GET["a"]) > 0) { echo $row["module_label"]; } echo " \n"; - if ($mod->active($row["module_name"])) { - echo " ".$text['label-running']."\n"; - echo " ".$text['label-stop']."\n"; - } - else { - if ($row['module_enabled']=="true") { - echo " ".$text['label-stopped']."\n"; + if($esl_alive) { + if ($mod->active($row["module_name"])) { + echo " ".$text['label-running']."\n"; + echo " ".$text['label-stop']."\n"; } else { - echo " ".$text['label-stopped']." ".$notice."\n"; + if ($row['module_enabled']=="true") { + echo " ".$text['label-stopped']."\n"; + } + else { + echo " ".$text['label-stopped']." ".$notice."\n"; + } + echo " ".$text['label-start']."\n"; } - echo " ".$text['label-start']."\n"; + } + else{ + echo " ".$text['label-unknown']."\n"; + echo " ".$text['label-none']."\n"; } echo " "; if ($row["module_enabled"] == "true") { From 944662cba9cd402a3ae5aec89e66dba69d1a3966 Mon Sep 17 00:00:00 2001 From: mafoo Date: Mon, 25 Jan 2016 14:29:27 +0000 Subject: [PATCH 02/33] BugFix for remote pgsql databases --- core/install/resources/classes/install_fusionpbx.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index c55e89fb9b..1c4ce6d98e 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -173,8 +173,12 @@ include "root.php"; $tmp_config .= "\n"; $tmp_config .= " //pgsql: database connection information\n"; if ($this->global_settings->db_type() == "pgsql") { + $db_host = $this->global_settings->db_host(); $cmt_out = ''; - if($this->global_settings->db_host() != 'localhost') { $cmt_out = "//"; } + if ( $db_host == "localhost" or $db_host == "127.0.0.1") { + //if localhost or 127.0.0.1 we want it to default to a Unix Socket. + $cmt_out = "//"; + } $tmp_config .= " $cmt_out\$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; $tmp_config .= " \$db_port = '".$this->global_settings->db_port()."';\n"; $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."';\n"; From 08f39071ccc09c4eadc7acc7c2f6ed720855852f Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 09:41:29 -0700 Subject: [PATCH 03/33] Change the variable from cmt to comment to make it easier to read the code. --- core/install/resources/classes/install_fusionpbx.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 1c4ce6d98e..6a89d630c6 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -174,12 +174,12 @@ include "root.php"; $tmp_config .= " //pgsql: database connection information\n"; if ($this->global_settings->db_type() == "pgsql") { $db_host = $this->global_settings->db_host(); - $cmt_out = ''; + $comment_out = ''; if ( $db_host == "localhost" or $db_host == "127.0.0.1") { //if localhost or 127.0.0.1 we want it to default to a Unix Socket. - $cmt_out = "//"; + $comment_out = "//"; } - $tmp_config .= " $cmt_out\$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; + $tmp_config .= " $comment_out\$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; $tmp_config .= " \$db_port = '".$this->global_settings->db_port()."';\n"; $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."';\n"; $tmp_config .= " \$db_username = '".$this->global_settings->db_username()."';\n"; From 2e306568e45fe9d1bad86cedb5d0e82e8c5926fc Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 10:24:09 -0700 Subject: [PATCH 04/33] Disable default settings -> call center path by default. --- app/call_centers/app_defaults.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/call_centers/app_defaults.php b/app/call_centers/app_defaults.php index 87b623f1e1..b25e350928 100644 --- a/app/call_centers/app_defaults.php +++ b/app/call_centers/app_defaults.php @@ -54,7 +54,7 @@ if ($domains_processed == 1) { $sql .= "'call_center', "; $sql .= "'dir', "; $sql .= "'".$_SESSION['switch']['conf']['dir']."/autoload_configs', "; - $sql .= "'true', "; + $sql .= "'false', "; $sql .= "'' "; $sql .= ")"; $db->exec(check_sql($sql)); From 46fd506ed267c725b8ea83871abe0ff90b548281 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 16:31:04 -0700 Subject: [PATCH 05/33] Add domain name to the recordings path in ivr_menu.lua. --- resources/install/scripts/ivr_menu.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 24418d531e..d6961cfdde 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -307,19 +307,19 @@ --adjust file paths --greet long if (not file_exists(ivr_menu_greet_long)) then - if (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..greet_long_file_name)) then + if (file_exists(recordings_dir.."/"..domain_name.."/"..greet_long_file_name)) then + ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..greet_long_file_name; + elseif (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..greet_long_file_name)) then ivr_menu_greet_long = sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..greet_long_file_name; - elseif (file_exists(recordings_dir.."/"..greet_long_file_name)) then - ivr_menu_greet_long = recordings_dir.."/"..greet_long_file_name; end end --greet short if (string.len(ivr_menu_greet_short) > 1) then if (not file_exists(ivr_menu_greet_short)) then - if (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..greet_short_file_name)) then + if (file_exists(recordings_dir.."/"..domain_name.."/"..greet_short_file_name)) then + ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..greet_short_file_name; + elseif (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..greet_short_file_name)) then ivr_menu_greet_short = sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..greet_short_file_name; - elseif (file_exists(recordings_dir.."/"..greet_short_file_name)) then - ivr_menu_greet_short = recordings_dir.."/"..greet_short_file_name; end end else @@ -327,18 +327,18 @@ end --invalid sound if (not file_exists(ivr_menu_invalid_sound)) then - if (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..invalid_sound_file_name)) then + if (file_exists(recordings_dir.."/"..domain_name.."/"..invalid_sound_file_name)) then + ivr_menu_invalid_sound = recordings_dir.."/"..domain_name.."/"..invalid_sound_file_name; + elseif (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..invalid_sound_file_name)) then ivr_menu_invalid_sound = sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..invalid_sound_file_name; - elseif (file_exists(recordings_dir.."/"..invalid_sound_file_name)) then - ivr_menu_invalid_sound = recordings_dir.."/"..invalid_sound_file_name; end end --exit sound if (not file_exists(ivr_menu_exit_sound)) then - if (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..exit_sound_file_name)) then + if (file_exists(recordings_dir.."/"..domain_name.."/"..exit_sound_file_name)) then + ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..exit_sound_file_name; + elseif (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..exit_sound_file_name)) then ivr_menu_exit_sound = sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..exit_sound_file_name; - elseif (file_exists(recordings_dir.."/"..exit_sound_file_name)) then - ivr_menu_exit_sound = recordings_dir.."/"..exit_sound_file_name; end end From 48d220b93efccb38577425cb389e012ff8edbad6 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 16:32:27 -0700 Subject: [PATCH 06/33] Add recording file handling to the ivr xml handler. --- .../scripts/configuration/ivr.conf.lua | 152 +++++++++++++++++- .../resources/scripts/directory/directory.lua | 8 +- 2 files changed, 154 insertions(+), 6 deletions(-) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua index 4690230fd5..48e66c1f5f 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua @@ -13,7 +13,7 @@ -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- --- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -77,7 +77,155 @@ ivr_menu_description = row["ivr_menu_description"]; end); - --recording path +--get the recordings from the database + ivr_menu_greet_long_is_base64 = false; + ivr_menu_greet_short_is_base64 = false; + ivr_menu_invalid_sound_is_base64 = false; + ivr_menu_exit_sound_is_base64 = false; + if (storage_type == "base64") then + --greet long + if (string.len(ivr_menu_greet_long) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_greet_long..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); + end + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long; + ivr_menu_greet_long_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_greet_long, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end + end + --greet short + if (string.len(ivr_menu_greet_short) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_greet_short..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); + end + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short; + ivr_menu_greet_short_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_greet_short, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end + end + --invalid sound + if (string.len(ivr_menu_invalid_sound) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); + end + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_invalid_sound = recordings_dir..domain_name.."/".."/"..ivr_menu_invalid_sound; + ivr_menu_invalid_sound_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_invalid_sound, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end + end + --exit sound + if (string.len(ivr_menu_exit_sound) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); + end + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound; + ivr_menu_exit_sound_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_exit_sound, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end + end + elseif (storage_type == "http_cache") then + --add the path to file name + ivr_menu_greet_long = storage_path.."/"..ivr_menu_greet_long; + ivr_menu_greet_short = storage_path.."/"..ivr_menu_greet_short; + ivr_menu_invalid_sound = storage_path.."/"..ivr_menu_invalid_sound; + ivr_menu_exit_sound = storage_path.."/"..ivr_menu_exit_sound; + end + + --greet long + if (not file_exists(ivr_menu_greet_long)) then + if (file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then + ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long; + elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_greet_long)) then + ivr_menu_greet_long = sounds_dir.."/${default_language}/${default_dialect}/${default_voice}/"..ivr_menu_greet_long; + end + end + + --greet short + if (string.len(ivr_menu_greet_short) > 1) then + if (not file_exists(ivr_menu_greet_short)) then + if (file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then + ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long; + elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_greet_long)) then + ivr_menu_greet_short = sounds_dir.."/${default_language}/${default_dialect}/${default_voice}/"..ivr_menu_greet_long; + end + end + else + ivr_menu_greet_short = ivr_menu_greet_long; + end + + --invalid sound + if (not file_exists(ivr_menu_invalid_sound)) then + if (file_exists(recordings_dir.."/"..domain_name.. "/"..ivr_menu_invalid_sound)) then + ivr_menu_invalid_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound; + elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_invalid_sound)) then + ivr_menu_invalid_sound = sounds_dir.."/${default_language}/${default_dialect}/${default_voice}/"..ivr_menu_invalid_sound; + end + end + + --exit sound + if (not file_exists(ivr_menu_exit_sound)) then + if (file_exists(recordings_dir.."/"..ivr_menu_exit_sound)) then + ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound; + elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_exit_sounde)) then + ivr_menu_exit_sound = sounds_dir.."/${default_language}/${default_dialect}/${default_voice}/"..ivr_menu_exit_sound; + end + end --start the xml array local xml = {} diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua index 0994e28667..1ecf561ae2 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -339,10 +339,10 @@ table.insert(xml, [[]]); table.insert(xml, [[
]]); table.insert(xml, [[ ]]); - table.insert(xml, [[ ]]); - table.insert(xml, [[ ]]); - table.insert(xml, [[ ]]); - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); From cf2a4601ff18f64f4187a54468da4d8a3eecd9ac Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 16:53:09 -0700 Subject: [PATCH 07/33] Remove the recordings_dir with automatic domain_name and add domain_name in a few places where it was missing. --- .../scripts/configuration/ivr.conf.lua | 202 +++++++++--------- resources/install/scripts/ivr_menu.lua | 20 +- 2 files changed, 110 insertions(+), 112 deletions(-) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua index 48e66c1f5f..df90f0206d 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua @@ -77,115 +77,115 @@ ivr_menu_description = row["ivr_menu_description"]; end); ---get the recordings from the database - ivr_menu_greet_long_is_base64 = false; - ivr_menu_greet_short_is_base64 = false; - ivr_menu_invalid_sound_is_base64 = false; - ivr_menu_exit_sound_is_base64 = false; - if (storage_type == "base64") then - --greet long - if (string.len(ivr_menu_greet_long) > 1) then - if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then - sql = [[SELECT * FROM v_recordings - WHERE domain_uuid = ']]..domain_uuid..[[' - AND recording_filename = ']]..ivr_menu_greet_long..[[' ]]; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); - end - status = dbh:query(sql, function(row) - --add functions - require "resources.functions.base64"; - --add the path to filename - ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long; - ivr_menu_greet_long_is_base64 = true; - --save the recording to the file system - if (string.len(row["recording_base64"]) > 32) then - local file = io.open(ivr_menu_greet_long, "w"); - file:write(base64.decode(row["recording_base64"])); - file:close(); + --get the recordings from the database + ivr_menu_greet_long_is_base64 = false; + ivr_menu_greet_short_is_base64 = false; + ivr_menu_invalid_sound_is_base64 = false; + ivr_menu_exit_sound_is_base64 = false; + if (storage_type == "base64") then + --greet long + if (string.len(ivr_menu_greet_long) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_greet_long..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); end - end); - end - end - --greet short - if (string.len(ivr_menu_greet_short) > 1) then - if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short)) then - sql = [[SELECT * FROM v_recordings - WHERE domain_uuid = ']]..domain_uuid..[[' - AND recording_filename = ']]..ivr_menu_greet_short..[[' ]]; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long; + ivr_menu_greet_long_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_greet_long, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end end - status = dbh:query(sql, function(row) - --add functions - require "resources.functions.base64"; - --add the path to filename - ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short; - ivr_menu_greet_short_is_base64 = true; - --save the recording to the file system - if (string.len(row["recording_base64"]) > 32) then - local file = io.open(ivr_menu_greet_short, "w"); - file:write(base64.decode(row["recording_base64"])); - file:close(); + --greet short + if (string.len(ivr_menu_greet_short) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_greet_short..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); end - end); - end - end - --invalid sound - if (string.len(ivr_menu_invalid_sound) > 1) then - if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound)) then - sql = [[SELECT * FROM v_recordings - WHERE domain_uuid = ']]..domain_uuid..[[' - AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]]; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short; + ivr_menu_greet_short_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_greet_short, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end end - status = dbh:query(sql, function(row) - --add functions - require "resources.functions.base64"; - --add the path to filename - ivr_menu_invalid_sound = recordings_dir..domain_name.."/".."/"..ivr_menu_invalid_sound; - ivr_menu_invalid_sound_is_base64 = true; - --save the recording to the file system - if (string.len(row["recording_base64"]) > 32) then - local file = io.open(ivr_menu_invalid_sound, "w"); - file:write(base64.decode(row["recording_base64"])); - file:close(); + --invalid sound + if (string.len(ivr_menu_invalid_sound) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); end - end); - end - end - --exit sound - if (string.len(ivr_menu_exit_sound) > 1) then - if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound)) then - sql = [[SELECT * FROM v_recordings - WHERE domain_uuid = ']]..domain_uuid..[[' - AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]]; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_invalid_sound = recordings_dir..domain_name.."/".."/"..ivr_menu_invalid_sound; + ivr_menu_invalid_sound_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_invalid_sound, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end end - status = dbh:query(sql, function(row) - --add functions - require "resources.functions.base64"; - --add the path to filename - ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound; - ivr_menu_exit_sound_is_base64 = true; - --save the recording to the file system - if (string.len(row["recording_base64"]) > 32) then - local file = io.open(ivr_menu_exit_sound, "w"); - file:write(base64.decode(row["recording_base64"])); - file:close(); + --exit sound + if (string.len(ivr_menu_exit_sound) > 1) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound)) then + sql = [[SELECT * FROM v_recordings + WHERE domain_uuid = ']]..domain_uuid..[[' + AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n"); end - end); - end + status = dbh:query(sql, function(row) + --add functions + require "resources.functions.base64"; + --add the path to filename + ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound; + ivr_menu_exit_sound_is_base64 = true; + --save the recording to the file system + if (string.len(row["recording_base64"]) > 32) then + local file = io.open(ivr_menu_exit_sound, "w"); + file:write(base64.decode(row["recording_base64"])); + file:close(); + end + end); + end + end + elseif (storage_type == "http_cache") then + --add the path to file name + ivr_menu_greet_long = storage_path.."/"..ivr_menu_greet_long; + ivr_menu_greet_short = storage_path.."/"..ivr_menu_greet_short; + ivr_menu_invalid_sound = storage_path.."/"..ivr_menu_invalid_sound; + ivr_menu_exit_sound = storage_path.."/"..ivr_menu_exit_sound; end - elseif (storage_type == "http_cache") then - --add the path to file name - ivr_menu_greet_long = storage_path.."/"..ivr_menu_greet_long; - ivr_menu_greet_short = storage_path.."/"..ivr_menu_greet_short; - ivr_menu_invalid_sound = storage_path.."/"..ivr_menu_invalid_sound; - ivr_menu_exit_sound = storage_path.."/"..ivr_menu_exit_sound; - end --greet long if (not file_exists(ivr_menu_greet_long)) then diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index d6961cfdde..25fef0210c 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -13,7 +13,7 @@ -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- --- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -76,8 +76,6 @@ end end ---add the domain name to the recordings directory - recordings_dir = recordings_dir .. "/"..domain_name; --set default variable(s) tries = 0; @@ -202,7 +200,7 @@ if (storage_type == "base64") then --greet long if (string.len(ivr_menu_greet_long) > 1) then - if (not file_exists(recordings_dir.."/"..greet_long_file_name)) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..greet_long_file_name)) then sql = [[SELECT * FROM v_recordings WHERE domain_uuid = ']]..domain_uuid..[[' AND recording_filename = ']]..greet_long_file_name..[[' ]]; @@ -213,7 +211,7 @@ --add functions require "resources.functions.base64"; --add the path to filename - ivr_menu_greet_long = recordings_dir.."/"..greet_long_file_name; + ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..greet_long_file_name; ivr_menu_greet_long_is_base64 = true; --save the recording to the file system if (string.len(row["recording_base64"]) > 32) then @@ -226,7 +224,7 @@ end --greet short if (string.len(ivr_menu_greet_short) > 1) then - if (not file_exists(recordings_dir.."/"..greet_short_file_name)) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..greet_short_file_name)) then sql = [[SELECT * FROM v_recordings WHERE domain_uuid = ']]..domain_uuid..[[' AND recording_filename = ']]..greet_short_file_name..[[' ]]; @@ -237,7 +235,7 @@ --add functions require "resources.functions.base64"; --add the path to filename - ivr_menu_greet_short = recordings_dir.."/"..greet_short_file_name; + ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..greet_short_file_name; ivr_menu_greet_short_is_base64 = true; --save the recording to the file system if (string.len(row["recording_base64"]) > 32) then @@ -250,7 +248,7 @@ end --invalid sound if (string.len(ivr_menu_invalid_sound) > 1) then - if (not file_exists(recordings_dir.."/"..invalid_sound_file_name)) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..invalid_sound_file_name)) then sql = [[SELECT * FROM v_recordings WHERE domain_uuid = ']]..domain_uuid..[[' AND recording_filename = ']]..invalid_sound_file_name..[[' ]]; @@ -261,7 +259,7 @@ --add functions require "resources.functions.base64"; --add the path to filename - ivr_menu_invalid_sound = recordings_dir.."/"..invalid_sound_file_name; + ivr_menu_invalid_sound = recordings_dir.."/"..domain_name.."/"..invalid_sound_file_name; ivr_menu_invalid_sound_is_base64 = true; --save the recording to the file system if (string.len(row["recording_base64"]) > 32) then @@ -274,7 +272,7 @@ end --exit sound if (string.len(ivr_menu_exit_sound) > 1) then - if (not file_exists(recordings_dir.."/"..exit_sound_file_name)) then + if (not file_exists(recordings_dir.."/"..domain_name.."/"..exit_sound_file_name)) then sql = [[SELECT * FROM v_recordings WHERE domain_uuid = ']]..domain_uuid..[[' AND recording_filename = ']]..exit_sound_file_name..[[' ]]; @@ -285,7 +283,7 @@ --add functions require "resources.functions.base64"; --add the path to filename - ivr_menu_exit_sound = recordings_dir.."/"..exit_sound_file_name; + ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..exit_sound_file_name; ivr_menu_exit_sound_is_base64 = true; --save the recording to the file system if (string.len(row["recording_base64"]) > 32) then From cd58b105cb88183676ac3e0f26dc243e281387bd Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 20:38:45 -0700 Subject: [PATCH 08/33] More work on user assigned contacts. --- app/provision/resources/classes/provision.php | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 95a3304d7f..f4426f160b 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -519,12 +519,12 @@ include "root.php"; $sql = "select user_uuid from v_extension_users "; $sql .= "where extension_uuid = '$extension_uuid' "; $sql .= "and domain_uuid = '$domain_uuid' "; - //echo $sql."\n"; $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $extension_users = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset($prep_statement); foreach ($extension_users as &$row) { + //echo "user uuid: ".$row["user_uuid"]."\n"; //get the list of contacts [multiple results] $sql = "select contact_uuid from v_contact_users "; $sql .= "where user_uuid = '".$row["user_uuid"]."' "; @@ -535,7 +535,7 @@ include "root.php"; $extension_users = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset($prep_statement); foreach ($extension_users as &$row) { - $contacts[] = $row["contact_uuid"]; + $contact_uuids[] = $row["contact_uuid"]; } } } @@ -543,23 +543,23 @@ include "root.php"; //get the contacts assigned to the user //SQL 'in' with implode contacts array prevents returning duplicate contacts if (sizeof($contacts) > 0) { - $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, "; - $sql .= "p.phone_number, p.phone_extension "; - $sql .= "from v_contacts as c, v_contact_phones as p "; - $sql .= "where c.contact_uuid in ('".implode("','",$contacts)."') "; - $sql .= "and c.contact_uuid = p.contact_uuid "; - $sql .= "and p.phone_type_voice = '1' "; - $sql .= "and c.domain_uuid = '$domain_uuid' "; - //echo $sql."\n"; - $prep_statement = $this->db->prepare(check_sql($sql)); - $prep_statement->execute(); - $directory_personal = $prep_statement->fetchAll(PDO::FETCH_NAMED); - unset($prep_statement); - //print_r($contacts); + //get the contact details + $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, "; + $sql .= "p.phone_number, p.phone_extension "; + $sql .= "from v_contacts as c, v_contact_phones as p "; + $sql .= "where c.contact_uuid in ('".implode("','",$contact_uuids)."') "; + $sql .= "and c.contact_uuid = p.contact_uuid "; + $sql .= "and p.phone_type_voice = '1' "; + $sql .= "and c.domain_uuid = '$domain_uuid' "; + //echo $sql."\n"; + $prep_statement = $this->db->prepare(check_sql($sql)); + $prep_statement->execute(); + $user_contacts = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset($prep_statement); + //assign the contacts array + $view->assign("user_contacts", $user_contacts); } - //assign the contacts array - $view->assign("directory_personal", $contacts); } //get the contact extensions array and add to the template engine From 9787fe2087650b0e85085bd92b7be610be6eff34 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 20:42:48 -0700 Subject: [PATCH 09/33] Update the Cisco 794x personal contacts. --- .../templates/provision/cisco/7940/directory_personal.xml | 6 +----- .../templates/provision/cisco/7960/directory_personal.xml | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/resources/templates/provision/cisco/7940/directory_personal.xml b/resources/templates/provision/cisco/7940/directory_personal.xml index 52f1f61688..08724998ae 100644 --- a/resources/templates/provision/cisco/7940/directory_personal.xml +++ b/resources/templates/provision/cisco/7940/directory_personal.xml @@ -2,7 +2,7 @@ Personal Please choose... {assign var=x value=1} -{foreach $directory_personal as $row} +{foreach $user_contacts as $row} {if $row.contact_name_given != ""} {$row.contact_name_given} {$row.contact_name_family} @@ -18,7 +18,3 @@ {assign var=x value=$x+1} {/foreach} - - - - diff --git a/resources/templates/provision/cisco/7960/directory_personal.xml b/resources/templates/provision/cisco/7960/directory_personal.xml index 52f1f61688..08724998ae 100644 --- a/resources/templates/provision/cisco/7960/directory_personal.xml +++ b/resources/templates/provision/cisco/7960/directory_personal.xml @@ -2,7 +2,7 @@ Personal Please choose... {assign var=x value=1} -{foreach $directory_personal as $row} +{foreach $user_contacts as $row} {if $row.contact_name_given != ""} {$row.contact_name_given} {$row.contact_name_family} @@ -18,7 +18,3 @@ {assign var=x value=$x+1} {/foreach} - - - - From 5172809a86ff74c7f1b82f70ea126c0860baac91 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 25 Jan 2016 21:27:21 -0700 Subject: [PATCH 10/33] Add Cisco and Linksys to the format_mac list. --- app/provision/resources/classes/provision.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index f4426f160b..9953fb8ba7 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -132,6 +132,12 @@ include "root.php"; case "aastra": $mac = strtoupper($mac); break; + case "cisco": + $mac = strtoupper($mac); + break; + case "linksys": + $mac = strtolower($mac); + break; case "mitel": $mac = strtoupper($mac); break; From 9bc3e6553f876e18ce644baf7d4c63b867777a7f Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 26 Jan 2016 09:01:56 -0700 Subject: [PATCH 11/33] Fix the install problem. --- .../install/resources/classes/install_fusionpbx.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 6a89d630c6..45508ab28e 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -174,12 +174,13 @@ include "root.php"; $tmp_config .= " //pgsql: database connection information\n"; if ($this->global_settings->db_type() == "pgsql") { $db_host = $this->global_settings->db_host(); - $comment_out = ''; - if ( $db_host == "localhost" or $db_host == "127.0.0.1") { - //if localhost or 127.0.0.1 we want it to default to a Unix Socket. - $comment_out = "//"; - } - $tmp_config .= " $comment_out\$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; + //Unix Socket - if localhost or 127.0.0.1 we want it to default to a Unix Socket. + //$comment_out = ''; + //if ( $db_host == "localhost" or $db_host == "127.0.0.1") { + // $comment_out = "//"; + //} + //$tmp_config .= " $comment_out\$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; + $tmp_config .= " \$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; $tmp_config .= " \$db_port = '".$this->global_settings->db_port()."';\n"; $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."';\n"; $tmp_config .= " \$db_username = '".$this->global_settings->db_username()."';\n"; From f5d16aebbcc53bd41f376838710edfc1d76c68a4 Mon Sep 17 00:00:00 2001 From: mafoo Date: Tue, 26 Jan 2016 17:34:44 +0000 Subject: [PATCH 12/33] phrases should be written out as there uuid not the name.domain_uuid format --- app/phrases/resources/functions/save_phrases_xml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/phrases/resources/functions/save_phrases_xml.php b/app/phrases/resources/functions/save_phrases_xml.php index 6c7921d0ae..597971fedb 100644 --- a/app/phrases/resources/functions/save_phrases_xml.php +++ b/app/phrases/resources/functions/save_phrases_xml.php @@ -42,7 +42,7 @@ function save_phrases_xml() { } //build xml - $xml .= " \n"; + $xml .= " \n"; $xml .= " \n"; $xml .= " \n"; From d65982cfacef85563b63a8a71dadf1486a39543c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 27 Jan 2016 15:56:22 -0700 Subject: [PATCH 13/33] Add a new permission extension_user_record to control who is able to see extension record. By default superadmin has this permission. --- app/extensions/app_config.php | 3 ++ app/extensions/extension_edit.php | 72 ++++++++++++++++--------------- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index 292d76fb3a..e6f99a868e 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -111,6 +111,9 @@ $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; $y++; + $apps[$x]['permissions'][$y]['name'] = "extension_user_record"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; $apps[$x]['permissions'][$y]['name'] = "extension_missed_call"; //$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; //$apps[$x]['permissions'][$y]['groups'][] = "admin"; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 06edad79f4..409e58bdc5 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -1729,42 +1729,44 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; } - echo "\n"; - echo "\n"; - echo " ".$text['label-user_record']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; + echo " \n"; + if ($user_record == "all") { + echo " \n"; + } + else { + echo " \n"; + } + if ($user_record == "local") { + echo " \n"; + } + else { + echo " \n"; + } + if ($user_record == "inbound") { + echo " \n"; + } + else { + echo " \n"; + } + if ($user_record == "outbound") { + echo " \n"; + } + else { + echo " \n"; + } + echo " \n"; + echo "
\n"; + echo $text['description-user_record']."\n"; + echo "\n"; + echo "\n"; } - else { - echo " \n"; - } - if ($user_record == "local") { - echo " \n"; - } - else { - echo " \n"; - } - if ($user_record == "inbound") { - echo " \n"; - } - else { - echo " \n"; - } - if ($user_record == "outbound") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; - echo "
\n"; - echo $text['description-user_record']."\n"; - echo "\n"; - echo "\n"; if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/music_on_hold')) { echo "\n"; From 134f44e4d4e6453ce6d281d3128ed72f8a470ecb Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 28 Jan 2016 13:17:30 +0300 Subject: [PATCH 14/33] Fix. Path to records in music on hold. --- .../resources/classes/switch_music_on_hold.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php index 40bc2ba8e4..7ca9ecf355 100644 --- a/app/music_on_hold/resources/classes/switch_music_on_hold.php +++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php @@ -90,22 +90,23 @@ include "root.php"; } } //recordings - if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) { + $recordings_dir = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/"; + if($dh = opendir($recordings_dir)) { $tmp_selected = false; $files = Array(); //$select .= "\n"; while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { - if(is_dir($_SESSION['switch']['recordings']['dir'] . "/" . $file)) { + if(is_dir($recordings_dir . $file)) { //this is a directory } else { - if ($this->select_value == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($this->select_value) > 0) { + if ($this->select_value == $recordings_dir . $file && strlen($this->select_value) > 0) { $tmp_selected = true; - $select .= " \n"; + $select .= " \n"; } else { - $select .= " \n"; + $select .= " \n"; } } } From b655a064fd3ceec57e3d0f1c3da873afcd27b4be Mon Sep 17 00:00:00 2001 From: mafoo Date: Thu, 28 Jan 2016 15:47:31 +0000 Subject: [PATCH 15/33] Converted uses of ringback to common function --- .../install/scripts/app/ring_groups/index.lua | 23 +---------- resources/install/scripts/directory.lua | 39 ++++--------------- resources/install/scripts/ivr_menu.lua | 25 ++---------- .../resources/functions/format_ringback.lua | 22 +++++++++++ 4 files changed, 36 insertions(+), 73 deletions(-) create mode 100644 resources/install/scripts/resources/functions/format_ringback.lua diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index bf4d2a193f..dc6ac4eaa6 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -39,6 +39,7 @@ local log = require "resources.functions.log".ring_group require "resources.functions.base64"; require "resources.functions.file_exists"; require "resources.functions.channel_utils" + require "resources.functions.format_ringback" --get the variables domain_name = session:getVariable("domain_name"); @@ -321,27 +322,7 @@ local log = require "resources.functions.log".ring_group domain_name = row.domain_name; --set ringback - if (ring_group_ringback == "${uk-ring}") then - ring_group_ringback = "tone_stream://%(400,200,400,450);%(400,2200,400,450);loops=-1"; - end - if (ring_group_ringback == "${us-ring}") then - ring_group_ringback = "tone_stream://%(2000,4000,440.0,480.0);loops=-1"; - end - if (ring_group_ringback == "${pt-ring}") then - ring_group_ringback = "tone_stream://%(1000,5000,400.0,0.0);loops=-1"; - end - if (ring_group_ringback == "${fr-ring}") then - ring_group_ringback = "tone_stream://%(1500,3500,440.0,0.0);loops=-1"; - end - if (ring_group_ringback == "${rs-ring}") then - ring_group_ringback = "tone_stream://%(1000,4000,425.0,0.0);loops=-1"; - end - if (ring_group_ringback == "${it-ring}") then - ring_group_ringback = "tone_stream://%(1000,4000,425.0,0.0);loops=-1"; - end - if (ring_group_ringback == "") then - ring_group_ringback = "local_stream://default"; - end + ring_group_ringback = format_ringback(ring_group_ringback); session:setVariable("ringback", ring_group_ringback); session:setVariable("transfer_ringback", ring_group_ringback); diff --git a/resources/install/scripts/directory.lua b/resources/install/scripts/directory.lua index 7232974912..f0f6ab8ac2 100644 --- a/resources/install/scripts/directory.lua +++ b/resources/install/scripts/directory.lua @@ -40,6 +40,9 @@ require "resources.functions.database_handle"; dbh = database_handle('system'); +--include functions + require "resources.functions.format_ringback" + --settings require "resources.functions.settings"; settings = settings(domain_uuid); @@ -88,40 +91,14 @@ if (not default_dialect) then default_dialect = 'us'; end if (not default_voice) then default_voice = 'callie'; end + --set ringback + directory_ringback = format_ringback(session:getVariable("ringback")); + session:setVariable("ringback", directory_ringback); + session:setVariable("transfer_ringback", directory_ringback); + --set the sounds path for the language, dialect and voice - ringback = session:getVariable("ringback"); - if (ringback) then - ringback = ringback:gsub("$", ""); - ringback = ringback:gsub("{", ""); - ringback = ringback:gsub("}", ""); - end session:setVariable("instant_ringback", "true"); session:setVariable("ignore_early_media", "true"); - if (not ringback) then - session:execute("set", "ringback=local_stream://default"); --set to ringtone - session:execute("set", "transfer_ringback=local_stream://default"); --set to ringtone - elseif (ringback == "uk-ring") then - session:setVariable("ringback", "%(400,200,400,450);%(400,2200,400,450)"); - session:setVariable("transfer_ringback", "%(400,200,400,450);%(400,2200,400,450)"); - elseif (ringback == "us-ring") then - session:setVariable("ringback", "%(2000, 4000, 440.0, 480.0)"); - session:setVariable("transfer_ringback", "%(2000, 4000, 440.0, 480.0)"); - elseif (ringback == "pt-ring") then - session:setVariable("ringback", "%(1000, 5000, 400.0, 0.0)"); - session:setVariable("transfer_ringback", "%(1000, 5000, 400.0, 0.0)"); - elseif (ringback == "fr-ring") then - session:setVariable("ringback", "%(1500, 3500, 440.0, 0.0)"); - session:setVariable("transfer_ringback", "%(1500, 3500, 440.0, 0.0)"); - elseif (ringback == "rs-ring") then - session:setVariable("ringback", "%(1000, 4000, 425.0, 0.0)"); - session:setVariable("transfer_ringback", "%(1000, 4000, 425.0, 0.0)"); - elseif (ringback == "it-ring") then - session:setVariable("ringback", "%(1000, 4000, 425.0, 0.0)"); - session:setVariable("transfer_ringback", "%(1000, 4000, 425.0, 0.0)"); - else - session:execute("set", "ringback=local_stream://default"); --set to ringtone - session:execute("set", "transfer_ringback=local_stream://default"); --set to ringtone - end --define the sounds directory sounds_dir = session:getVariable("sounds_dir"); diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 24418d531e..6e9bc487c8 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -38,6 +38,9 @@ require "resources.functions.database_handle"; dbh = database_handle('system'); +--include functions + require "resources.functions.format_ringback" + --get the variables domain_name = session:getVariable("domain_name"); context = session:getVariable("context"); @@ -135,27 +138,7 @@ end --set ringback - if (ivr_menu_ringback == "${uk-ring}") then - ivr_menu_ringback = "tone_stream://%(400,200,400,450);%(400,2200,400,450);loops=-1"; - end - if (ivr_menu_ringback == "${us-ring}") then - ivr_menu_ringback = "tone_stream://%(2000,4000,440.0,480.0);loops=-1"; - end - if (ivr_menu_ringback == "${pt-ring}") then - ivr_menu_ringback = "tone_stream://%(1000,5000,400.0,0.0);loops=-1"; - end - if (ivr_menu_ringback == "${fr-ring}") then - ivr_menu_ringback = "tone_stream://%(1500,3500,440.0,0.0);loops=-1"; - end - if (ivr_menu_ringback == "${rs-ring}") then - ivr_menu_ringback = "tone_stream://%(1000,4000,425.0,0.0);loops=-1"; - end - if (ivr_menu_ringback == "${it-ring}") then - ivr_menu_ringback = "tone_stream://%(1000,4000,425.0,0.0);loops=-1"; - end - if (ivr_menu_ringback == nil or ivr_menu_ringback == "") then - ivr_menu_ringback = "local_stream://default"; - end + ivr_menu_ringback = format_ringback(ivr_menu_ringback); session:setVariable("ringback", ivr_menu_ringback); session:setVariable("transfer_ringback", ivr_menu_ringback); diff --git a/resources/install/scripts/resources/functions/format_ringback.lua b/resources/install/scripts/resources/functions/format_ringback.lua new file mode 100644 index 0000000000..832a6d625a --- /dev/null +++ b/resources/install/scripts/resources/functions/format_ringback.lua @@ -0,0 +1,22 @@ + +--add the format_ringback function + function format_ringback ( ringback ) + if (ringback == "default_ringback") then + --fetch the default_ringback + ringback = session:getVariable("ringback"); + end + if (ringback:match("%${.*}")) then + ringback = ringback:gsub("%${", ""); + ringback = ringback:gsub("}", ""); + ringback = session:getVariable(ringback); + if (ringback == "") then + --fallback to us-ring + ringback = session:getVariable("us-ring"); + end + --convert to tone_stream + ringback = "tone_stream://" .. ringback .. ";loops=-1"; + elseif (ringback == "") then + ringback = session:getVariable(hold_music); + end + return ringback; + end \ No newline at end of file From e27ecec3108176dafc61d8e982cfa4474c7b86e5 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 28 Jan 2016 19:42:39 -0700 Subject: [PATCH 16/33] Change spandsp.conf.xml use-ecm from true to false. --- resources/templates/conf/autoload_configs/spandsp.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/templates/conf/autoload_configs/spandsp.conf.xml b/resources/templates/conf/autoload_configs/spandsp.conf.xml index 6f062cc731..9306c46c5c 100644 --- a/resources/templates/conf/autoload_configs/spandsp.conf.xml +++ b/resources/templates/conf/autoload_configs/spandsp.conf.xml @@ -24,7 +24,7 @@ - + From b573f65410273da5e7bef636ea6f7b5a470f0a77 Mon Sep 17 00:00:00 2001 From: mafoo Date: Fri, 29 Jan 2016 11:26:21 +0000 Subject: [PATCH 17/33] converted callcenter to use common function --- .../scripts/configuration/callcenter.conf.lua | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua index 9806d6a76d..a7169c70ab 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua @@ -24,6 +24,9 @@ -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. +--include functions + require "resources.functions.format_ringback" + --get the cache hostname = trim(api:execute("switchname", "")); if (trim(api:execute("module_exists", "mod_memcache")) == "true") then @@ -95,25 +98,9 @@ table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); - if (string.len(queue_moh_sound) == 0) then - table.insert(xml, [[ ]]); - else - if (string.sub(queue_moh_sound, 0, 14) == 'tone_stream://' or string.sub(queue_moh_sound, 0, 2) == '${') then - --given this string --tone_stream://${us-ring};loops=-1 --return us-ring - a, b, tone_string = string.find(queue_moh_sound, ".*{(.*)}.*"); - if (tone_string ~= nil) then - tone_string = trim(api:execute("global_getvar", tone_string)); - table.insert(xml, [[ ]]); - end - elseif (string.sub(queue_moh_sound, 0, 15) == 'local_stream://') then - table.insert(xml, [[ ]]); - else - if (queue_moh_sound == nil or queue_moh_sound == "") then - queue_moh_sound = "local_stream://default"; - end - table.insert(xml, [[ ]]); - end - end + --set ringback + queue_ringback = format_ringback(queue_moh_sound); + table.insert(xml, [[ ]]); if (queue_record_template ~= nil) then table.insert(xml, [[ ]]); end From bbc49caacc77f30f387001039d5599e1f09a3a7b Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 10:31:44 -0700 Subject: [PATCH 18/33] Improve the key handling in the Mitel. --- .../provision/mitel/5324/MN_{$mac}.cfg | 41 ++++++++----------- .../provision/mitel/5340/MN_{$mac}.cfg | 41 ++++++++----------- 2 files changed, 34 insertions(+), 48 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 032e4ac9b0..785286ce3a 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -267,30 +267,23 @@ 0 0 - - - - - - - - - - - - - - - - - - - - - - - - + + {foreach $keys as $row} + #Configure Line Key {$row.device_key_id} + {if $row.device_key_category == "line"} + {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} + {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} + {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} + {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} + {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} + {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} + {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} + {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} + + {/else} + + {/if} + {/foreach} 1 diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 0cc9e1d55b..4d937002c9 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -267,30 +267,23 @@ 0 0 - - - - - - - - - - - - - - - - - - - - - - - - + + {foreach $keys as $row} + #Configure Line Key {$row.device_key_id} + {if $row.device_key_category == "line"} + {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} + {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} + {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} + {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} + {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} + {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} + {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} + {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} + + {/else} + + {/if} + {/foreach} 1 From 861153fb057947a4e6714bf240e101020f7ed3e3 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 10:34:18 -0700 Subject: [PATCH 19/33] Add Mitel 5330 provisioning templates. --- .../provision/mitel/5330/MN_Generic.cfg | 12 + .../provision/mitel/5330/MN_{$mac}.cfg | 358 ++++++++++++++++++ 2 files changed, 370 insertions(+) create mode 100644 resources/templates/provision/mitel/5330/MN_Generic.cfg create mode 100644 resources/templates/provision/mitel/5330/MN_{$mac}.cfg diff --git a/resources/templates/provision/mitel/5330/MN_Generic.cfg b/resources/templates/provision/mitel/5330/MN_Generic.cfg new file mode 100644 index 0000000000..5a3c0ee683 --- /dev/null +++ b/resources/templates/provision/mitel/5330/MN_Generic.cfg @@ -0,0 +1,12 @@ + + 2 + {$domain_name}/app/provision + + + 2 + {$domain_name}/app/provision + + + 2 + {$domain_name}/app/provision + \ No newline at end of file diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg new file mode 100644 index 0000000000..4d937002c9 --- /dev/null +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -0,0 +1,358 @@ + + 1 + {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2 + {/if}0 + 1 + 02.00.00.24 + R7.2.02.00.00.24 + 0 + 0 + 0 + 5060 + 0 + -1 + {if isset($mitel_vlan_id)}{$mitel_vlan_id}{else}-1 + {/if}sip1 + -example.com + 0 + 0 + operator@example.com + 0 + + + + + + + + 1 + 12 + 1 + 1 + 0 + 1 + + 135.199.77.12 + 135.199.77.12 + 128.138.141.172 + {$mitel_time_zone} + 2 + 120 + + 0.0.0.0 + 5060 + 5 + 20 + 0 + 0 + 101 + 0 + 0 + + 0 + 0 + 10 + + 1 + 60 + 0 + + ****** + 0 + 0 + 0 + 0 + admin + Administrator + 510731ac096ebcb3989fb1ed5b7075bb + 0 + + 0 + + 0 + 0 + 4 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 80 + 443 + 1 + 4 + 1 + 0 + 0 + + 0 + 213.192.59.75 + + 0 + 20000 + 20998 + 0 + 0 + 3 + 0 + en_US + US + 1 + 3 + 2 + 1 + 11 + 1 + 1 + 2 + 201 + {$domain_name}/app/provision + + 1 + + 0 + 3 + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + {foreach $keys as $row} + #Configure Line Key {$row.device_key_id} + {if $row.device_key_category == "line"} + {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} + {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} + {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} + {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} + {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} + {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} + {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} + {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} + + {/else} + + {/if} + {/foreach} + + + 1 + 1 + 1 + 1 + 1 + 0 + ****** + 1440 + 1 + 1440 + 23 + 59 + 1 + + 5d41402abc4b2a76b9719d911017c592 + + + sip + {$voicemail_number} + 1 + + 90 + + {foreach $lines as $row} + + + {/foreach} + + + + + 7.2 + \ No newline at end of file From b8c0c5f2dc1cf0f7cdb074978ef423ddb9f8d012 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 10:53:36 -0700 Subject: [PATCH 20/33] Fix the syntax for the Mitel template. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 2 +- resources/templates/provision/mitel/5330/MN_{$mac}.cfg | 2 +- resources/templates/provision/mitel/5340/MN_{$mac}.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 785286ce3a..037ecc6716 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -280,7 +280,7 @@ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - {/else} + {/if}{if $row.device_key_category != "line"} {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg index 4d937002c9..3f0fa7336a 100644 --- a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -280,7 +280,7 @@ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - {/else} + {/if}{if $row.device_key_category != "line"} {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 4d937002c9..3f0fa7336a 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -280,7 +280,7 @@ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - {/else} + {/if}{if $row.device_key_category != "line"} {/if} {/foreach} From 147bb801fe58be5e007feb8d27ebcfedd184a94a Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 11:05:05 -0700 Subject: [PATCH 21/33] Update the Mitel template for Key Line use the key_id instead of key_line. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5330/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5340/MN_{$mac}.cfg | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 037ecc6716..629067dc12 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -279,9 +279,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - + {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg index 3f0fa7336a..42c0038ccb 100644 --- a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -279,9 +279,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - + {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 3f0fa7336a..42c0038ccb 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -279,9 +279,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - + {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} From 73d2360b8acb44d0f248f018bac44c0bd0fd10ee Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 11:14:49 -0700 Subject: [PATCH 22/33] Remove the indentation on the Mitel key assignments so the resulting provisioning file is easier to read. --- .../provision/mitel/5324/MN_{$mac}.cfg | 34 +++++++++---------- .../provision/mitel/5330/MN_{$mac}.cfg | 34 +++++++++---------- .../provision/mitel/5340/MN_{$mac}.cfg | 34 +++++++++---------- 3 files changed, 48 insertions(+), 54 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 629067dc12..408392c88f 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -266,24 +266,22 @@ 0 0 - - - {foreach $keys as $row} - #Configure Line Key {$row.device_key_id} - {if $row.device_key_category == "line"} - {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} - {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} - {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} - {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} - {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} - {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} - {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} - {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - - {/if}{if $row.device_key_category != "line"} - - {/if} - {/foreach} + +{foreach $keys as $row} +{if $row.device_key_category == "line"} +{if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} +{if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} +{if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} +{if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} +{if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} +{if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} +{if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} +{if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} + +{/if}{if $row.device_key_category != "line"} + +{/if} +{/foreach} 1 diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg index 42c0038ccb..568abfdc9d 100644 --- a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -266,24 +266,22 @@ 0 0 - - - {foreach $keys as $row} - #Configure Line Key {$row.device_key_id} - {if $row.device_key_category == "line"} - {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} - {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} - {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} - {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} - {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} - {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} - {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} - {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - - {/if}{if $row.device_key_category != "line"} - - {/if} - {/foreach} + +{foreach $keys as $row} +{if $row.device_key_category == "line"} +{if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} +{if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} +{if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} +{if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} +{if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} +{if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} +{if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} +{if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} + +{/if}{if $row.device_key_category != "line"} + +{/if} +{/foreach} 1 diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 42c0038ccb..568abfdc9d 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -266,24 +266,22 @@ 0 0 - - - {foreach $keys as $row} - #Configure Line Key {$row.device_key_id} - {if $row.device_key_category == "line"} - {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} - {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} - {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} - {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} - {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} - {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} - {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} - {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - - {/if}{if $row.device_key_category != "line"} - - {/if} - {/foreach} + +{foreach $keys as $row} +{if $row.device_key_category == "line"} +{if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} +{if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} +{if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} +{if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if} +{if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if} +{if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} +{if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} +{if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} + +{/if}{if $row.device_key_category != "line"} + +{/if} +{/foreach} 1 From 0f420f275fae8f0db8f1107b4ff61b47ef3c78cd Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 11:34:10 -0700 Subject: [PATCH 23/33] Mitel Provisioning add a value for 'Addr' --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5330/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5340/MN_{$mac}.cfg | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 408392c88f..576deae622 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -277,9 +277,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - + {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg index 568abfdc9d..e25d196638 100644 --- a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -277,9 +277,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - + {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 568abfdc9d..e25d196638 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -277,9 +277,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} - + {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} From 6b2949e9b2e992bb0fbf32b788dad82b18e69a0b Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 12:04:37 -0700 Subject: [PATCH 24/33] Fix the Mitel key type. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 2 +- resources/templates/provision/mitel/5330/MN_{$mac}.cfg | 2 +- resources/templates/provision/mitel/5340/MN_{$mac}.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 576deae622..301b8f176a 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -279,7 +279,7 @@ {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg index e25d196638..73489e7aa4 100644 --- a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -279,7 +279,7 @@ {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index e25d196638..73489e7aa4 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -279,7 +279,7 @@ {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} {/if}{if $row.device_key_category != "line"} - + {/if} {/foreach} From b61cf0cff7a89d3142caf9c63fc39f24f0f625f1 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 12:10:55 -0700 Subject: [PATCH 25/33] More work on the Mitel key handling. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5330/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5340/MN_{$mac}.cfg | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 301b8f176a..d6a28f2e81 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -268,7 +268,7 @@ 0 {foreach $keys as $row} -{if $row.device_key_category == "line"} +{if $row.device_key_type == "6"} {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} @@ -278,7 +278,7 @@ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} -{/if}{if $row.device_key_category != "line"} +{/if}{if $row.device_key_type != "6"} {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg index 73489e7aa4..0c585c1d81 100644 --- a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -268,7 +268,7 @@ 0 {foreach $keys as $row} -{if $row.device_key_category == "line"} +{if $row.device_key_type == "6"} {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} @@ -278,7 +278,7 @@ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} -{/if}{if $row.device_key_category != "line"} +{/if}{if $row.device_key_type != "6"} {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 73489e7aa4..0c585c1d81 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -268,7 +268,7 @@ 0 {foreach $keys as $row} -{if $row.device_key_category == "line"} +{if $row.device_key_type == "6"} {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} @@ -278,7 +278,7 @@ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} -{/if}{if $row.device_key_category != "line"} +{/if}{if $row.device_key_type != "6"} {/if} {/foreach} From df78108b18aa23a224f7ca643780a674479d52b9 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 13:45:25 -0700 Subject: [PATCH 26/33] Mitel provisioning ensure the user_id is set for all keys. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5330/MN_{$mac}.cfg | 4 ++-- resources/templates/provision/mitel/5340/MN_{$mac}.cfg | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index d6a28f2e81..1d568b2548 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -268,7 +268,6 @@ 0 {foreach $keys as $row} -{if $row.device_key_type == "6"} {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} @@ -277,8 +276,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} +{if $row.device_key_type == "6"} -{/if}{if $row.device_key_type != "6"} +{else} {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg index 0c585c1d81..bd9647783d 100644 --- a/resources/templates/provision/mitel/5330/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5330/MN_{$mac}.cfg @@ -268,7 +268,6 @@ 0 {foreach $keys as $row} -{if $row.device_key_type == "6"} {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} @@ -277,8 +276,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} +{if $row.device_key_type == "6"} -{/if}{if $row.device_key_type != "6"} +{else} {/if} {/foreach} diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 0c585c1d81..1d568b2548 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -1,4 +1,4 @@ - + 1 {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2 {/if}0 @@ -268,7 +268,6 @@ 0 {foreach $keys as $row} -{if $row.device_key_type == "6"} {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if} {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if} {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if} @@ -277,8 +276,9 @@ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if} {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if} {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if} +{if $row.device_key_type == "6"} -{/if}{if $row.device_key_type != "6"} +{else} {/if} {/foreach} From 167e3061aafff662189cefde30115c7b872333e2 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 29 Jan 2016 16:02:32 -0700 Subject: [PATCH 27/33] Add polycom_digitmap variable for Polycom variable for provisioning. --- resources/templates/provision/polycom/4.x/{$mac}.cfg | 2 +- resources/templates/provision/polycom/5.x/{$mac}.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/polycom/4.x/{$mac}.cfg b/resources/templates/provision/polycom/4.x/{$mac}.cfg index c8f8e4a624..5501ca8a29 100644 --- a/resources/templates/provision/polycom/4.x/{$mac}.cfg +++ b/resources/templates/provision/polycom/4.x/{$mac}.cfg @@ -49,7 +49,7 @@ tcpIpApp.sntp.daylightSavings.stop.dayOfWeek.lastInMonth="0" /> Date: Sun, 31 Jan 2016 10:10:08 -0700 Subject: [PATCH 28/33] LUA function format_ringback the session:getVariable must have quotes around the 'hold_music' string. Next check to see if the ringback is nil or an empty string first before trying to use 'match'. --- .../resources/functions/format_ringback.lua | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/resources/install/scripts/resources/functions/format_ringback.lua b/resources/install/scripts/resources/functions/format_ringback.lua index 832a6d625a..032b666cb6 100644 --- a/resources/install/scripts/resources/functions/format_ringback.lua +++ b/resources/install/scripts/resources/functions/format_ringback.lua @@ -1,22 +1,21 @@ --add the format_ringback function - function format_ringback ( ringback ) - if (ringback == "default_ringback") then - --fetch the default_ringback - ringback = session:getVariable("ringback"); - end - if (ringback:match("%${.*}")) then - ringback = ringback:gsub("%${", ""); - ringback = ringback:gsub("}", ""); - ringback = session:getVariable(ringback); - if (ringback == "") then + function format_ringback (ringback) + if (ringback == nil or ringback == "") then + --get the default ring back + ringback = session:getVariable("hold_music"); + elseif (ringback:match("%${.*}")) then + --strip the ${ and } + ringback = ringback:gsub("%${", ""); + ringback = ringback:gsub("}", ""); + --get the ringback variable + ringback = session:getVariable(ringback); --fallback to us-ring - ringback = session:getVariable("us-ring"); - end + if (ringback == "") then + ringback = session:getVariable("us-ring"); + end --convert to tone_stream - ringback = "tone_stream://" .. ringback .. ";loops=-1"; - elseif (ringback == "") then - ringback = session:getVariable(hold_music); + ringback = "tone_stream://" .. ringback .. ";loops=-1"; end return ringback; end \ No newline at end of file From 1a0301f6f73c101c94aac0056967bc4aeaa6a973 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 1 Feb 2016 11:16:23 -0700 Subject: [PATCH 29/33] Call center used with xml handler does not have access to the session. Remove session and replace it with api global_getvar as session is not always available. --- .../resources/functions/format_ringback.lua | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/resources/install/scripts/resources/functions/format_ringback.lua b/resources/install/scripts/resources/functions/format_ringback.lua index 032b666cb6..83dcc95547 100644 --- a/resources/install/scripts/resources/functions/format_ringback.lua +++ b/resources/install/scripts/resources/functions/format_ringback.lua @@ -1,21 +1,26 @@ --add the format_ringback function - function format_ringback (ringback) - if (ringback == nil or ringback == "") then - --get the default ring back - ringback = session:getVariable("hold_music"); - elseif (ringback:match("%${.*}")) then - --strip the ${ and } - ringback = ringback:gsub("%${", ""); - ringback = ringback:gsub("}", ""); - --get the ringback variable - ringback = session:getVariable(ringback); - --fallback to us-ring - if (ringback == "") then - ringback = session:getVariable("us-ring"); - end - --convert to tone_stream - ringback = "tone_stream://" .. ringback .. ";loops=-1"; - end + function format_ringback (ringback) + --include trim + require "resources.functions.trim"; + --prepare the api object + api = freeswitch.API(); + --handle ringback + if (ringback == nil or ringback == "") then + --get the default ring back + ringback = trim(api:execute("global_getvar", "hold_music")); + elseif (ringback:match("%${.*}")) then + --strip the ${ and } + ringback = ringback:gsub("%${", ""); + ringback = ringback:gsub("}", ""); + --get the ringback variable + ringback = trim(api:execute("global_getvar", ringback)); + --fallback to us-ring + if (ringback == "") then + ringback = trim(api:execute("global_getvar", "us-ring")); + end + --convert to tone_stream + ringback = "tone_stream://" .. ringback .. ";loops=-1"; + end return ringback; end \ No newline at end of file From 05188ffd24810d0110bcff25cb605f5ea9456050 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 2 Feb 2016 19:54:23 +0300 Subject: [PATCH 30/33] Fix. cache.support always returns `false` --- .../install/scripts/resources/functions/cache.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/install/scripts/resources/functions/cache.lua b/resources/install/scripts/resources/functions/cache.lua index 6d121eb995..a110927e85 100644 --- a/resources/install/scripts/resources/functions/cache.lua +++ b/resources/install/scripts/resources/functions/cache.lua @@ -9,11 +9,15 @@ require "resources.functions.trim"; local api = api -if (not api) and freeswitch then api = freeswitch.API() else -api = {} -function api:execute() - return '-ERR UNSUPPORTTED' -end +if not api then + if freeswitch then + api = freeswitch.API() + else + api = {} + function api:execute() + return '-ERR UNSUPPORTTED' + end + end end local function send_event(action, key) From f91735367e1e391d9211978ebc645abd5e9453c3 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 3 Feb 2016 10:28:12 +0300 Subject: [PATCH 31/33] Fix. Save instead of empty value path to recordings for some sound options. --- app/ivr_menus/ivr_menu_edit.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 2c4dcec7f5..5115b5502f 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -498,7 +498,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { */ //select if (if_group("superadmin")) { - if (!$tmp_selected) { + if (!$tmp_selected && strlen($ivr_menu_greet_long) > 0) { echo "\n"; if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_long)) { echo " \n"; @@ -933,7 +933,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //select if (if_group("superadmin")) { - if (!$tmp_selected) { + if (!$tmp_selected && strlen($ivr_menu_invalid_sound) > 0) { echo "\n"; if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_invalid_sound)) { echo " \n"; @@ -1029,7 +1029,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //select if (if_group("superadmin")) { - if (!$tmp_selected) { + if (!$tmp_selected && strlen($ivr_menu_exit_sound) > 0) { echo "\n"; if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_exit_sound)) { echo " \n"; From a1170e1396eac23992ce9ab086f9a1d14f3f699a Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 3 Feb 2016 15:20:50 +0300 Subject: [PATCH 32/33] Fix. Use domain name in streamfile.lua. Fix. Unset input callback after play file done. --- resources/install/scripts/streamfile.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/install/scripts/streamfile.lua b/resources/install/scripts/streamfile.lua index 576fd46a29..772167210a 100644 --- a/resources/install/scripts/streamfile.lua +++ b/resources/install/scripts/streamfile.lua @@ -54,9 +54,7 @@ end --set the recordings directory - if (domain_count > 1) then - recordings_dir = recordings_dir .. "/"..domain_name; - end + recordings_dir = recordings_dir .. "/"..domain_name; --check if a file exists require "resources.functions.file_exists"; @@ -139,6 +137,7 @@ end session:setInputCallback("on_dtmf", ""); session:streamFile(file_name); + session:unsetInputCallback(); end --if base64, remove temp file (increases responsiveness when files remain local) From 22fe132900be7e0e4c6dee1bbbf8df267d39020f Mon Sep 17 00:00:00 2001 From: mafoo Date: Wed, 3 Feb 2016 15:08:28 +0000 Subject: [PATCH 33/33] Fix for phrases are actually phrase_uuid not phrase_name.domain_uuid --- app/conference_centers/conference_center_edit.php | 2 +- app/fax/fax_edit.php | 2 +- app/ivr_menus/ivr_menu_edit.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index 0c1de57247..57f8ec6373 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -365,7 +365,7 @@ else { echo "\n"; foreach ($result as &$row) { $selected = ($conference_center_greeting == "phrase:".$row["phrase_name"].".".$domain_uuid) ? true : false; - echo " \n"; + echo " \n"; if ($selected) { $tmp_selected = true; } } unset ($prep_statement); diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index f4fd232a3c..21cdd7f925 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -745,7 +745,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; foreach ($result as &$row) { $selected = ($fax_send_greeting == "phrase:".$row["phrase_name"].".".$domain_uuid) ? true : false; - echo " \n"; + echo " \n"; if ($selected) { $tmp_selected = true; } } unset ($prep_statement); diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 2c4dcec7f5..c7d77a6499 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -562,10 +562,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($result as &$row) { if ($ivr_menu_greet_short == "phrase:".$row["phrase_name"].".".$domain_uuid) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else { - echo " \n"; + echo " \n"; } } echo "\n"; @@ -901,10 +901,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($result as &$row) { if ($ivr_menu_invalid_sound == "phrase:".$row["phrase_name"].".".$domain_uuid) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else { - echo " \n"; + echo " \n"; } } unset ($prep_statement); @@ -997,10 +997,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($result as &$row) { if ($ivr_menu_exit_sound == "phrase:".$row["phrase_name"].".".$domain_uuid) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else { - echo " \n"; + echo " \n"; } } unset ($prep_statement);