The fax document objects

An application that is going to send or receive a fax must first create a fax document object. This provides a number of useful functions and additional information regarding the fax session. For sending a fax, the fax document object is created by calling FaxToSend, and for receiving a fax calling FaxToReceive. These can only be created if the application was started by a service on cloud.aculab.com that has the appropriate fax capability enabled. Furthermore, an application is allowed to create only one of each type of fax document object, though they can be used more than once during a single application run.

FaxToSend

To have access to the FaxToSend function the application must import it - from prosody.uas import FaxToSend. A call to the function will create and return an object of type ClassFaxToSend which is referred to as a “fax document object”. Once the fax document object has been created it can be used to load the contents of a TIFF file into the document. Thus, the first of its functions to call is set_content, to which we pass the name of the file that we want to read in. Upon calling set_content the file contents will be read into the fax document object and, if this is successful, the fax is ready to send. However, before sending, the contents of the fax document object can be edited. The fax document object provides functions for adding text, appending data from other files, and more. The tutorial has examples that show how the fax document object might be used.

Note that the file must already have been uploaded to cloud.aculab.com. Files can be manually uploaded via the file management page of cloud.aculab.com - while logged in to cloud.aculab.com, click Manage then Media Files. Also have a look at the Web Services API for instructions and examples on automatically uploading files to cloud.aculab.com.

The FaxToSend function can raise an Error exception if, for instance, the service that invoked the application did not have fax send enabled.

Note that only one of these objects can be created within a single application instance. However, the object can be used to send multiple faxes during a single application run.

FaxToReceive

To have access to the FaxToReceive function the application must import it - from prosody.uas import FaxToReceive. A call to the function will create and return an object of type ClassFaxToReceive which is referred to as a “fax document object”. Once the fax document object has been created it can be used to set the name of the TIFF file to which the inbound fax will be written. Thus, the first of its functions to call is set_file_name, which we give the name of the file to which we want the fax to be written. In addition, while the fax is progressing, the fax document object can be used to view details of each page as it comes in. The tutorial has examples that show how the fax document object might be used.

Note that the file will be stored on cloud.aculab.com. Files can be manually downloaded via the file management page of cloud.aculab.com - while logged in to cloud.aculab.com, click Manage then Media Files. Also have a look at the Web Services API for instructions and examples on automatically downloading files from cloud.aculab.com.

The FaxToReceive function can raise an Error exception if, for instance, the service that invoked the application did not have fax receive enabled.

Note that only one of these objects can be created within a single application instance. However, the object can be used to receive multiple faxes during a single application run.