From 3eddead2a0c8ba7883fc5a5efd2561250222762b Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 15 Jul 2013 21:47:22 +0000 Subject: [PATCH] Move direct dial code outside of the loop. Next user_exists replace context with domain_name so that it works with single tenant systems. --- resources/install/scripts/ivr_menu.lua | 37 +++++++++++++------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 7999bdd00b..46b2cf301b 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -223,24 +223,6 @@ --run the action session:execute(action, data); end - else - if (ivr_menu_direct_dial == "true") then - if (string.len(digits) < 6) then - --replace the $1 and the domain name - digits = digits:gsub("*", ""); - --check to see if the user extension exists - cmd = "user_exists id ".. digits .." "..context; - result = api:executeString(cmd); - freeswitch.consoleLog("NOTICE", "[confirm] "..cmd.." --"..result.."--\n"); - if (result == "true") then - --run the action - session:execute("transfer", digits.." XML "..context); - else - --run the menu again - menu(); - end - end - end end --clear the variables @@ -248,6 +230,25 @@ data = ""; end); --end results + --direct dial + if (ivr_menu_direct_dial == "true") then + if (string.len(digits) < 6) then + --replace the $1 and the domain name + digits = digits:gsub("*", ""); + --check to see if the user extension exists + cmd = "user_exists id ".. digits .." "..domain_name; + result = api:executeString(cmd); + freeswitch.consoleLog("NOTICE", "[ivr_menu] "..cmd.." "..result.."\n"); + if (result == "true") then + --run the action + session:execute("transfer", digits.." XML "..context); + else + --run the menu again + menu(); + end + end + end + --execute if (action) then if (string.len(action) == 0) then