summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan/functions.lua
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-06-04 11:22:24 +0200
committerPeter Kozak <spag@golwen.net>2013-06-04 11:22:24 +0200
commitf89becb96fdfe7a247f04b6f472496972ba5827e (patch)
tree3b99076c17d51dab208d0fc1589bd81ed3039b1b /misc/freeswitch/scripts/dialplan/functions.lua
parentb5df8e80d5b10ae7a71e9945ab9246141c7339af (diff)
pager function added
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/functions.lua')
-rw-r--r--misc/freeswitch/scripts/dialplan/functions.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/dialplan/functions.lua b/misc/freeswitch/scripts/dialplan/functions.lua
index 7519ff9..efd1f05 100644
--- a/misc/freeswitch/scripts/dialplan/functions.lua
+++ b/misc/freeswitch/scripts/dialplan/functions.lua
@@ -118,6 +118,8 @@ function Functions.dialplan_function(self, caller, dialed_number)
result = self:call_parking_inout_index(caller, parameters[3]);
elseif fid == "test" then
result = self:test(caller, parameters[3]);
+ elseif fid == "pager" then
+ result = self:pager(caller, parameters[3]);
end
return result or { continue = false, code = 505, phrase = 'Error executing function', no_cdr = true };
@@ -940,3 +942,20 @@ function Functions.test(self, caller, name)
return { continue = false, code = 200, phrase = 'OK', no_cdr = true }
end
+
+
+function Functions.pager(self, caller, pager_group_id)
+ require 'common.pager';
+ local pager = common.pager.Pager:new{ log = self.log, database = self.database, caller = caller }:find_by_id(pager_group_id);
+
+ if not pager then
+ self.log:notice('FUNCTION_PAGER not found - pager_group=', pager_group_id);
+ return { continue = false, code = 404, phrase = 'No such pager group', no_cdr = true }
+ end
+
+ self.log:info('FUNCTION_PAGER pager_group=', pager_group_id);
+ caller:answer();
+ pager:enter();
+
+ return { continue = false, code = 200, phrase = 'OK', no_cdr = true }
+end