Hey everyone!
I am trying to write a lua script that I plan to use with dialplan tools. The script is a simple call forward to an external phone number.
The issues I am having is "UNALLOCATED_NUMBER" error. I know what it means, just don't know how to fix it!
Any help would be awesome
*EDIT*
I do pay for FusionPBX support, but I thought this would be a good topic for google/seo!
I am trying to write a lua script that I plan to use with dialplan tools. The script is a simple call forward to an external phone number.
The issues I am having is "UNALLOCATED_NUMBER" error. I know what it means, just don't know how to fix it!
Any help would be awesome
*EDIT*
I do pay for FusionPBX support, but I thought this would be a good topic for google/seo!
Code:
local cache = require"resources.functions.cache";
local log = require"resources.functions.log"["call_block"];
local SipharmonyApi = require "resources.functions.sipharmony_api"
local json json = require "resources.functions.lunajson";
require "resources.functions.trim";
require "resources.functions.explode";
require "resources.functions.file_exists";
if (session:ready()) then
domain_uuid = session:getVariable("domain_uuid");
call_direction = session:getVariable("call_direction");
caller_id_name = session:getVariable("caller_id_name");
caller_id_number = session:getVariable("caller_id_number");
destination_number = session:getVariable("destination_number");
context = session:getVariable("context");
check_balance = session:getVariable("check_balance");
extension_uuid = session:getVariable("extension_uuid");
sip_to_user = session:getVariable("sip_to_user");
sip_to_user = string.gsub(sip_to_user, "+", "");
local external_number = "XXXXXXXXXX" -- eventually get value from db
-- Send caller to an external number
freeswitch.consoleLog("DEBUG", "[IVR External Number] Sending caller to an external number\n");
freeswitch.consoleLog("DEBUG", "[IVR External Number] sip_to_user: " .. sip_to_user .. "\n");
session:execute("set", "call_destination=outbound");
session:execute("set", "outbound_caller_id_name=" .. sip_to_user);
session:execute("set", "outbound_caller_id_number=" .. sip_to_user);
session:execute("set", "origination_caller_id_number=" .. sip_to_user);
session:execute("set", "origination_caller_id_name=" .. sip_to_user);
session:execute("set", "effective_caller_id_number=" .. sip_to_user);
session:execute("set", "origination_callee_id_name=" .. sip_to_user);
session:execute("set", "caller_destination=" .. external_number);
session:execute("set", "destination_number=" .. external_number);
session:execute("set", "callee_id_number=" .. external_number);
session:execute("bridge", "sofia/gateway/2544a86b-2a1d-474a-b33b-6da9fcfd8210/" .. external_number);
session:execute("bridge", "sofia/gateway/e9ff8727-eed3-45ee-b8c6-f6d555c17e6e/" .. external_number);
session:hangup("NORMAL_CLEARING");
end
Last edited: