diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index 3ffdac0002..932f778e96 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -163,6 +163,10 @@ $destination_extension = str_replace("+", "\+", $destination_extension); $destination_feature = $call_flow_feature_code; + // Allows dial feature code as `flow+` + if (substr($destination_feature, 0, 5) != 'flow+') { + $destination_feature = '(?:flow+)?' . $destination_feature; + } $destination_feature = str_replace("*", "\*", $destination_feature); $destination_feature = str_replace("+", "\+", $destination_feature); diff --git a/resources/install/scripts/call_flow.lua b/resources/install/scripts/call_flow.lua index 1a802d575e..824fdc46c1 100644 --- a/resources/install/scripts/call_flow.lua +++ b/resources/install/scripts/call_flow.lua @@ -207,6 +207,12 @@ if (session:ready()) then call_flow_feature_code.."@"..domain_name, call_flow_uuid ); + if string.find(call_flow_feature_code, 'flow+', nil, true) ~= 1 then + presence_in.turn_lamp( toggle == "false", + 'flow+'..call_flow_feature_code.."@"..domain_name, + call_flow_uuid + ); + end --active label local active_flow_label = (toggle == "true") and call_flow_label or call_flow_alternate_label diff --git a/resources/install/scripts/call_flow_subscribe.lua b/resources/install/scripts/call_flow_subscribe.lua index 765dd3b606..b756200c16 100644 --- a/resources/install/scripts/call_flow_subscribe.lua +++ b/resources/install/scripts/call_flow_subscribe.lua @@ -10,15 +10,19 @@ local find_call_flow do local find_call_flow_sql = [[select t1.call_flow_uuid, t1.call_flow_status from v_call_flows t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid -where t2.domain_name = :domain_name and t1.call_flow_feature_code = :feature_code +where t2.domain_name = :domain_name and (t1.call_flow_feature_code = :feature_code +or t1.call_flow_feature_code = :short_feature_code) ]] function find_call_flow(user) local ext, domain_name = split_first(user, '@', true) + local _, short = split_first(ext, '+', true) if not domain_name then return end local dbh = Database.new('system') if not dbh then return end - local row = dbh:first_row(find_call_flow_sql, {domain_name = domain_name, feature_code = ext}) + local row = dbh:first_row(find_call_flow_sql, { + domain_name = domain_name, feature_code = ext, short_feature_code = short + }) dbh:release() if not row then return end return row.call_flow_uuid, row.call_flow_status @@ -27,6 +31,7 @@ end end local find_dnd do + local find_dnd_sql = [[select t1.do_not_disturb from v_extensions t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid where t2.domain_name = :domain_name and (t1.extension = :extension or t1.number_alias=:extension)]]