mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Random strategy for ring groups
This commit is contained in:
@@ -88,6 +88,17 @@ $text['option-rollover']['uk'] = "";
|
||||
$text['option-rollover']['de-at'] = "Überrollen";
|
||||
$text['option-rollover']['he'] = "";
|
||||
|
||||
$text['option-random']['en-us'] = "Random";
|
||||
$text['option-random']['es-cl'] = "Aleatorio";
|
||||
$text['option-random']['pt-pt'] = "";
|
||||
$text['option-random']['fr-fr'] = "";
|
||||
$text['option-random']['pt-br'] = "";
|
||||
$text['option-random']['pl'] = "";
|
||||
$text['option-random']['sv-se'] = "";
|
||||
$text['option-random']['uk'] = "";
|
||||
$text['option-random']['de-at'] = "";
|
||||
$text['option-random']['he'] = "";
|
||||
|
||||
$text['option-ptring']['en-us'] = "pt-ring";
|
||||
$text['option-ptring']['es-cl'] = "pt-ring";
|
||||
$text['option-ptring']['fr-fr'] = "Portugal";
|
||||
|
||||
@@ -499,6 +499,7 @@ else {
|
||||
echo " <option value='sequence' ".(($ring_group_strategy == "sequence") ? "selected='selected'" : null).">".$text['option-sequence']."</option>\n";
|
||||
echo " <option value='enterprise' ".(($ring_group_strategy == "enterprise") ? "selected='selected'" : null).">".$text['option-enterprise']."</option>\n";
|
||||
echo " <option value='rollover' ".(($ring_group_strategy == "rollover") ? "selected='selected'" : null).">".$text['option-rollover']."</option>\n";
|
||||
echo " <option value='random' ".(($ring_group_strategy == "random") ? "selected='selected'" : null).">".$text['option-random']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-strategy']."\n";
|
||||
|
||||
@@ -158,6 +158,28 @@
|
||||
--forward the ring group
|
||||
session:execute("transfer", ring_group_forward_destination.." XML "..context);
|
||||
else
|
||||
--get the strategy of the ring group, if random, we use random() to order the destinations
|
||||
sql = [[
|
||||
SELECT
|
||||
r.ring_group_strategy
|
||||
FROM
|
||||
v_ring_groups as r, v_ring_group_destinations as d
|
||||
WHERE
|
||||
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'
|
||||
]];
|
||||
|
||||
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
||||
assert(dbh:query(sql, function(row)
|
||||
if (row.ring_group_strategy == "random") then
|
||||
sql_order = 'random()'
|
||||
else
|
||||
sql_order='d.destination_delay, d.destination_number asc'
|
||||
end
|
||||
end));
|
||||
|
||||
--get the ring group destinations
|
||||
sql = [[
|
||||
SELECT
|
||||
@@ -172,7 +194,7 @@
|
||||
AND r.domain_uuid = ']]..domain_uuid..[['
|
||||
AND r.ring_group_enabled = 'true'
|
||||
ORDER BY
|
||||
d.destination_delay, d.destination_number asc
|
||||
]]..sql_order..[[
|
||||
]];
|
||||
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
||||
destinations = {};
|
||||
@@ -291,6 +313,9 @@
|
||||
if (ring_group_strategy == "sequence") then
|
||||
delimiter = "|";
|
||||
end
|
||||
if (ring_group_strategy == "random") then
|
||||
delimiter = "|";
|
||||
end
|
||||
if (ring_group_strategy == "simultaneous") then
|
||||
delimiter = ",";
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user