From 0983f3ec97229697cda1541b7a6bf8c9d84094b0 Mon Sep 17 00:00:00 2001 From: afanucchi <32469691+afanucchi@users.noreply.github.com> Date: Fri, 27 Apr 2018 16:44:43 +1000 Subject: [PATCH] Allow call forwarding to be enabled and set by argument in INVITE. Useful for softkey on hard phones. (#3035) --- .../switch/conf/dialplan/500_call-forward.xml | 4 ++-- resources/install/scripts/call_forward.lua | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/dialplans/resources/switch/conf/dialplan/500_call-forward.xml b/app/dialplans/resources/switch/conf/dialplan/500_call-forward.xml index 8adf418fef..67fed32be0 100644 --- a/app/dialplans/resources/switch/conf/dialplan/500_call-forward.xml +++ b/app/dialplans/resources/switch/conf/dialplan/500_call-forward.xml @@ -1,9 +1,9 @@ - + - + diff --git a/resources/install/scripts/call_forward.lua b/resources/install/scripts/call_forward.lua index bf7374f7d1..60b13db3f6 100644 --- a/resources/install/scripts/call_forward.lua +++ b/resources/install/scripts/call_forward.lua @@ -169,8 +169,15 @@ if not session:ready() then return end ---get the forward destination - if enabled == "true" and empty(forward_all_destination) then +--get the destination by argument and set the forwarding destination + destination_by_arg = argv[1]; + + if enabled == "true" and destination_by_arg then + forward_all_destination = destination_by_arg; + end + +--get the forward destination by IVR if destination has not been passed by argument + if enabled == "true" and empty(forward_all_destination) and not destination_by_arg then forward_all_destination = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-enter_destination_telephone_number.wav", "", "\\d+"); if empty(forward_all_destination) then return end end