summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan/router.lua
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-17 12:45:23 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-17 12:45:23 +0100
commitd007b83d1d6b51caea93b5f08f449db88a930a16 (patch)
tree53c3ff07977cd374182358acef4b821a17e345b6 /misc/freeswitch/scripts/dialplan/router.lua
parent0ed2894ca7371199788c202b61f53a3f73c4b03b (diff)
parentabc16da2c2afa636a928a031a540e677f4ac84f8 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/router.lua')
-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));