summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-04-23 22:04:07 +0200
committerPeter Kozak <spag@golwen.net>2013-04-23 22:04:07 +0200
commit7804dbb985f25c8bafbcfad1f9345d14a9a6adc3 (patch)
treeceb6f706694a492f9c0ed4ff0fa74b350da70e9b /misc/freeswitch/scripts/dialplan
parente3b373bcf144dcd0c8e36f8894954dc2b752a05b (diff)
elements loading order fixed
Diffstat (limited to 'misc/freeswitch/scripts/dialplan')
-rw-r--r--misc/freeswitch/scripts/dialplan/router.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua
index dde527c..10551f1 100644
--- a/misc/freeswitch/scripts/dialplan/router.lua
+++ b/misc/freeswitch/scripts/dialplan/router.lua
@@ -38,15 +38,19 @@ function Router.read_table(self, table_name, force_reload)
JOIN `route_elements` `b` ON `a`.`id` = `b`.`call_route_id`\
WHERE `a`.`routing_table` = "' .. table_name .. '" \
ORDER BY `a`.`position`, `b`.`position`';
-
- local last_id = 0;
+
+ local call_routes = {};
+
self.database:query(sql_query, function(route)
- if last_id ~= tonumber(route.call_route_id) then
- last_id = tonumber(route.call_route_id);
- table.insert(routing_table, {id = route.call_route_id, name = route.name, endpoint_type = route.endpoint_type , endpoint_id = route.endpoint_id, elements = {} });
+ if call_routes[route.call_route_id] then
+ call_route = call_routes[route.call_route_id];
+ else
+ call_route = {id = route.call_route_id, name = route.name, endpoint_type = route.endpoint_type , endpoint_id = route.endpoint_id, elements = {} };
+ call_routes[route.call_route_id] = call_route;
+ table.insert(routing_table, call_route);
end
- table.insert(routing_table[#routing_table].elements, {
+ table.insert(call_route.elements, {
var_in = route.var_in,
var_out = route.var_out,
pattern = route.pattern,