Update the feature event LUA code to match the fix in PHP

This renames `get_profile` to `get_profiles` which either returns nil for no profiles or a array of unique profiles.

Then each function that used to take the single sip_profile was updated to take this array and send events to each profile the user is part of.
This commit is contained in:
Andrew Querol
2020-11-19 11:30:14 -06:00
parent 7d57cef6ac
commit 7217da15f0
4 changed files with 87 additions and 65 deletions

View File

@@ -262,14 +262,14 @@
-- Get the sip_profile
if (extension ~= nil and domain_name ~= nil) then
sip_profile = notify.get_profile(extension, domain_name);
sip_profiles = notify.get_profiles(extension, domain_name);
end
if (sip_profile ~= nil) then
if (sip_profiles ~= nil) then
freeswitch.consoleLog("NOTICE", "[feature_event] SIP NOTIFY: CFWD set to "..forward_all_enabled.."\n");
--Do Not Disturb
notify.dnd(extension, domain_name, sip_profile, do_not_disturb);
notify.dnd(extension, domain_name, sip_profiles, do_not_disturb);
--Forward all
forward_immediate_enabled = forward_all_enabled;
@@ -281,7 +281,7 @@
end
freeswitch.consoleLog("NOTICE", "[feature_event] forward_immediate_destination "..forward_immediate_destination.."\n");
notify.forward_immediate(extension, domain_name, sip_profile, forward_immediate_enabled, forward_immediate_destination);
notify.forward_immediate(extension, domain_name, sip_profiles, forward_immediate_enabled, forward_immediate_destination);
--Forward busy
--workaround for freeswitch not sending NOTIFY when destination values are nil. Send 0.
@@ -290,7 +290,7 @@
end
freeswitch.consoleLog("NOTICE", "[feature_event] forward_busy_destination "..forward_busy_destination.."\n");
notify.forward_busy(extension, domain_name, sip_profile, forward_busy_enabled, forward_busy_destination);
notify.forward_busy(extension, domain_name, sip_profiles, forward_busy_enabled, forward_busy_destination);
--Forward No Answer
ring_count = math.ceil (call_timeout / 6);
@@ -300,7 +300,7 @@
end
freeswitch.consoleLog("NOTICE", "[feature_event] forward_no_answer_destination "..forward_no_answer_destination.."\n");
notify.forward_no_answer(extension, domain_name, sip_profile, forward_no_answer_enabled, forward_no_answer_destination, ring_count);
notify.forward_no_answer(extension, domain_name, sip_profiles, forward_no_answer_enabled, forward_no_answer_destination, ring_count);
end
end