mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Update boolean toggle and the database boolean type (#7522)
* Change the data type to boolean
* Use boolean values in SQL and Conditional Statements
* Schema Data Types: Drop views so that alter tables statements complete
* Update settings.php
* Add extension for call_screen_enabled
* Gateway handle boolean
Add the boolean toggle
- distinct_to
- caller_id_in_from
- supress_cng
- extension_in_contact
- contact_in_ping
* Update gateways.php
* Update voicemail_edit.php
* Replace the ${caller_id_name} with the extensions caller id name
* Phrase - Edit: Update slide toggle with new select beneath.
* Update the input toggle style
* Set the input_toggle_style_switch as boolean
* Update the input toggle style
* Theme: Adjust CSS to wrap description text on form fields.
* Add domain_uuid and domain_name to the SQL SELECT
* Unset the parameters to fix the next query
* Gateway: Integrate new slide toggle switch.
* Dashboard: Update the input toggle style (#7499)
* Dashboard: Update the input toggle style
* Update dashboard_widget_edit.php
* Update dashboard_edit.php
* Inbound Route - Add: Integrate new slide toggle switch and boolean.
* User Settings: Integrate new slide toggle switch.
* Call Block Edit: Update the input toggle style (#7500)
* Bridge Edit: Update the input toggle style (#7501)
* Update phrases.php
* Update domain_edit.php
* Domain Settings Edit: Update the input toggle style
* User Edit: Update the input toggle style
* Update install.php
* Remove fields marked as deprecated
* Use boolean in the select statement
* Streams: New slide toggle and boolean.
* Streams: Remove unnecessary default.
* Queues (FIFO): New slide toggle.
* Call Detail Records: Update the input toggle style (#7503)
* Call Detail Records: Update the input toggle style
* Update xml_cdr_extension_summary.php
* Update xml_cdr_extension_summary.php
* Update xml_cdr_extension_summary.php
* Call Centers: Update the input toggle style (#7502)
* Call Centers: Update the input toggle style
* Update call_center_agent_edit.php
* Conference Centers: Update the input toggle style (#7506)
* Conference Centers: Update the input toggle style
* Update app_config.php
* Update conference_center_edit.php
* Use boolean data type (#7505)
* Call Flow Edit: Update the input toggle style (#7504)
* Devices: Update the input toggle style
* IVR Menus: New slide toggle.
* IVR Menu: Remove deprected file.
* SIP Profile - Edit: New slide toggle.
* Device Profiles: Update the input toggle style
* Ring Groups - List: Fix syntax.
* Theme: Fire onchange event when switching slide toggle control.
* Device Vendors: Update the input toggle style
* Update enabled boolean
* Update device_edit.php
* Ring Groups: New slide toggle.
* Update domain_edit.php
* Email Templates: Update the input toggle style
* Header: Correct default value on input toggle style.
* Default/Domain/User Settings: Adjust Select option label for better clarity.
* Use true boolean types for switch theme toggle or drop-down box (#7507)
* Groups: Update the input toggle style
* Conference Controls: Update the input toggle style (#7509)
* Conference Controls: Update the input toggle style
* Update conference_control_edit.php
* Update conference_control_details.php
* Update conference_control_detail_edit.php
* Conferences: Update the input toggle style (#7511)
* Use true boolean types for switch theme toggle or drop-down box (#7513)
* Dialplans: Update the input toggle style
Also updated outbound route add
* Ring Group: Only adjust ring group forward destination top margin when slide toggle enabled.
* Default/Domain/User Settings - List: Adjust for new 'Select Box' label on input_toggle_style value.
* Use true boolean types for switch theme toggle or drop-down box (#7514)
* Call Forward / Follow Me: Minor javascript adjustments to mirror previous behavior.
* Ring Groups [Dashboard]: New slide toggle.
* Get the contacts details with a seperate SQL Query
* Remove debug info
* Destinations: Update the input toggle style
* Conference Profiles: Update the input toggle style (#7515)
* Conference Profiles: Update the input toggle style
* Update conference_profiles.php
* Update conference_profile_params.php
* Update conference_profile_param_edit.php
* Update conference_profile_edit.php
* Extensions: Update the input toggle style
* Contacts: Update the input toggle style (#7517)
* Contacts: Update the input toggle style
* Update contact_address_edit.php
* Update contact_attachment_edit.php
* Update contact_edit.php
* Update contact_email_edit.php
* Update contact_phone_edit.php
* Update contact_relation_edit.php
* Update contact_setting_edit.php
* Update contact_url_edit.php
* Update contacts.php
* Voicemails: New slide toggle.
* Voicemail Greeting: New slide toggle.
* Modules: New slide toggle.
* Recordings: New slide toggle
* Variables: New slide toggle.
* Time Conditions: New slide toggle.
* Extensions - List: Remove invalid column name.
* Extension Settings: New slide toggle.
* Number Translations: New slide toggle and boolean.
* Sofia global settings: Update the input toggle style
* Update alter table convert to boolean
* Fix contact relation search (#7518)
* Sip Profile Edit: Fix setting enabled labels (#7519)
* Sip Profile Edit: Fix setting enabled labels
* Update sip_profile_edit.php
* Update dialplan_edit.php (#7520)
* Update SQL queries to use true/false for contact primary settings (#7521)
* Update SQL queries to use true/false for contact primary settings
* Update contacts_vcard.php
* Update email.php
* Update totp.php
* Update contact_url_edit.php
* Update contact_email_edit.php
* Update contact_address_edit.php
* Update contact_attachment_edit.php
* Update contact_phone_edit.php
* Add a database views method
* Add database view groups
* Add database users view
* Add database call_recordings view
* Update users.php
* Add database view call block
* Update schema to use the database views method
* Update conference.conf.lua boolean
* Update directory.lua boolean
* Update callcenter.conf.lua agent_status boolean
* Update sofia.conf.lua boolean
* Update number translations lua boolean
* Update directory.lua boolean
* Update group_call.lua fix the cache
* Update reverse-auth-lookup.lua boolean
* Update directory.lua boolean
* Use concat instead of ||
* Update index.lua
---------
Co-authored-by: fusionate <nate@fusionpbx.com>
Co-authored-by: Alex <alex@fusionpbx.com>
Co-authored-by: frytimo <tim@fusionpbx.com>
This commit is contained in:
@@ -100,7 +100,7 @@
|
||||
--check to see if the call should be blocked
|
||||
sql = "select * from v_call_block\n";
|
||||
sql = sql .. "where (domain_uuid = :domain_uuid or domain_uuid is null) \n";
|
||||
sql = sql .. "and call_block_enabled = 'true' \n";
|
||||
sql = sql .. "and call_block_enabled = true \n";
|
||||
sql = sql .. "and call_block_direction = :call_block_direction \n";
|
||||
sql = sql .. "and (call_block_name <> '' or call_block_number <> '') \n";
|
||||
sql = sql .. "and ( \n";
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
sql = sql .. " where domain_uuid = :domain_uuid ";
|
||||
sql = sql .. " and ( ";
|
||||
sql = sql .. " phone_number = :caller_id_number ";
|
||||
sql = sql .. " or phone_country_code || phone_number = :caller_id_number ";
|
||||
sql = sql .. " or '+' || phone_country_code || phone_number = :caller_id_number ";
|
||||
sql = sql .. " or concat(phone_country_code, phone_number) = :caller_id_number ";
|
||||
sql = sql .. " or concat('+', phone_country_code, phone_number) = :caller_id_number ";
|
||||
sql = sql .. " ) ";
|
||||
sql = sql .. "); ";
|
||||
local params = {caller_id_number = caller_id_number, domain_uuid = domain_uuid};
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
sql = sql .. "AND template_language = :template_language ";
|
||||
sql = sql .. "AND template_category = 'missed' "
|
||||
sql = sql .. "AND template_enabled = 'true' "
|
||||
sql = sql .. "AND template_enabled = true "
|
||||
sql = sql .. "ORDER BY domain_uuid DESC "
|
||||
local params = {domain_uuid = domain_uuid, template_language = default_language.."-"..default_dialect};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
sql = sql .. "AND template_language = :template_language ";
|
||||
sql = sql .. "AND template_category = 'missed' "
|
||||
sql = sql .. "AND template_enabled = 'true' "
|
||||
sql = sql .. "AND template_enabled = true "
|
||||
sql = sql .. "ORDER BY domain_uuid DESC "
|
||||
local params = {domain_uuid = domain_uuid, template_language = default_language.."-"..default_dialect};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
sql = sql .. " OR destination_number = :destination_number ";
|
||||
sql = sql .. ") ";
|
||||
sql = sql .. "AND destination_type = 'inbound' ";
|
||||
sql = sql .. "AND destination_enabled = 'true' ";
|
||||
sql = sql .. "AND destination_enabled = true ";
|
||||
local params = {destination_number = destination_number};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "SQL:" .. sql .. "; destination_number: " .. destination_number .. "\n");
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
end
|
||||
|
||||
--send the ring group event
|
||||
event = freeswitch.Event("CUSTOM", "RING_GROUPS");
|
||||
event = freeswitch.Event("CUSTOM", "RING_GROUPS");
|
||||
event:addHeader("domain_uuid", domain_uuid);
|
||||
event:addHeader("domain_name", domain_name);
|
||||
event:addHeader("ring_group_uuid", ring_group_uuid);
|
||||
@@ -227,9 +227,31 @@
|
||||
--get the ring group
|
||||
ring_group_forward_enabled = '';
|
||||
ring_group_forward_destination = '';
|
||||
sql = "SELECT d.domain_name, r.* FROM v_ring_groups as r, v_domains as d ";
|
||||
sql = sql .. "where r.ring_group_uuid = :ring_group_uuid ";
|
||||
sql = sql .. "and r.domain_uuid = d.domain_uuid ";
|
||||
sql = "SELECT d.domain_name, ";
|
||||
sql = sql .. "d.domain_uuid, ";
|
||||
sql = sql .. "d.domain_name, ";
|
||||
sql = sql .. "r.ring_group_name, ";
|
||||
sql = sql .. "r.ring_group_extension, ";
|
||||
sql = sql .. "r.ring_group_greeting, ";
|
||||
sql = sql .. "cast(r.ring_group_forward_enabled as text), ";
|
||||
sql = sql .. "r.ring_group_forward_destination, ";
|
||||
sql = sql .. "r.ring_group_forward_toll_allow, ";
|
||||
sql = sql .. "r.ring_group_timeout_app, ";
|
||||
sql = sql .. "r.ring_group_timeout_data, ";
|
||||
sql = sql .. "r.ring_group_exit_key, ";
|
||||
sql = sql .. "r.ring_group_call_timeout, ";
|
||||
sql = sql .. "r.ring_group_caller_id_name, ";
|
||||
sql = sql .. "r.ring_group_caller_id_number, ";
|
||||
sql = sql .. "r.ring_group_cid_name_prefix, ";
|
||||
sql = sql .. "r.ring_group_cid_number_prefix, ";
|
||||
sql = sql .. "cast(r.ring_group_call_screen_enabled as text), ";
|
||||
sql = sql .. "cast(r.ring_group_call_forward_enabled as text), ";
|
||||
sql = sql .. "cast(r.ring_group_follow_me_enabled as text), ";
|
||||
sql = sql .. "r.ring_group_missed_call_app, ";
|
||||
sql = sql .. "r.ring_group_missed_call_data ";
|
||||
sql = sql .. "FROM v_ring_groups as r, v_domains as d ";
|
||||
sql = sql .. "WHERE r.ring_group_uuid = :ring_group_uuid ";
|
||||
sql = sql .. "AND r.domain_uuid = d.domain_uuid ";
|
||||
local params = {ring_group_uuid = ring_group_uuid};
|
||||
status = dbh:query(sql, params, function(row)
|
||||
domain_uuid = row["domain_uuid"];
|
||||
@@ -438,7 +460,7 @@
|
||||
sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
sql = sql .. "AND template_language = :template_language ";
|
||||
sql = sql .. "AND template_category = 'missed' ";
|
||||
sql = sql .. "AND template_enabled = 'true' ";
|
||||
sql = sql .. "AND template_enabled = true ";
|
||||
sql = sql .. "ORDER BY domain_uuid DESC ";
|
||||
local params = {domain_uuid = domain_uuid, template_language = default_language.."-"..default_dialect};
|
||||
if (debug["sql"]) then
|
||||
@@ -533,7 +555,7 @@
|
||||
end
|
||||
|
||||
--process the ring group
|
||||
if (ring_group_forward_enabled == "true" and string.len(ring_group_forward_destination) > 0) then
|
||||
if (ring_group_forward_enabled == true and string.len(ring_group_forward_destination) > 0) then
|
||||
|
||||
--set the outbound caller id
|
||||
if (caller_is_local == 'true' and outbound_caller_id_name ~= nil) then
|
||||
@@ -578,11 +600,9 @@
|
||||
WHERE
|
||||
ring_group_uuid = :ring_group_uuid
|
||||
AND r.domain_uuid = :domain_uuid
|
||||
AND r.ring_group_enabled = 'true'
|
||||
AND r.ring_group_enabled = true
|
||||
]];
|
||||
|
||||
local params = {ring_group_uuid = ring_group_uuid, domain_uuid = domain_uuid};
|
||||
|
||||
dbh:query(sql, params, function(row)
|
||||
if (row.ring_group_strategy == "random") then
|
||||
if (database["type"] == "mysql") then
|
||||
@@ -590,11 +610,14 @@
|
||||
else
|
||||
sql_order = 'random() * 1000000' --both postgresql and sqlite uses random() instead of rand()
|
||||
end
|
||||
else
|
||||
sql_order='d.destination_delay, d.destination_number asc'
|
||||
end
|
||||
end);
|
||||
|
||||
--if the sql_order is not then set a default
|
||||
if (sql_order == nil) then
|
||||
sql_order = 'd.destination_delay, d.destination_number asc';
|
||||
end
|
||||
|
||||
--get the ring group destinations
|
||||
sql = [[
|
||||
SELECT
|
||||
@@ -615,8 +638,8 @@
|
||||
d.ring_group_uuid = r.ring_group_uuid
|
||||
AND d.ring_group_uuid = :ring_group_uuid
|
||||
AND r.domain_uuid = :domain_uuid
|
||||
AND r.ring_group_enabled = 'true'
|
||||
AND d.destination_enabled = 'true'
|
||||
AND r.ring_group_enabled = true
|
||||
AND d.destination_enabled = true
|
||||
ORDER BY
|
||||
]]..sql_order..[[
|
||||
]];
|
||||
@@ -639,7 +662,7 @@
|
||||
end
|
||||
|
||||
--follow the forwards
|
||||
if (ring_group_call_forward_enabled == "true") then
|
||||
if (ring_group_call_forward_enabled == true) then
|
||||
count, destination_number, toll_allow = get_forward_all(0, row.destination_number, leg_domain_name);
|
||||
else
|
||||
destination_number = row.destination_number;
|
||||
@@ -696,7 +719,7 @@
|
||||
---add follow me destinations
|
||||
for key, row in pairs(destinations) do
|
||||
|
||||
if (ring_group_follow_me_enabled == "true") then
|
||||
if (ring_group_follow_me_enabled == true) then
|
||||
cmd = "user_data ".. row.destination_number .."@" ..row.domain_name.." var follow_me_enabled";
|
||||
if (api:executeString(cmd) == "true") then
|
||||
|
||||
@@ -910,7 +933,7 @@
|
||||
user_exists = row.user_exists;
|
||||
|
||||
--follow the forwards
|
||||
if (row.ring_group_call_forward_enabled == "true") then
|
||||
if (row.ring_group_call_forward_enabled == true) then
|
||||
count, destination_number = get_forward_all(0, destination_number, leg_domain_name);
|
||||
end
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
if not session:ready() then return end
|
||||
|
||||
--search ring_group in database
|
||||
local sql = [[SELECT ring_group_uuid as uuid, ring_group_forward_enabled as forward_enabled,
|
||||
local sql = [[SELECT ring_group_uuid as uuid, cast(ring_group_forward_enabled as text) as forward_enabled,
|
||||
ring_group_forward_destination as forward_destination, ring_group_extension as extension
|
||||
FROM v_ring_groups
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
|
||||
@@ -185,12 +185,12 @@ function send_email(id, uuid)
|
||||
sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
sql = sql .. "AND template_language = :template_language ";
|
||||
sql = sql .. "AND template_category = 'voicemail' "
|
||||
if (voicemail_transcription_enabled == 'true') then
|
||||
if (voicemail_transcription_enabled) then
|
||||
sql = sql .. "AND template_subcategory = 'transcription' "
|
||||
else
|
||||
sql = sql .. "AND template_subcategory = 'default' "
|
||||
end
|
||||
sql = sql .. "AND template_enabled = 'true' "
|
||||
sql = sql .. "AND template_enabled = true "
|
||||
sql = sql .. "ORDER BY domain_uuid DESC "
|
||||
local params = {domain_uuid = domain_uuid, template_language = default_language.."-"..default_dialect};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
session:flushDigits();
|
||||
--update play tutorial in the datebase
|
||||
local sql = [[UPDATE v_voicemails
|
||||
set voicemail_tutorial = 'false'
|
||||
set voicemail_tutorial = false
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_id = :voicemail_id
|
||||
AND voicemail_enabled = 'true' ]];
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
end
|
||||
|
||||
--get the voicemail extension
|
||||
sql = "SELECT * FROM v_vars WHERE var_category = 'Defaults' AND var_name = 'vm_message_ext' AND var_enabled = 'true'";
|
||||
sql = "SELECT * FROM v_vars WHERE var_category = 'Defaults' AND var_name = 'vm_message_ext' AND var_enabled = true ";
|
||||
dbh:query(sql, function(row)
|
||||
vm_message_ext = row["var_value"];
|
||||
end);
|
||||
|
||||
@@ -103,8 +103,8 @@
|
||||
if (row.access_control_name == 'providers' or row.access_control_name == 'domains') then
|
||||
sql = "select domain_name, domain_description from v_domains ";
|
||||
sql = sql .. "where domain_uuid in (select distinct(domain_uuid) ";
|
||||
sql = sql .. "from v_extensions where enabled = 'true') ";
|
||||
sql = sql .. "and domain_enabled = 'true' ";
|
||||
sql = sql .. "from v_extensions where enabled = true) ";
|
||||
sql = sql .. "and domain_enabled = true ";
|
||||
local params = {}
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. ";\n");
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
--if you change this variable also change app/call_center/call_center_agent_edit.php
|
||||
confirm = ""..sound_prefix..",group_confirm_file=ivr/ivr-accept_reject_voicemail.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout="..agent_call_timeout;
|
||||
local record = "";
|
||||
if (agent_record == "true") then
|
||||
if (agent_record) then
|
||||
record = string.format(",execute_on_pre_bridge='record_session %s/%s/archive/${strftime(%%Y)}/${strftime(%%b)}/${strftime(%%d)}/${uuid}.${record_ext}'", recordings_dir, domain_name)
|
||||
end
|
||||
if (string.find(agent_contact, '}') == nil) then
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
--start the conference controls
|
||||
xml:append([[ <caller-controls>]]);
|
||||
sql = [[SELECT * FROM v_conference_controls
|
||||
WHERE control_enabled = 'true' ]];
|
||||
WHERE control_enabled = true ]];
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[conference_control] SQL: " .. sql .. "\n");
|
||||
end
|
||||
@@ -61,7 +61,7 @@
|
||||
--get the conference control details from the database
|
||||
sql = [[SELECT * FROM v_conference_control_details
|
||||
WHERE conference_control_uuid = :conference_control_uuid
|
||||
AND control_enabled = 'true' ]];
|
||||
AND control_enabled = true ]];
|
||||
local params = {conference_control_uuid = conference_control_uuid};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[conference_control] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
@@ -80,7 +80,7 @@
|
||||
--start the conference profiles
|
||||
xml:append([[ <profiles>]]);
|
||||
sql = [[SELECT * FROM v_conference_profiles
|
||||
WHERE profile_enabled = 'true' ]];
|
||||
WHERE profile_enabled = true ]];
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[conference_profiles] SQL: " .. sql .. "\n");
|
||||
end
|
||||
@@ -91,7 +91,7 @@
|
||||
--get the conference profile parameters from the database
|
||||
sql = [[SELECT * FROM v_conference_profile_params
|
||||
WHERE conference_profile_uuid = :conference_profile_uuid
|
||||
AND profile_param_enabled = 'true' ]];
|
||||
AND profile_param_enabled = true ]];
|
||||
local params = {conference_profile_uuid = conference_profile_uuid};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[conference_profiles] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
@@ -116,7 +116,7 @@
|
||||
freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: " .. XML_STRING .. "\n");
|
||||
end
|
||||
|
||||
--send the xml to the console
|
||||
--send the XML to the console
|
||||
if (debug["xml_string"]) then
|
||||
local file = assert(io.open(temp_dir .."/conference.conf.xml", "w"));
|
||||
file:write(XML_STRING);
|
||||
|
||||
@@ -80,12 +80,12 @@
|
||||
select *
|
||||
from v_ivr_menus
|
||||
where ivr_menu_uuid = :ivr_menu_uuid
|
||||
and ivr_menu_enabled = 'true'
|
||||
and ivr_menu_enabled = true
|
||||
union all
|
||||
select child.*
|
||||
from v_ivr_menus as child, ivr_menus as parent
|
||||
where child.ivr_menu_parent_uuid = parent.ivr_menu_uuid
|
||||
and child.ivr_menu_enabled = 'true'
|
||||
and child.ivr_menu_enabled = true
|
||||
)
|
||||
select * from ivr_menus
|
||||
]];
|
||||
@@ -273,7 +273,7 @@
|
||||
xml:append([[ >]]);
|
||||
|
||||
--get the ivr menu options
|
||||
local sql = [[ SELECT * FROM v_ivr_menu_options WHERE ivr_menu_uuid = :ivr_menu_uuid AND ivr_menu_option_enabled = 'true' ORDER BY ivr_menu_option_order asc ]];
|
||||
local sql = [[ SELECT * FROM v_ivr_menu_options WHERE ivr_menu_uuid = :ivr_menu_uuid AND ivr_menu_option_enabled = true ORDER BY ivr_menu_option_order asc ]];
|
||||
local params = {ivr_menu_uuid = ivr_menu_uuid};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
@@ -305,7 +305,7 @@
|
||||
end);
|
||||
|
||||
--direct dial
|
||||
if (ivr_menu_direct_dial == "true") then
|
||||
if (ivr_menu_direct_dial == true) then
|
||||
local negative_lookahead = "";
|
||||
if (#direct_dial_exclude > 0) then
|
||||
negative_lookahead = "(?!^("..table.concat(direct_dial_exclude, "|")..")$)";
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
--gt the global settings
|
||||
sql = "select * from v_sofia_global_settings ";
|
||||
sql = sql .. "where global_setting_enabled = 'true' ";
|
||||
sql = sql .. "where global_setting_enabled = true ";
|
||||
sql = sql .. "order by global_setting_name asc ";
|
||||
local params = {};
|
||||
x = 0;
|
||||
@@ -87,8 +87,8 @@
|
||||
--run the query
|
||||
sql = "select p.sip_profile_uuid, p.sip_profile_name, p.sip_profile_description, s.sip_profile_setting_name, s.sip_profile_setting_value ";
|
||||
sql = sql .. "from v_sip_profiles as p, v_sip_profile_settings as s ";
|
||||
sql = sql .. "where s.sip_profile_setting_enabled = 'true' ";
|
||||
sql = sql .. "and p.sip_profile_enabled = 'true' ";
|
||||
sql = sql .. "where s.sip_profile_setting_enabled = true ";
|
||||
sql = sql .. "and p.sip_profile_enabled = true ";
|
||||
sql = sql .. "and (p.sip_profile_hostname = :hostname or p.sip_profile_hostname is null or p.sip_profile_hostname = '') ";
|
||||
sql = sql .. "and p.sip_profile_uuid = s.sip_profile_uuid ";
|
||||
sql = sql .. "order by p.sip_profile_name asc ";
|
||||
@@ -119,9 +119,23 @@
|
||||
--xml:append([[ <X-PRE-PROCESS cmd="include" data="]] .. xml.sanitize(sip_profile_name) .. [[/*.xml"/>]]);
|
||||
|
||||
--get the gateways
|
||||
sql = "select * from v_gateways ";
|
||||
sql = "select ";
|
||||
sql = sql .. "gateway_uuid, domain_uuid, gateway, username, password, ";
|
||||
sql = sql .. "cast(distinct_to as text), auth_username, realm, from_user, from_domain, ";
|
||||
sql = sql .. "proxy, register_proxy,outbound_proxy,expire_seconds, ";
|
||||
sql = sql .. "register, register_transport, contact_params, retry_seconds, ";
|
||||
sql = sql .. "extension, ping, ping_min, ping_max, ";
|
||||
sql = sql .. "cast(contact_in_ping as text) , ";
|
||||
sql = sql .. "cast(caller_id_in_from as text), ";
|
||||
sql = sql .. "cast(supress_cng as text),
|
||||
sql = sql .. "sip_cid_type, codec_prefs, channels, ";
|
||||
sql = sql .. "cast(extension_in_contact as text), ";
|
||||
sql = sql .. "context, profile, hostname, ";
|
||||
sql = sql .. "cast(enabled as text), ";
|
||||
sql = sql .. "description ";
|
||||
sql = sql .. "from v_gateways ";
|
||||
sql = sql .. "where profile = :profile ";
|
||||
sql = sql .. "and enabled = 'true' ";
|
||||
sql = sql .. "and enabled = true ";
|
||||
sql = sql .. "and (hostname = :hostname or hostname is null or hostname = '') ";
|
||||
local params = {profile = sip_profile_name, hostname = hostname};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
--run the query
|
||||
sql = "select * from v_number_translations ";
|
||||
sql = sql .. "order by number_translation_name asc ";
|
||||
sql = sql .. "number_translation_enabled = true ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
||||
end
|
||||
@@ -136,7 +137,7 @@
|
||||
end
|
||||
end --if XML_STRING
|
||||
|
||||
--send the xml to the console
|
||||
--send the XML to the console
|
||||
if (debug["xml_string"]) then
|
||||
local file = assert(io.open(temp_dir .. "/translate.conf.xml", "w"));
|
||||
file:write(XML_STRING);
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
sql = sql .. " or (p.dialplan_context like '%public%' and p.domain_uuid IS NULL) ";
|
||||
sql = sql .. ") ";
|
||||
sql = sql .. "AND (p.hostname = :hostname OR p.hostname IS NULL) ";
|
||||
sql = sql .. "AND p.dialplan_enabled = 'true' ";
|
||||
sql = sql .. "AND p.dialplan_enabled = true ";
|
||||
sql = sql .. "ORDER BY p.dialplan_order ASC ";
|
||||
local params = {destination_number = destination_number, hostname = hostname};
|
||||
if (debug["sql"]) then
|
||||
@@ -252,7 +252,7 @@
|
||||
sql = sql .. "where p.dialplan_context in (:call_context, '${domain_name}', 'global') ";
|
||||
end
|
||||
sql = sql .. "and (p.hostname = :hostname or p.hostname is null) ";
|
||||
sql = sql .. "and p.dialplan_enabled = 'true' ";
|
||||
sql = sql .. "and p.dialplan_enabled = true ";
|
||||
sql = sql .. "order by p.dialplan_order asc ";
|
||||
local params = {call_context = call_context, hostname = hostname};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
--process when the sip profile is rescanned, sofia is reloaded, or sip redirect
|
||||
local sql = "SELECT * FROM v_domains as d, v_extensions as e "
|
||||
sql = sql .. "where d.domain_uuid = e.domain_uuid "
|
||||
sql = sql .. "and (e.directory_visible = 'true' or e.directory_exten_visible='true') "
|
||||
sql = sql .. "and (e.directory_visible = true or e.directory_exten_visible = true) "
|
||||
if domain_name then
|
||||
sql = sql .. "and d.domain_name = :domain_name "
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- xml_handler.lua
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2013 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Copyright (C) 2013 - 2025 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
@@ -28,14 +28,12 @@
|
||||
local Xml = require "resources.functions.xml";
|
||||
|
||||
--get the cache
|
||||
if (trim(api:execute("module_exists", "mod_memcache")) == "true") then
|
||||
XML_STRING = trim(api:execute("memcache", "get directory:groups:"..domain_name));
|
||||
else
|
||||
XML_STRING = "-ERR NOT FOUND";
|
||||
end
|
||||
local cache = require "resources.functions.cache"
|
||||
local directory_groups_key = "directory:groups:"..domain_name;
|
||||
XML_STRING, err = cache.get(directory_groups_key);
|
||||
|
||||
--set the cache
|
||||
if (XML_STRING == "-ERR NOT FOUND") then
|
||||
if not XML_STRING then
|
||||
--connect to the database
|
||||
local Database = require "resources.functions.database";
|
||||
local dbh = Database.new('system');
|
||||
@@ -74,6 +72,7 @@
|
||||
local sql = [[
|
||||
select * from v_extensions
|
||||
where domain_uuid = :domain_uuid
|
||||
enabled = true
|
||||
order by call_group asc
|
||||
]];
|
||||
local params = {domain_uuid = domain_uuid};
|
||||
@@ -140,11 +139,18 @@
|
||||
dbh:release();
|
||||
|
||||
--set the cache
|
||||
result = trim(api:execute("memcache", "set directory:groups:"..domain_name.." '"..XML_STRING:gsub("'", "'").."' "..expire["directory"]));
|
||||
local ok, err = cache.set(directory_groups_key, XML_STRING, expire["directory"]);
|
||||
if debug["cache"] then
|
||||
if ok then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] " .. directory_groups_key .. " stored in the cache\n");
|
||||
else
|
||||
freeswitch.consoleLog("warning", "[xml_handler] " .. directory_groups_key .. " can not be stored in the cache: " .. tostring(err) .. "\n");
|
||||
end
|
||||
end
|
||||
|
||||
--send to the console
|
||||
if (debug["cache"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] directory:groups:"..domain_name.." source: database\n");
|
||||
freeswitch.consoleLog("notice", "[xml_handler] directory:groups:"..directory_groups_key.." source: database\n");
|
||||
end
|
||||
|
||||
else
|
||||
@@ -154,7 +160,7 @@
|
||||
--send to the console
|
||||
if (debug["cache"]) then
|
||||
if (XML_STRING) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] directory:groups:"..domain_name.." source: memcache\n");
|
||||
freeswitch.consoleLog("notice", "[xml_handler] "..directory_groups_key.." source: cache\n");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
if (domain_name ~= nil) then
|
||||
local sql = "SELECT domain_uuid FROM v_domains ";
|
||||
sql = sql .. "WHERE domain_name = :domain_name ";
|
||||
sql = sql .. "and domain_enabled = true ";
|
||||
local params = {domain_name = domain_name}
|
||||
if (debug["sql"]) then
|
||||
log.noticef("SQL: %s; params %s", sql, json.encode(params));
|
||||
@@ -69,7 +70,7 @@
|
||||
if (domain_uuid ~= nil) then
|
||||
local sql = "SELECT * FROM v_extensions WHERE domain_uuid = :domain_uuid "
|
||||
.. "and (extension = :user or number_alias = :user) "
|
||||
.. "and enabled = 'true' ";
|
||||
.. "and enabled = true ";
|
||||
local params = {domain_uuid=domain_uuid, user=user};
|
||||
if (debug["sql"]) then
|
||||
log.noticef("SQL: %s; params %s", sql, json.encode(params));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- xml_handler.lua
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2013 - 2021 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Copyright (C) 2013 - 2025 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
@@ -42,7 +42,7 @@
|
||||
--event_calling_function = params:getHeader("Event-Calling-Function");
|
||||
|
||||
--set the variables as a string
|
||||
vm_mailto = "";
|
||||
vm_mailto = '';
|
||||
|
||||
--include json library
|
||||
local json
|
||||
@@ -287,9 +287,9 @@
|
||||
local sql = "SELECT e.*, random() FROM v_extensions as e, v_domains as d "
|
||||
.. "WHERE e.domain_uuid = :domain_uuid "
|
||||
.. "AND d.domain_uuid = :domain_uuid "
|
||||
.. "AND d.domain_enabled = 'true' "
|
||||
.. "AND d.domain_enabled = true "
|
||||
.. "AND (e.extension = :user or e.number_alias = :user) "
|
||||
.. "AND e.enabled = 'true' ";
|
||||
.. "AND e.enabled = true ";
|
||||
local params = {domain_uuid=domain_uuid, user=user};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
@@ -367,10 +367,26 @@
|
||||
forward_no_answer_destination = row.forward_no_answer_destination;
|
||||
forward_user_not_registered_enabled = row.forward_user_not_registered_enabled;
|
||||
forward_user_not_registered_destination = row.forward_user_not_registered_destination;
|
||||
follow_me_uuid = row.follow_me_uuid;
|
||||
follow_me_enabled = row.follow_me_enabled;
|
||||
do_not_disturb = row.do_not_disturb;
|
||||
extension_language = row.extension_language;
|
||||
extension_dialect = row.extension_dialect;
|
||||
extension_voice = row.extension_voice;
|
||||
--dial_string = row.dial_string;
|
||||
|
||||
--set the boolean values as true or false strings
|
||||
directory_visible = directory_visible and "true" or "false";
|
||||
directory_exten_visible = directory_exten_visible and "true" or "false";
|
||||
forward_all_enabled = forward_all_enabled and "true" or "false";
|
||||
forward_busy_enabled = forward_busy_enabled and "true" or "false";
|
||||
forward_no_answer_enabled = forward_no_answer_enabled and "true" or "false";
|
||||
call_screen_enabled = call_screen_enabled and "true" or "false";
|
||||
forward_user_not_registered_enabled = forward_user_not_registered_enabled and "true" or "false";
|
||||
force_ping = force_ping and "true" or "false";
|
||||
follow_me_enabled = follow_me_enabled and "true" or "false";
|
||||
virtual_extension = virtual_extension and "true" or "false";
|
||||
do_not_disturb = do_not_disturb and "true" or "false";
|
||||
|
||||
--if the extension is virtual set register to false
|
||||
if (row.extension_type == 'virtual') then
|
||||
@@ -378,12 +394,9 @@
|
||||
end
|
||||
|
||||
-- get the follow me information
|
||||
if (row.follow_me_uuid ~= nil and string.len(row.follow_me_uuid) > 0) then
|
||||
follow_me_uuid = row.follow_me_uuid;
|
||||
if (follow_me_uuid ~= nil and string.len(follow_me_uuid) > 0) then
|
||||
if (do_not_disturb == "true" or forward_all_enabled == "true") then
|
||||
follow_me_enabled = "false";
|
||||
else
|
||||
follow_me_enabled = row.follow_me_enabled;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -432,7 +445,7 @@
|
||||
if (extension_uuid) then
|
||||
local sql = "SELECT * FROM v_extension_settings "
|
||||
.. "WHERE extension_uuid = :extension_uuid "
|
||||
.. "and extension_setting_enabled = 'true' ";
|
||||
.. "and extension_setting_enabled = true ";
|
||||
local params = {extension_uuid=extension_uuid};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
@@ -461,25 +474,13 @@
|
||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
end
|
||||
dbh:query(sql, params, function(row)
|
||||
if (string.len(row.voicemail_enabled) > 0) then
|
||||
vm_enabled = row.voicemail_enabled;
|
||||
end
|
||||
vm_password = row.voicemail_password;
|
||||
vm_attach_file = "true";
|
||||
if (string.len(row.voicemail_attach_file) > 0) then
|
||||
vm_attach_file = row.voicemail_attach_file;
|
||||
end
|
||||
vm_keep_local_after_email = "true";
|
||||
if (string.len(row.voicemail_local_after_email) > 0) then
|
||||
vm_keep_local_after_email = row.voicemail_local_after_email;
|
||||
end
|
||||
if (string.len(row.voicemail_mail_to) > 0) then
|
||||
vm_mailto = row.voicemail_mail_to;
|
||||
else
|
||||
vm_mailto = "";
|
||||
end
|
||||
vm_keep_local_after_email = voicemail_local_after_email and "true" or "false";
|
||||
vm_enabled = voicemail_enabled and "true" or "false";
|
||||
vm_attach_file = voicemail_attach_file and "true" or "false";
|
||||
vm_password = row.voicemail_password and row.voicemail_password or '';
|
||||
vm_mailto = row.voicemail_mail_to and row.voicemail_mail_to or '';
|
||||
end);
|
||||
end
|
||||
end
|
||||
|
||||
--if the extension does not exist set continue to false;
|
||||
if (extension_uuid == nil) then
|
||||
@@ -570,7 +571,7 @@
|
||||
if (call_group ~= nil) and (string.len(call_group) > 0) then
|
||||
xml:append([[ <variable name="call_group" value="]] .. xml.sanitize(call_group) .. [["/>]]);
|
||||
end
|
||||
if (call_screen_enabled ~= nil) and (string.len(call_screen_enabled) > 0) then
|
||||
if (call_screen_enabled ~= nil) and (call_screen_enabled == 'true') then
|
||||
xml:append([[ <variable name="call_screen_enabled" value="]] .. xml.sanitize(call_screen_enabled) .. [["/>]]);
|
||||
end
|
||||
if (user_record ~= nil) and (string.len(user_record) > 0) then
|
||||
@@ -613,10 +614,10 @@
|
||||
if (directory_full_name ~= nil) and (string.len(directory_full_name) > 0) then
|
||||
xml:append([[ <variable name="directory_full_name" value="]] .. xml.sanitize(directory_full_name) .. [["/>]]);
|
||||
end
|
||||
if (directory_visible ~= nil) and (string.len(directory_visible) > 0) then
|
||||
if (directory_visible ~= nil) and (directory_visible == 'true') then
|
||||
xml:append([[ <variable name="directory-visible" value="]] .. xml.sanitize(directory_visible) .. [["/>]]);
|
||||
end
|
||||
if (directory_exten_visible ~= nil) and (string.len(directory_exten_visible) > 0) then
|
||||
if (directory_exten_visible ~= nil) and (directory_exten_visible == 'true') then
|
||||
xml:append([[ <variable name="directory-exten-visible" value="]] .. xml.sanitize(directory_exten_visible) .. [["/>]]);
|
||||
end
|
||||
if (limit_max ~= nil) and (string.len(limit_max) > 0) then
|
||||
@@ -639,7 +640,7 @@
|
||||
if (absolute_codec_string ~= nil) and (string.len(absolute_codec_string) > 0) then
|
||||
xml:append([[ <variable name="absolute_codec_string" value="]] .. xml.sanitize(absolute_codec_string) .. [["/>]]);
|
||||
end
|
||||
if (force_ping ~= nil) and (string.len(force_ping) > 0) then
|
||||
if (force_ping ~= nil) and (force_ping == 'true') then
|
||||
xml:append([[ <variable name="force_ping" value="]] .. xml.sanitize(force_ping) .. [["/>]]);
|
||||
end
|
||||
if (sip_bypass_media ~= nil) and (sip_bypass_media == "bypass-media") then
|
||||
@@ -651,37 +652,37 @@
|
||||
if (sip_bypass_media ~= nil) and (sip_bypass_media == "proxy-media") then
|
||||
xml:append([[ <variable name="proxy_media" value="true"/>]]);
|
||||
end
|
||||
if (forward_all_enabled ~= nil) and (string.len(forward_all_enabled) > 0) then
|
||||
if (forward_all_enabled ~= nil) and (forward_all_enabled == 'true') then
|
||||
xml:append([[ <variable name="forward_all_enabled" value="]] .. xml.sanitize(forward_all_enabled) .. [["/>]]);
|
||||
end
|
||||
if (forward_all_destination ~= nil) and (string.len(forward_all_destination) > 0) then
|
||||
xml:append([[ <variable name="forward_all_destination" value="]] .. xml.sanitize(forward_all_destination) .. [["/>]]);
|
||||
end
|
||||
if (forward_busy_enabled ~= nil) and (string.len(forward_busy_enabled) > 0) then
|
||||
if (forward_busy_enabled ~= nil) and (forward_busy_enabled == 'true') then
|
||||
xml:append([[ <variable name="forward_busy_enabled" value="]] .. xml.sanitize(forward_busy_enabled) .. [["/>]]);
|
||||
end
|
||||
if (forward_busy_destination ~= nil) and (string.len(forward_busy_destination) > 0) then
|
||||
xml:append([[ <variable name="forward_busy_destination" value="]] .. xml.sanitize(forward_busy_destination) .. [["/>]]);
|
||||
end
|
||||
if (forward_no_answer_enabled ~= nil) and (string.len(forward_no_answer_enabled) > 0) then
|
||||
if (forward_no_answer_enabled ~= nil) and (forward_no_answer_enabled == 'true') then
|
||||
xml:append([[ <variable name="forward_no_answer_enabled" value="]] .. xml.sanitize(forward_no_answer_enabled) .. [["/>]]);
|
||||
end
|
||||
if (forward_no_answer_destination ~= nil) and (string.len(forward_no_answer_destination) > 0) then
|
||||
xml:append([[ <variable name="forward_no_answer_destination" value="]] .. xml.sanitize(forward_no_answer_destination) .. [["/>]]);
|
||||
end
|
||||
if (forward_user_not_registered_enabled ~= nil) and (string.len(forward_user_not_registered_enabled) > 0) then
|
||||
if (forward_user_not_registered_enabled ~= nil) and (forward_user_not_registered_enabled == 'true') then
|
||||
xml:append([[ <variable name="forward_user_not_registered_enabled" value="]] .. xml.sanitize(forward_user_not_registered_enabled) .. [["/>]]);
|
||||
end
|
||||
if (forward_user_not_registered_destination ~= nil) and (string.len(forward_user_not_registered_destination) > 0) then
|
||||
xml:append([[ <variable name="forward_user_not_registered_destination" value="]] .. xml.sanitize(forward_user_not_registered_destination) .. [["/>]]);
|
||||
end
|
||||
if (follow_me_enabled ~= nil) and (string.len(follow_me_enabled) > 0) then
|
||||
if (follow_me_enabled ~= nil) and (follow_me_enabled == 'true') then
|
||||
xml:append([[ <variable name="follow_me_enabled" value="]] .. xml.sanitize(follow_me_enabled) .. [["/>]]);
|
||||
end
|
||||
--if (follow_me_destinations ~= nil) and (string.len(follow_me_destinations) > 0) then
|
||||
-- xml:append([[ <variable name="follow_me_destinations" value="]] .. follow_me_destinations .. [["/>]]);
|
||||
--end
|
||||
if (do_not_disturb ~= nil) and (string.len(do_not_disturb) > 0) then
|
||||
if (do_not_disturb ~= nil) and (do_not_disturb == 'true') then
|
||||
xml:append([[ <variable name="do_not_disturb" value="]] .. xml.sanitize(do_not_disturb) .. [["/>]]);
|
||||
end
|
||||
if (extension_language ~= nil) and (string.len(extension_language) > 0) then
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
sql = sql .. "AND p.phrase_uuid = :macro_name ";
|
||||
sql = sql .. "AND p.phrase_language = :language ";
|
||||
sql = sql .. "AND p.phrase_uuid = d.phrase_uuid ";
|
||||
sql = sql .. "AND p.phrase_enabled = 'true' ";
|
||||
sql = sql .. "AND p.phrase_enabled = true ";
|
||||
sql = sql .. "ORDER BY d.domain_uuid, p.phrase_uuid, d.phrase_detail_order ASC ";
|
||||
local params = {domain_uuid = domain_uuid, macro_name = macro_name, language = language};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -377,7 +377,11 @@
|
||||
end
|
||||
|
||||
--get the extensions from the database
|
||||
local sql = "SELECT * FROM v_extensions WHERE domain_uuid = :domain_uuid AND enabled = 'true' AND (directory_visible is null or directory_visible = 'true') ORDER BY directory_first_name, effective_caller_id_name asc; ";
|
||||
local sql = "SELECT extension, effective_caller_id_name, ";
|
||||
sql = sql .. "directory_first_name, directory_last_name, directory_exten_visible, user_context ";
|
||||
sql = sql .. "FROM v_extensions WHERE domain_uuid = :domain_uuid AND enabled = true ";
|
||||
sql = sql .. "AND (directory_visible is null or directory_visible = true) ";
|
||||
sql = sql .. "ORDER BY directory_first_name, effective_caller_id_name asc; ";
|
||||
local params = {domain_uuid = domain_uuid};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[directory] SQL: " .. sql .. "; params: " .. json.encode(params) .. "\n");
|
||||
|
||||
@@ -69,7 +69,7 @@ else
|
||||
local sql = [[select * from v_dialplans as d, v_dialplan_details as s
|
||||
where (d.domain_uuid = :domain_uuid or d.domain_uuid is null)
|
||||
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
||||
and d.dialplan_enabled = 'true'
|
||||
and d.dialplan_enabled = true
|
||||
and d.dialplan_uuid = s.dialplan_uuid
|
||||
order by
|
||||
d.dialplan_order asc,
|
||||
@@ -183,7 +183,7 @@ if session1:ready() and session1:answered() then
|
||||
local sql = [[select * from v_dialplans as d, v_dialplan_details as s
|
||||
where (d.domain_uuid = :domain_uuid or d.domain_uuid is null)
|
||||
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
||||
and d.dialplan_enabled = 'true'
|
||||
and d.dialplan_enabled = true
|
||||
and d.dialplan_uuid = s.dialplan_uuid
|
||||
order by
|
||||
d.dialplan_order asc,
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
local follow_me_enabled = row.follow_me_enabled;
|
||||
|
||||
--set follow me
|
||||
if (follow_me_enabled == "false") then
|
||||
if (follow_me_enabled == false) then
|
||||
--update the display and play a message
|
||||
channel_display(session:get_uuid(), "Activated")
|
||||
session:execute("sleep", "2000");
|
||||
@@ -92,7 +92,7 @@
|
||||
end
|
||||
|
||||
--unset follow me
|
||||
if (follow_me_enabled == "true") then
|
||||
if (follow_me_enabled == true) then
|
||||
--update the display and play a message
|
||||
channel_display(session:get_uuid(), "Cancelled")
|
||||
session:execute("sleep", "2000");
|
||||
@@ -102,10 +102,10 @@
|
||||
|
||||
--enable or disable follow me
|
||||
sql = "update v_follow_me set ";
|
||||
if (follow_me_enabled == "true") then
|
||||
sql = sql .. "follow_me_enabled = 'false' ";
|
||||
if (follow_me_enabled == true) then
|
||||
sql = sql .. "follow_me_enabled = false ";
|
||||
else
|
||||
sql = sql .. "follow_me_enabled = 'true' ";
|
||||
sql = sql .. "follow_me_enabled = true ";
|
||||
end
|
||||
sql = sql .. "where domain_uuid = :domain_uuid ";
|
||||
sql = sql .. "and follow_me_uuid = :follow_me_uuid ";
|
||||
@@ -117,13 +117,13 @@
|
||||
|
||||
--update the extension
|
||||
sql = "update v_extensions set ";
|
||||
sql = sql .. "do_not_disturb = 'false', ";
|
||||
if (follow_me_enabled == "true") then
|
||||
sql = sql .. "follow_me_enabled = 'false', ";
|
||||
sql = sql .. "do_not_disturb = false, ";
|
||||
if (follow_me_enabled == true) then
|
||||
sql = sql .. "follow_me_enabled = false, ";
|
||||
else
|
||||
sql = sql .. "follow_me_enabled = 'true', ";
|
||||
sql = sql .. "follow_me_enabled = true, ";
|
||||
end
|
||||
sql = sql .. "forward_all_enabled = 'false' ";
|
||||
sql = sql .. "forward_all_enabled = false ";
|
||||
sql = sql .. "where domain_uuid = :domain_uuid ";
|
||||
sql = sql .. "and extension_uuid = :extension_uuid ";
|
||||
local params = {domain_uuid=domain_uuid, extension_uuid=extension_uuid};
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
--get the ivr menu from the database
|
||||
sql = [[SELECT * FROM v_ivr_menus
|
||||
WHERE ivr_menu_uuid = :ivr_menu_uuid
|
||||
AND ivr_menu_enabled = 'true' ]];
|
||||
AND ivr_menu_enabled = true ]];
|
||||
local params = {ivr_menu_uuid = ivr_menu_uuid};
|
||||
if (debug["sql"]) then
|
||||
log.notice("SQL: " .. sql .. "; params: " .. json.encode(params));
|
||||
@@ -339,7 +339,7 @@
|
||||
v_ivr_menu_options
|
||||
WHERE
|
||||
ivr_menu_uuid = :ivr_menu_uuid
|
||||
AND ivr_menu_option_enabled = 'true'
|
||||
AND ivr_menu_option_enabled = true
|
||||
ORDER BY
|
||||
ivr_menu_option_order asc
|
||||
]];
|
||||
@@ -432,7 +432,7 @@
|
||||
end
|
||||
|
||||
--direct dial
|
||||
if ivr_menu_direct_dial == "true" and #digits > 0 and #digits < 6 then
|
||||
if ivr_menu_direct_dial == true and #digits > 0 and #digits < 6 then
|
||||
-- remove *#
|
||||
digits = digits:gsub("[*#]", "");
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ local function outbound_route_to_bridge(dbh, domain_uuid, fields, actions)
|
||||
local n = #actions
|
||||
extension_to_bridge(extension, actions, fields)
|
||||
-- if we found bridge or add any action and there no continue flag
|
||||
if actions.bridge or (n > #actions and route.dialplan_continue == 'false') then
|
||||
if actions.bridge or (n > #actions and route.dialplan_continue == false) then
|
||||
extension = nil
|
||||
return 1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user