From 8442ea979e4f43708ad73bb4c807ba7f816bd694 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 18 Aug 2015 15:38:41 +0400 Subject: [PATCH] Change. Use bind_bind_digit instead of bind_meta_app. Change. Allow transfer and turn on recordings only for authorized users. Fix. Use record_ext in recording in ring_group. This allow configure other dtmf sequence like `*#` and `##` --- app/devices/device_edit.php | 2 +- .../conf/dialplan/999_local_extension.xml | 27 +++++++++++++------ .../install/scripts/app/ring_groups/index.lua | 27 +++++++++++++------ 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index f484d7494a..90a31a0c4c 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -880,7 +880,7 @@ require_once "resources/require.php"; if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo ""; ?> - + diff --git a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml index bfe432fd99..b16cc3c5b7 100644 --- a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml @@ -2,14 +2,25 @@ - - + - - - - - + + + + + + + + + + + + + + + + + @@ -31,7 +42,7 @@ - + diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index 336f5ace28..4f6b59f1c4 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -69,9 +69,8 @@ if (not default_voice) then default_voice = 'callie'; end --get record_ext - if (session:getVariable("record_ext")) then - record_ext = session:getVariable("record_ext"); - else + record_ext = session:getVariable("record_ext"); + if (not record_ext) then record_ext = "wav"; end @@ -491,11 +490,23 @@ session:execute("set", "hangup_after_bridge=true"); session:execute("set", "continue_on_fail=true"); - --set bind meta app - session:execute("bind_meta_app", "1 ab s execute_extension::dx XML "..context); - session:execute("bind_meta_app", "2 ab s record_session::"..recordings_dir.."/archive/"..os.date("%Y").."/"..os.date("%m").."/"..os.date("%d").."}/"..uuid..".wav"); - session:execute("bind_meta_app", "3 ab s execute_extension::cf XML "..context); - session:execute("bind_meta_app", "4 ab s execute_extension::att_xfer XML "..context); + local bind_target = 'peer' + if session:getVariable("sip_authorized") == "true" then + bind_target = 'both' + end + + --set bind digit action + local record_file = recordings_dir.."/archive/"..os.date("%Y").."/"..os.date("%m").."/"..os.date("%d").."}/"..uuid..".".record_ext + local bindings = { + "local,*1,exec:execute_extension,dx XML " .. context, + "local,*2,exec:record_session," .. record_file, + "local,*3,exec:execute_extension,cf XML " .. context, + "local,*4,exec:execute_extension,att_xfer XML " .. context, + } + for _, str in ipairs(bindings) do + session:execute("bind_digit_action", str .. "," .. bind_target) + end + session:execute("digit_action_set_realm", "local") --if the user is busy rollover to the next destination if (ring_group_strategy == "rollover") then