IVR Menu allow one of the options to override direct dial to an extension.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
-- ivr_menu.lua
|
-- ivr_menu.lua
|
||||||
-- Part of FusionPBX
|
-- Part of FusionPBX
|
||||||
-- Copyright (C) 2012 Mark J Crane <markjcrane@fusionpbx.com>
|
-- Copyright (C) 2012-2015 Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
-- All rights reserved.
|
-- All rights reserved.
|
||||||
--
|
--
|
||||||
-- Redistribution and use in source and binary forms, with or without
|
-- Redistribution and use in source and binary forms, with or without
|
||||||
@@ -83,6 +83,7 @@
|
|||||||
|
|
||||||
--set default variable(s)
|
--set default variable(s)
|
||||||
tries = 0;
|
tries = 0;
|
||||||
|
option_found = "false";
|
||||||
|
|
||||||
--define the trim function
|
--define the trim function
|
||||||
require "resources.functions.trim"
|
require "resources.functions.trim"
|
||||||
@@ -438,6 +439,9 @@
|
|||||||
--execute
|
--execute
|
||||||
if (action) then
|
if (action) then
|
||||||
if (string.len(action) > 0) then
|
if (string.len(action) > 0) then
|
||||||
|
--option found
|
||||||
|
option_found = "true";
|
||||||
|
|
||||||
--send to the log
|
--send to the log
|
||||||
if (debug["action"]) then
|
if (debug["action"]) then
|
||||||
freeswitch.consoleLog("notice", "[ivr_menu] action: " .. action .. " data: ".. data .. "\n");
|
freeswitch.consoleLog("notice", "[ivr_menu] action: " .. action .. " data: ".. data .. "\n");
|
||||||
@@ -462,14 +466,16 @@
|
|||||||
|
|
||||||
--direct dial
|
--direct dial
|
||||||
if (ivr_menu_direct_dial == "true") then
|
if (ivr_menu_direct_dial == "true") then
|
||||||
if (string.len(digits) < 6) then
|
if (string.len(digits) < 6 and option_found == "false") then
|
||||||
--replace the $1 and the domain name
|
--replace the $1 and the domain name
|
||||||
digits = digits:gsub("*", "");
|
digits = digits:gsub("*", "");
|
||||||
--check to see if the user extension exists
|
--check to see if the user extension exists
|
||||||
cmd = "user_exists id ".. digits .." "..domain_name;
|
cmd = "user_exists id ".. digits .." "..domain_name;
|
||||||
result = api:executeString(cmd);
|
result = api:executeString(cmd);
|
||||||
freeswitch.consoleLog("NOTICE", "[ivr_menu] "..cmd.." "..result.."\n");
|
freeswitch.consoleLog("NOTICE", "[ivr_menu][direct dial] "..cmd.." "..result.."\n");
|
||||||
if (result == "true") then
|
if (result == "true") then
|
||||||
|
--log the action
|
||||||
|
freeswitch.consoleLog("NOTICE", "[ivr_menu][direct dial] "..digits.." XML "..context.."\n");
|
||||||
--run the action
|
--run the action
|
||||||
session:execute("transfer", digits.." XML "..context);
|
session:execute("transfer", digits.." XML "..context);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user