mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Work on intercept.lua to prevent an error with the hostname.
This commit is contained in:
@@ -45,6 +45,12 @@
|
||||
dbh = database_handle('switch');
|
||||
end
|
||||
|
||||
--prepare the api object
|
||||
api = freeswitch.API();
|
||||
|
||||
--add the function
|
||||
dofile(scripts_dir.."/resources/functions/trim.lua");
|
||||
|
||||
--exits the script if we didn't connect properly
|
||||
assert(dbh:connected());
|
||||
|
||||
@@ -109,6 +115,11 @@ if ( session:ready() ) then
|
||||
end
|
||||
end
|
||||
|
||||
--predefined variables
|
||||
uuid = '';
|
||||
call_hostname = '';
|
||||
callee_num = '';
|
||||
|
||||
--check the database to get the uuid of a ringing call
|
||||
sql = "select call_uuid as uuid, hostname, callee_num, ip_addr from channels ";
|
||||
sql = sql .. "where callstate = 'RINGING' ";
|
||||
@@ -129,12 +140,11 @@ if ( session:ready() ) then
|
||||
uuid = result.uuid;
|
||||
call_hostname = result.hostname;
|
||||
callee_num = result.callee_num;
|
||||
ip_addr = result.ip_addr;
|
||||
end);
|
||||
end
|
||||
|
||||
--get the hostname
|
||||
hostname = freeswitch.getGlobalVariable("hostname");
|
||||
hostname = trim(api:execute("hostname", ""));
|
||||
freeswitch.consoleLog("NOTICE", "Hostname:"..hostname.." Call Hostname:"..call_hostname.."\n");
|
||||
|
||||
--intercept a call that is ringing
|
||||
|
||||
Reference in New Issue
Block a user