From 1b5cd43bcabd516f98117a16d44d2a7f1bf70600 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 8 Apr 2013 15:36:30 +0200 Subject: dtmf test --- misc/freeswitch/scripts/dialplan/functions.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'misc/freeswitch') diff --git a/misc/freeswitch/scripts/dialplan/functions.lua b/misc/freeswitch/scripts/dialplan/functions.lua index ce99953..2edc131 100644 --- a/misc/freeswitch/scripts/dialplan/functions.lua +++ b/misc/freeswitch/scripts/dialplan/functions.lua @@ -116,6 +116,8 @@ function Functions.dialplan_function(self, caller, dialed_number) result = self:call_parking_inout(caller, parameters[3], parameters[4]); elseif fid == "cpai" then result = self:call_parking_inout_index(caller, parameters[3]); + elseif fid == "test" then + result = self:test(caller, parameters[3]); end return result or { continue = false, code = 505, phrase = 'Error executing function', no_cdr = true }; @@ -912,3 +914,20 @@ function Functions.call_parking_inout_index(self, caller, stall_index) return { continue = false, code = 200, phrase = 'OK', no_cdr = true } end + + +function Functions.test(self, caller, name) + if tostring(name) == 'dtmf' then + while caller:ready() do + local digits = caller.session:read(1, 1, '', 30000, ''); + if digits == "" then + break; + end + caller:send_display('DTMF: ', digits); + caller.session:say(digits, "en", "number", "pronounced"); + self.log:devel('DTMF: ', digits); + end + end + + return { continue = false, code = 200, phrase = 'OK', no_cdr = true } +end -- cgit v1.2.3