The fax to receive class

class UASClassFaxToReceive

This class is created to configure a fax document to which to receive an inbound fax. To create this class the application will call the FaxToReceive function, and this needs to be imported first:

from prosody.uas import Hangup, Error, FaxToReceive

A call to the function will create and return an object of type ClassFaxToReceive which is referred to as a “fax document object”.

This class exposes a public property called PageDetails which is a list of the pages received so far. Each element of the list is of type ReceivedPageDetails which provides details of the fax page that has been received.

In addition, this class will record a number of causes, described below, that can be returned as the result of the functions it provides.

An object of this type is created independently of the call channel. A connected call is not required to create this object or to use the functions it provides.

Usage example:

from prosody.uas import Hangup, Error, FaxToReceive

__uas_version__  = "0.0.1"
__uas_identify__ = "application"

def main(channel, application_instance_id, file_man, my_log, application_parameters):
    my_fax = FaxToReceive()
    my_fax.set_file_name('my_rx_fax_{0}.tif'.format(application_instance_id))
class FileCause

These are the causes that can be returned by the functions provided by a FaxToReceive document object.

The causes are:

NORMAL
The task completed normally.
FILE_ACCESS_ERROR
A file access error occurred.
TIMEOUT
A timeout occurred whilst waiting for the filename to be set.

Usage example:

cause = my_fax.set_file_name('my_inbound_fax.tif')
if cause == my_fax.FileCause.FILE_ACCESS_ERROR:
    print("Could not access the file for writing")
UASClassFaxToReceive.set_file_name(filename, cipher=None)

Set the name of the TIFF file to which the inbound fax will be saved.

Required argument:
  • filename
    The name of the file to which to write the inbound fax.
Optional arguments:
  • cipher
    if the fax to receive is to be encrypted, supply the cipher here.

When this function completes, it will return a cause of type FileCause.

Usage example:

cause = my_fax.set_file_name('my_inbound_fax.tif')
if cause != my_fax.FileCause.NORMAL:
    print("File error cause {0}".format(cause))

Previous topic

The fax PageText property

Next topic

Received fax Details