Move direct dial code outside of the loop. Next user_exists replace context with domain_name so that it works with single tenant systems.
This commit is contained in:
parent
0b2078a009
commit
3eddead2a0
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue