summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-15 08:40:36 -0400
committerPeter Kozak <spag@golwen.net>2013-03-15 08:40:36 -0400
commita6b3a069c2723e321ebfb79a06026bfe97cec9e6 (patch)
tree537d10a1c35a20ed58787d53a9d6626d5a8596fc /misc/freeswitch/scripts/dialplan
parentbaf86f285be7c02535c3bc1cd25bf8c69b3b2051 (diff)
prefer destination variables
Diffstat (limited to 'misc/freeswitch/scripts/dialplan')
-rw-r--r--misc/freeswitch/scripts/dialplan/router.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua
index 751d24f..c335186 100644
--- a/misc/freeswitch/scripts/dialplan/router.lua
+++ b/misc/freeswitch/scripts/dialplan/router.lua
@@ -83,11 +83,16 @@ function Router.element_match(self, pattern, search_string, replacement, route_v
end
-function Router.element_match_group(self, pattern, groups, replacement, use_key, route_variables)
+function Router.element_match_group(self, pattern, groups, replacement, use_key, route_variables, variable_name)
if type(groups) ~= 'table' then
+ self.log:debug('ELEMENT_FIND_IN_ARRAY - no such array: ', variable_name, ', use_keys: ', tostring(use_key));
return false;
end
+ if self.log_details then
+ self.log:debug('ELEMENT_FIND_IN_ARRAY - array: ', variable_name, ', use_keys: ', tostring(use_key));
+ end
+
for key, value in pairs(groups) do
if use_key then
value = key;
@@ -136,8 +141,8 @@ function Router.route_match(self, route)
local search_string = tostring(common.array.try(self.caller, element.var_in));
result, replacement = self:element_match(tostring(element.pattern), search_string, tostring(element.replacement));
elseif command == 'key' or command == 'val' then
- local groups = common.array.try(self.caller, variable_name);
- result, replacement = self:element_match_group(tostring(element.pattern), groups, tostring(element.replacement), command == 'key');
+ local groups = common.array.try(destination, variable_name) or common.array.try(self.caller, variable_name);
+ result, replacement = self:element_match_group(tostring(element.pattern), groups, tostring(element.replacement), command == 'key', destination, variable_name);
elseif command == 'chv' then
local search_string = self.caller:to_s(variable_name);
result, replacement = self:element_match(tostring(element.pattern), search_string, tostring(element.replacement));