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
22ded2198d
commit
9038cfb9b7
|
|
@ -223,24 +223,6 @@
|
||||||
--run the action
|
--run the action
|
||||||
session:execute(action, data);
|
session:execute(action, data);
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
--clear the variables
|
--clear the variables
|
||||||
|
|
@ -248,6 +230,25 @@
|
||||||
data = "";
|
data = "";
|
||||||
end); --end results
|
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
|
--execute
|
||||||
if (action) then
|
if (action) then
|
||||||
if (string.len(action) == 0) then
|
if (string.len(action) == 0) then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue