Fixed passing fax-info about received faxes to MailFaxRecievd message.
Details: core.py: some fax functions did not return faxInfo even if the C++ implementaion does. Fixed. fax.py: sendinfo now returns the faxInfo like this: ((result, resultB3), faxInfo) idle-script: faxInfo is now taken from fax.sendfax() and included into sendinfo, which is used by MailFaxRecievd message. git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@429 4ebea2bb-67d4-0310-8558-a5799e421b66
This commit is contained in:
parent
4f97c8f413
commit
69398972d7
|
@ -115,19 +115,23 @@ def idle(capi):
|
||||||
|
|
||||||
core.log("job %s from %s to %s initiated" %
|
core.log("job %s from %s to %s initiated" %
|
||||||
(jobnum, user, sendinfo['dialstring']), 1)
|
(jobnum, user, sendinfo['dialstring']), 1)
|
||||||
result, resultB3 = capisuite.fax.sendfax(config, user, capi,
|
result, faxinfo = capisuite.fax.sendfax(config, user, capi,
|
||||||
fax_file, **sendinfo)
|
fax_file, **sendinfo)
|
||||||
|
result, resultB3 = result
|
||||||
core.log("job %s: result was 0x%x, 0x%x" % \
|
core.log("job %s: result was 0x%x, 0x%x" % \
|
||||||
(jobnum, result, resultB3), 1)
|
(jobnum, result, resultB3), 1)
|
||||||
sendinfo['result'] = result
|
sendinfo['result'] = result
|
||||||
sendinfo['resultB3'] = resultB3
|
sendinfo['resultB3'] = resultB3
|
||||||
sendinfo['hostname'] = os.uname()[1]
|
sendinfo['hostname'] = os.uname()[1]
|
||||||
|
if faxinfo:
|
||||||
|
sendinfo.update(faxinfo.as_dict())
|
||||||
|
|
||||||
# todo: use symbolic names for these results to be more
|
# todo: use symbolic names for these results to be more
|
||||||
# meaningfull
|
# meaningfull
|
||||||
send_ok = resultB3 == 0 \
|
send_ok = resultB3 == 0 \
|
||||||
and result in (0, 0x3400, 0x3480, 0x3490, 0x349f)
|
and result in (0, 0x3400, 0x3480, 0x3490, 0x349f)
|
||||||
tries = control.getint("tries") +1
|
tries = control.getint("tries") +1
|
||||||
|
control.set('tries', tries)
|
||||||
if send_ok:
|
if send_ok:
|
||||||
core.log("job %s: finished successfully" % jobnum, 1)
|
core.log("job %s: finished successfully" % jobnum, 1)
|
||||||
control = capisuite.fax.moveJob(controlfile, doneQ, user)
|
control = capisuite.fax.moveJob(controlfile, doneQ, user)
|
||||||
|
@ -152,7 +156,6 @@ def idle(capi):
|
||||||
(jobnum, next_delay), 2)
|
(jobnum, next_delay), 2)
|
||||||
starttime = time.time() + next_delay
|
starttime = time.time() + next_delay
|
||||||
control.set('starttime', time.ctime(starttime))
|
control.set('starttime', time.ctime(starttime))
|
||||||
control.set('tries', tries)
|
|
||||||
control.write(controlfile)
|
control.write(controlfile)
|
||||||
finally:
|
finally:
|
||||||
_releaseLock(lock)
|
_releaseLock(lock)
|
||||||
|
|
|
@ -344,6 +344,7 @@ class Call:
|
||||||
faxInfo = _capisuite.switch_to_faxG3(self._handle,
|
faxInfo = _capisuite.switch_to_faxG3(self._handle,
|
||||||
faxStationID, faxHeadline)
|
faxStationID, faxHeadline)
|
||||||
self.service = SERVICE_FAXG3
|
self.service = SERVICE_FAXG3
|
||||||
|
log('faxinfo: %s' % repr(faxInfo), 3)
|
||||||
if not faxInfo:
|
if not faxInfo:
|
||||||
return FaxInfo()
|
return FaxInfo()
|
||||||
return FaxInfo(*faxInfo)
|
return FaxInfo(*faxInfo)
|
||||||
|
@ -373,6 +374,7 @@ class Call:
|
||||||
"""
|
"""
|
||||||
faxInfo = _capisuite.connect_faxG3(self._handle, faxStationID,
|
faxInfo = _capisuite.connect_faxG3(self._handle, faxStationID,
|
||||||
faxHeadline, delay)
|
faxHeadline, delay)
|
||||||
|
log('faxinfo: %s' % repr(faxInfo), 3)
|
||||||
if not faxInfo:
|
if not faxInfo:
|
||||||
return FaxInfo()
|
return FaxInfo()
|
||||||
return FaxInfo(*faxInfo)
|
return FaxInfo(*faxInfo)
|
||||||
|
@ -394,7 +396,11 @@ class Call:
|
||||||
|
|
||||||
faxfilename: file to send
|
faxfilename: file to send
|
||||||
"""
|
"""
|
||||||
_capisuite.fax_send(self._handle, faxfilename)
|
faxInfo = _capisuite.fax_send(self._handle, faxfilename)
|
||||||
|
log('faxinfo: %s' % repr(faxInfo), 3)
|
||||||
|
if not faxInfo:
|
||||||
|
return FaxInfo()
|
||||||
|
return FaxInfo(*faxInfo)
|
||||||
|
|
||||||
|
|
||||||
def fax_receive(self, filename):
|
def fax_receive(self, filename):
|
||||||
|
@ -413,7 +419,11 @@ class Call:
|
||||||
|
|
||||||
filename: where to save the received fax.
|
filename: where to save the received fax.
|
||||||
"""
|
"""
|
||||||
_capisuite.fax_receive(self._handle, filename)
|
faxInfo = _capisuite.fax_receive(self._handle, filename)
|
||||||
|
log('faxinfo: %s' % repr(faxInfo), 3)
|
||||||
|
if not faxInfo:
|
||||||
|
return FaxInfo()
|
||||||
|
return FaxInfo(*faxInfo)
|
||||||
|
|
||||||
|
|
||||||
class FaxInfo:
|
class FaxInfo:
|
||||||
|
|
|
@ -231,6 +231,8 @@ def sendfax(config, user, capi, faxfile,
|
||||||
outgoing_num, dialstring, stationID=None, headline=None):
|
outgoing_num, dialstring, stationID=None, headline=None):
|
||||||
"""
|
"""
|
||||||
Send a fax out via the capi.
|
Send a fax out via the capi.
|
||||||
|
|
||||||
|
Returns a tuple ((result, resultB3), faxinfo)
|
||||||
"""
|
"""
|
||||||
import capisuite.core as core
|
import capisuite.core as core
|
||||||
|
|
||||||
|
@ -252,8 +254,8 @@ def sendfax(config, user, capi, faxfile,
|
||||||
core.log('result from capi.call_faxG3: %s' % result, 2)
|
core.log('result from capi.call_faxG3: %s' % result, 2)
|
||||||
if result:
|
if result:
|
||||||
# an errror occured
|
# an errror occured
|
||||||
return result, 0
|
return (result, 0), None
|
||||||
call.fax_send(faxfile)
|
faxinfo = call.fax_send(faxfile)
|
||||||
return call.disconnect()
|
return call.disconnect(), faxinfo
|
||||||
except core.CallGoneError:
|
except core.CallGoneError:
|
||||||
return call.disconnect()
|
return call.disconnect(), None
|
||||||
|
|
Loading…
Reference in New Issue