From a9be92fdc62d55e6b6a8da80f0fe959ad90fa678 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 29 Jan 2013 16:28:50 +0100 Subject: use str function set --- misc/freeswitch/scripts/dialplan/router.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/router.lua') diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua index cdcb58b..68989fa 100644 --- a/misc/freeswitch/scripts/dialplan/router.lua +++ b/misc/freeswitch/scripts/dialplan/router.lua @@ -143,7 +143,7 @@ function Router.route_match(self, route) if not common.str.blank(element.var_out) then local command, variable_name = common.str.partition(element.var_out, ':'); if not command or not variable_name or command == 'var' then - destination[element.var_out] = replacement; + common.str.set(destination, element.var_out, replacement); elseif command == 'chv' then destination.channel_variables[variable_name] = replacement; elseif command == 'hdr' then -- cgit v1.2.3 From 9928e509175ec6dbb9cd77aaeb06168c0de99d38 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 29 Jan 2013 20:59:06 +0100 Subject: destination.number vs. destination.destination_number --- misc/freeswitch/scripts/dialplan/router.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'misc/freeswitch/scripts/dialplan/router.lua') diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua index 68989fa..0813a37 100644 --- a/misc/freeswitch/scripts/dialplan/router.lua +++ b/misc/freeswitch/scripts/dialplan/router.lua @@ -159,6 +159,7 @@ function Router.route_match(self, route) end if route_matches then + destination.number = destination.number or destination.destination_number; return destination; end; -- cgit v1.2.3 From 9890298bbdfd909ab1fe5f35e53c9652d1371acd Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 7 Feb 2013 14:23:26 +0100 Subject: cache routing tables --- misc/freeswitch/scripts/dialplan/router.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/router.lua') diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua index 0813a37..bda80a7 100644 --- a/misc/freeswitch/scripts/dialplan/router.lua +++ b/misc/freeswitch/scripts/dialplan/router.lua @@ -18,11 +18,16 @@ function Router.new(self, arg) self.routes = arg.routes or {}; self.caller = arg.caller; self.variables = arg.variables or {}; + self.routing_tables = {}; return object; end -function Router.read_table(self, table_name) +function Router.read_table(self, table_name, force_reload) + if not force_reload and self.routing_tables[table_name] then + return self.routing_tables[table_name]; + end + local routing_table = {}; local sql_query = 'SELECT * \ @@ -48,6 +53,8 @@ function Router.read_table(self, table_name) }); end); + self.routing_tables[table_name] = routing_table; + return routing_table; end -- cgit v1.2.3