mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-01 13:39:21 +00:00
Correct the primary key of v_fax_tasks table. Coding standards require primary key to remove v_ prefix, singular form and add a _uuid postfix. Result is task_uuid has been changed to fax_task_uuid.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
-- @usage without queue
|
||||
-- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(fax_queue/exec.lua)
|
||||
-- @usage with queue task
|
||||
-- api: originate {task_uuid=''}user/108@domain.local &lua(fax_queue/exec.lua)
|
||||
-- api: originate {fax_task_uuid=''}user/108@domain.local &lua(fax_queue/exec.lua)
|
||||
-- @fax_dtmf
|
||||
-- 0-9*# - dtmf symbols
|
||||
-- @200 - dtmf duration in ms
|
||||
@@ -16,12 +16,12 @@ require "resources.functions.config"
|
||||
local log = require "resources.functions.log".fax_task
|
||||
|
||||
-- If we handle queue task
|
||||
local task_uuid = session:getVariable('task_uuid')
|
||||
local task if task_uuid then
|
||||
local fax_task_uuid = session:getVariable('fax_task_uuid')
|
||||
local task if fax_task_uuid then
|
||||
local Tasks = require "fax_queue.tasks"
|
||||
task = Tasks.select_task(task_uuid)
|
||||
task = Tasks.select_task(fax_task_uuid)
|
||||
if not task then
|
||||
log.warningf("Can not found fax task: %q", tostring(task_uuid))
|
||||
log.warningf("Can not found fax task: %q", tostring(fax_task_uuid))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
local Settings = require "resources.functions.lazy_settings"
|
||||
local Tasks = require "fax_queue.tasks"
|
||||
|
||||
local task_uuid = env:getHeader('task_uuid')
|
||||
local task = Tasks.select_task(task_uuid)
|
||||
local fax_task_uuid = env:getHeader('fax_task_uuid')
|
||||
local task = Tasks.select_task(fax_task_uuid)
|
||||
if not task then
|
||||
log.warningf("Can not find fax task: %q", tostring(task_uuid))
|
||||
log.warningf("Can not find fax task: %q", tostring(fax_task_uuid))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ local Q850_TIMEOUT = {
|
||||
|
||||
local select_task_common_sql = [[
|
||||
select
|
||||
t1.task_uuid as uuid,
|
||||
t1.fax_task_uuid as uuid,
|
||||
t1.fax_uuid as fax_uuid,
|
||||
t3.domain_name,
|
||||
t3.domain_uuid,
|
||||
@@ -62,11 +62,11 @@ and t2.fax_send_channels > (select count(*) from v_fax_tasks as tasks
|
||||
order by t1.task_next_time
|
||||
]]
|
||||
|
||||
local select_task_sql = select_task_common_sql .. "and t1.task_uuid='%s'"
|
||||
local select_task_sql = select_task_common_sql .. "and t1.fax_task_uuid='%s'"
|
||||
|
||||
local aquire_task_sql = [[
|
||||
update v_fax_tasks set task_status = 1, task_lock_time = ]] .. date_utc_now_sql .. [[
|
||||
where task_uuid = '%s' and task_status = 0
|
||||
where fax_task_uuid = '%s' and task_status = 0
|
||||
]]
|
||||
|
||||
local wait_task_sql = [[
|
||||
@@ -77,19 +77,19 @@ local wait_task_sql = [[
|
||||
task_no_answer_retry_counter = %s,
|
||||
task_retry_counter = %s,
|
||||
task_next_time = ]] .. now_add_sec_sql .. [[
|
||||
where task_uuid = '%s'
|
||||
where fax_task_uuid = '%s'
|
||||
]]
|
||||
|
||||
local remove_task_task_sql = [[
|
||||
delete from v_fax_tasks
|
||||
where task_uuid = '%s'
|
||||
where fax_task_uuid = '%s'
|
||||
]]
|
||||
|
||||
local release_task_sql = [[
|
||||
update v_fax_tasks
|
||||
set task_status = 0, task_lock_time = NULL,
|
||||
task_next_time = ]] .. now_add_sec_sql .. [[
|
||||
where task_uuid = '%s'
|
||||
where fax_task_uuid = '%s'
|
||||
]]
|
||||
|
||||
local release_stuck_tasks_sql = [[
|
||||
@@ -131,10 +131,10 @@ local function next_task()
|
||||
end
|
||||
end
|
||||
|
||||
local function select_task(task_uuid)
|
||||
local function select_task(fax_task_uuid)
|
||||
local db = get_db()
|
||||
|
||||
local task, err = db:first_row(select_task_sql:format(task_uuid))
|
||||
local task, err = db:first_row(select_task_sql:format(fax_task_uuid))
|
||||
if not task then return nil, err end
|
||||
|
||||
task.no_answer_counter = tonumber(task.no_answer_counter)
|
||||
|
||||
Reference in New Issue
Block a user