diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/freeswitch/scripts/dialplan/fax.lua | 8 | ||||
-rw-r--r-- | misc/freeswitch/scripts/send_fax.lua | 5 |
2 files changed, 5 insertions, 8 deletions
diff --git a/misc/freeswitch/scripts/dialplan/fax.lua b/misc/freeswitch/scripts/dialplan/fax.lua index 8cfa9e5..6dce0a9 100644 --- a/misc/freeswitch/scripts/dialplan/fax.lua +++ b/misc/freeswitch/scripts/dialplan/fax.lua @@ -4,7 +4,7 @@ module(...,package.seeall) -FAX_DOCUMENTS_DIRECTORY = '/var/spool/freeswitch/' +FAX_SPOOL_DIRECTORY = '/var/spool/freeswitch/' FAX_PARALLEL_MAX = 8; Fax = {} @@ -18,7 +18,7 @@ function Fax.new(self, arg) self.log = arg.log; self.database = arg.database; self.record = arg.record; - self.fax_directory = arg.fax_directory or FAX_DOCUMENTS_DIRECTORY; + self.fax_spool_directory = arg.fax_spool_directory or FAX_SPOOL_DIRECTORY; return object; end @@ -79,7 +79,7 @@ end -- List waiting fax documents function Fax.queued_for_sending(self, limit) limit = limit or FAX_PARALLEL_MAX; - local sql_query = 'SELECT * FROM `fax_documents` WHERE `state` IN ("queued_for_sending","unsuccessful") AND `retry_counter` > 0 ORDER BY `sent_at` ASC LIMIT ' .. limit; + local sql_query = 'SELECT * FROM `fax_documents` WHERE `state` IN ("queued_for_sending","unsuccessful") AND `retry_counter` > 0 AND `tiff` IS NOT NULL AND `tiff` != "" ORDER BY `sent_at` ASC LIMIT ' .. limit; local fax_documents = {} self.database:query(sql_query, function(fax_entry) fax_entry['destination_numbers'] = Fax:destination_numbers(fax_entry.id) @@ -136,7 +136,7 @@ end -- Receive Fax function Fax.receive(self, caller, file_name) - file_name = file_name or self.fax_directory .. 'fax_in_' .. caller.uuid .. '.tiff'; + file_name = file_name or self.fax_spool_directory .. 'fax_in_' .. caller.uuid .. '.tiff'; caller:set_variable('fax_ident', self.record.station_id) caller:set_variable('fax_verbose', 'false') diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index 4898cb8..d717f93 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -2,7 +2,6 @@ -- (c) AMOOMA GmbH 2012-2013 -- -local FAX_FILE_PATH = "/opt/GS5/public/uploads/fax_document/tiff/"; local FAX_ANSWERING_TIMEOUT = 20; -- Set logger @@ -142,13 +141,11 @@ end if session and session:answered() then log:info('FAX_SEND - sending fax_document=' .. fax_document.id .. ' (' .. fax_document.tiff .. ')'); - local file_name = FAX_FILE_PATH .. fax_document.id .. "/" .. fax_document.tiff; - session:setVariable('fax_ident', fax_account.record.station_id) session:setVariable('fax_header', fax_account.record.name) session:setVariable('fax_verbose', 'false') local start_time = os.time(); - session:execute('txfax', file_name); + session:execute('txfax', fax_document.tiff); fax_state = { state = nil, |