diff --git a/app/switch/resources/scripts/app/ring_groups/index.lua b/app/switch/resources/scripts/app/ring_groups/index.lua index 42324450a7..e4dd3bfa6b 100644 --- a/app/switch/resources/scripts/app/ring_groups/index.lua +++ b/app/switch/resources/scripts/app/ring_groups/index.lua @@ -306,14 +306,40 @@ log = require "resources.functions.log".ring_group --call screen enabled if (ring_group_call_screen_enabled == 'true') then + --local codecs = session:getVariable("codec_string") + local codecs = session:getVariable("rtp_use_codec_string"); + + --put the codecs into an array + local codec_array = explode(",",codecs); + + --exclude video codecs and resave the new list to a string + local new_codec_array = {} + for index, value in ipairs(codec_array) do + if (value ~= "H264" and value ~= 'VP8') then + table.insert(new_codec_array, value) + end + end + local new_codecs = table.concat(new_codec_array, ","); + + --set a new allowed codec string + session:setVariable("absolute_codec_string", new_codecs); + + --callback function detecting dtmf + function on_dtmf(s, _type, obj, arg) + local k, v = nil, nil + if (_type == "dtmf") then + dtmf_entered = 1; + return 'break' + else + return '' + end + end + --answer the call if not answered if (not session_answer) then session:answer(); end - --flush dtmf digits from the input buffer - session:flushDigits(); - --set the variables min_digits = 1; max_digits = 1; @@ -328,8 +354,8 @@ log = require "resources.functions.log".ring_group --recording settings max_length_seconds = 30; - silence_threshold = 30; - silence_seconds = 3; + silence_threshold = settings:get('recordings', 'recording_silence_threshold', 'numeric') or 200; + silence_seconds = settings:get('recordings', 'recording_silence_seconds', 'numeric') or 3; --create the call scree file name call_sreen_name = 'call_screen.'..uuid..'.'..record_ext; @@ -339,10 +365,12 @@ log = require "resources.functions.log".ring_group mkdir(record_path); end + --set callback function for when a caller sends DTMF + session:setInputCallback('on_dtmf', ''); + --record the name and reason for calling if (session:ready()) then result = session:recordFile(record_path..'/'..call_sreen_name, max_length_seconds, silence_threshold, silence_seconds); - --session:execute("record", record_path..'/'..call_sreen_name.." 180 200"); end end