Remove unused code.
This commit is contained in:
@@ -11,6 +11,10 @@
|
|||||||
local send_mail = require "resources.functions.send_mail"
|
local send_mail = require "resources.functions.send_mail"
|
||||||
|
|
||||||
local fax_task_uuid = env:getHeader('fax_task_uuid')
|
local fax_task_uuid = env:getHeader('fax_task_uuid')
|
||||||
|
if not fax_task_uuid then
|
||||||
|
log.warning("No [fax_task_uuid] channel variable")
|
||||||
|
return
|
||||||
|
end
|
||||||
local task = Tasks.select_task(fax_task_uuid)
|
local task = Tasks.select_task(fax_task_uuid)
|
||||||
if not task then
|
if not task then
|
||||||
log.warningf("Can not find fax task: %q", tostring(fax_task_uuid))
|
log.warningf("Can not find fax task: %q", tostring(fax_task_uuid))
|
||||||
@@ -31,7 +35,7 @@
|
|||||||
local domain_name = env:getHeader("domain_name") or task.domain_name
|
local domain_name = env:getHeader("domain_name") or task.domain_name
|
||||||
local origination_caller_id_name = env:getHeader("origination_caller_id_name") or '000000000000000'
|
local origination_caller_id_name = env:getHeader("origination_caller_id_name") or '000000000000000'
|
||||||
local origination_caller_id_number = env:getHeader("origination_caller_id_number") or '000000000000000'
|
local origination_caller_id_number = env:getHeader("origination_caller_id_number") or '000000000000000'
|
||||||
local accountcode = env:getHeader("accountcode")
|
local accountcode = env:getHeader("accountcode") or domain_name
|
||||||
local duration = tonumber(env:getHeader("billmsec")) or 0
|
local duration = tonumber(env:getHeader("billmsec")) or 0
|
||||||
local sip_to_user = env:getHeader("sip_to_user")
|
local sip_to_user = env:getHeader("sip_to_user")
|
||||||
local bridge_hangup_cause = env:getHeader("bridge_hangup_cause")
|
local bridge_hangup_cause = env:getHeader("bridge_hangup_cause")
|
||||||
@@ -142,39 +146,29 @@
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--get the values from the fax file
|
log.debug([[<<< DEBUG >>>
|
||||||
if not (fax_uuid and domain_name) then
|
domain_name = '%s'
|
||||||
local array = split(fax_file, "[\\/]+")
|
domain_uuid = '%s'
|
||||||
domain_name = domain_name or array[#array - 3]
|
task.domain_name = '%s'
|
||||||
local fax_extension = fax_extension or array[#array - 2]
|
task.domain_uuid = '%s'
|
||||||
|
]],
|
||||||
|
tostring(domain_name ),
|
||||||
|
tostring(domain_uuid ),
|
||||||
|
tostring(task.domain_name ),
|
||||||
|
tostring(task.domain_uuid )
|
||||||
|
)
|
||||||
|
|
||||||
if not fax_uuid then
|
assert(fax_uuid, 'no fax server uuid')
|
||||||
local sql = "SELECT fax_uuid FROM v_fax "
|
assert(domain_name, 'no domain name')
|
||||||
sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .. "' "
|
assert(domain_uuid, 'no domain uuid')
|
||||||
sql = sql .. "AND fax_extension = '" .. fax_extension .. "' "
|
assert(domain_uuid:lower() == task.domain_uuid:lower(), 'invalid domain uuid')
|
||||||
fax_uuid = dbh:first_value(sql);
|
assert(domain_name:lower() == task.domain_name:lower(), 'invalid domain name')
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--get the domain_uuid using the domain name required for multi-tenant
|
|
||||||
if domain_name and not domain_uuid then
|
|
||||||
local sql = "SELECT domain_uuid FROM v_domains ";
|
|
||||||
sql = sql .. "WHERE domain_name = '" .. domain_name .. "' "
|
|
||||||
domain_uuid = dbh:first_value(sql)
|
|
||||||
end
|
|
||||||
|
|
||||||
assert(domain_name and domain_uuid)
|
|
||||||
|
|
||||||
--settings
|
--settings
|
||||||
local settings = Settings.new(dbh, domain_name, domain_uuid)
|
local settings = Settings.new(dbh, domain_name, domain_uuid)
|
||||||
local keep_local = settings:get('fax', 'keep_local','boolean')
|
local keep_local = settings:get('fax', 'keep_local','boolean')
|
||||||
local storage_type = (keep_local == "false") and "" or settings:get('fax', 'storage_type', 'text')
|
local storage_type = (keep_local == "false") and "" or settings:get('fax', 'storage_type', 'text')
|
||||||
|
|
||||||
--be sure accountcode is not empty
|
|
||||||
if (accountcode == nil) then
|
|
||||||
accountcode = domain_name
|
|
||||||
end
|
|
||||||
|
|
||||||
local function opt(v, default)
|
local function opt(v, default)
|
||||||
if v then return "'" .. v .. "'" end
|
if v then return "'" .. v .. "'" end
|
||||||
return default or 'NULL'
|
return default or 'NULL'
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ local LEVELS = {
|
|||||||
'warning',
|
'warning',
|
||||||
'notice',
|
'notice',
|
||||||
'info',
|
'info',
|
||||||
|
'debug',
|
||||||
}
|
}
|
||||||
|
|
||||||
local TRACE_LEVEL = 'notice'
|
local TRACE_LEVEL = 'notice'
|
||||||
|
|||||||
Reference in New Issue
Block a user