BFAX_SEND_FAX

Purpose

This state table provides the interface to the Brooktrout functionality in Blueworx Voice Response for sending a fax. There are two ways that a fax can be sent:
  • On the same call (one-call fax)
  • Queued to be sent after a specified time delay (two-call fax)

BFAX_SEND_FAX will determine which method is being used by the callback_st parameter. If callback_st is empty, the fax will be sent on the same call. If, however, callback_st contains a state table name the fax will be queued, and when the fax is actually sent (during a second call) the specified state table will be invoked in order to log the status of the fax-send operation.

ASCII syntax

InvokeStateTable ("DIRECT", BFAX_SEND_FAX, begin, filename, profile_id, callback_st, curlistfile, calling_number, called_number, device_rc, device_state);

Entry Point

The entry point for this state table is begin

Parameters

filename (STRING)
Full path and file name of the file containing the fax image or file containing a file-list (that is, names of fax image or text files). The file permission must be set so that the file is readable by all users. The file extension determines the file type. Supported extensions are:
tif - tag image format

When a single .tif file is processed an initial check is made to see whether the file exists and can be read. If it cannot, an error is reported; otherwise, the .tif file is sent using the Brooktrout API. If a problem is detected while the fax is being sent, an error is reported.

TIFF files have been categorized into Classes to reduce the information burden on TIFF readers and writers that want to support narrow applications. TIFF Class F file format defines a file format that is simultaneously suitable for native use in Group 3 computer facsimile products and for use as a file-interchange medium with the outside world. Greater details concerning TIFF Classes, in particular TIFF Class F file format, are available in a Brooktrout Technology Technical White Paper and can be found at the Brooktrout Web site by going to www.brooktrout.com.

txt - ASCII
When a single .txt file is processed, an initial check is made to see whether the file exists and can be read. If it cannot, an error is reported; otherwise, a temporary .tif file name is generated and the .txt file is then converted to a .tif file. If there is an entry in the Text2TifConversion field in the BFIT screen then this script or utility will be used to carry out the conversion; otherwise, the one supplied by the Brooktrout API will be used. The conversion utility must adhere to the following command syntax:
  <text-tiff-utility-name> <filename.txt> <filename.tif>
The .tif file is then sent using the Brooktrout API. If a problem is detected while the fax is being sent, an error is reported.
pcx - PCX

Provided that the user can supply a utility to convert files from PCX to TIFF-F format, the fax feature is able to handle PCX files for transmission.

The full path and file name of the utility must be specified in the PCX to TIFF conversion configuration parameter (for information on how to do this see Brooktrout Fax Interface Tool).

The conversion utility must adhere to the following command syntax:

  <pcx-tiff-utility-name> <filename.pcx> <filename.tif>
Note that the PCX files themselves must have .pcx as their file extension.
lst - ListFile

When a .lst file is processed, an initial check is made to see whether the file exists and can be read. If it cannot, an error is reported; otherwise, the file is opened and each line of the file is read and checked. The checks are to ensure that the file specified by the line exists, can be read, and has a supported file extension (that is .tif, .txt and .pcx, but a list file within a list is not supported). If any of the files do not exist, an error is reported and the whole job is abandoned (even good files are not transmitted in this case).

The list file is then processed, by creating an array of .tif files to be sent. For each file in the list, if it is a .tif file then the file name is just added to the array. If it is a .txt file then a temporary .tif file name is created and added to the array and the .txt file is converted (in accordance with the method specified above for a single .txt file). If the file cannot be converted, an error is reported and the transmission of the list is terminated.

Once all the lines in the list file have been read and added to the array, the entire array (of .tif files) is sent using the Brooktrout API. If a problem is detected while sending the fax, an error is reported. At this point any temporary .tif files are then deleted.

profile_id (STRING)
This is the Blueworx Voice Response profile that is sending the fax (usually set to SV20). This is optional and is used only for logging purposes.
callback_st (STRING)
This is the name of the state table to be invoked after the fax is sent from the queue. If this is empty, the fax will be sent on the same call. See the section BFAX_CALL_BACK for details of the BFAX_CALL_BACK state table.
curlistfile (STRING)
This parameter is reserved for future use. Set it to be an empty string.
calling_number (STRING)
This is the number of the device sending the fax. This is usually set to SV186. Within the context of a call, the calling number and called number may switch roles. This will require swapping these two fields and it is the responsibility of the application to determine when swapping is appropriate.
called_number (STRING)
This is the telephone number to which the fax will be sent. This is usually set to SV185. See the parameter description for calling_number above, regarding swapping calling number and called number.
device_rc (NUMBER)
This will be set to zero if the fax was successfully sent or queued. See Return codes for the possible return codes.
device_state (NUMBER)
This indicates the state of the fax handler. If a fax was queued (if callback_st does not equal null) the number will be 7; if the fax was sent (if callback_st was null) the number will be 8, and if the number is -1 an error has occurred and device_rc should be checked.

Return codes

0
success
-500
failed to communicate with the custom server
400
  • file does not exist (for example, invalid file name specified)
  • file is not accessible (check file permissions)
  • file is empty
401
unable to parse list file
402
unsupported extension on file name
403
bad file detected in list file: that is, error code 400 or 402 applies to it
404
Brooktrout fax API failed to handle text file. Problems include:
  • unable to open it
  • unable to close it
  • unable to send part or all of it
  • unable to receive all or part of it (for example, nonexistent directory specified)
405
Brooktrout fax API failed to handle TIFF file. Problems include:
  • unable to open it
  • unable to close it
  • unable to send part or all of it
  • unable to receive all or part of it (for example, nonexistent directory specified)
406
dynamic memory allocation error
407
failed to convert fax file to .tif format (with user-supplied utility)
408
channel number is invalid
409
file name error: for example, generated file name too long
410
failed to get free fax channel
411
name of callback state table is too long
412
invalid characters in the state table name
413
invalid fax number (for example, wrong number of digits)
414
failed to place fax on the queue
415
invalid send type (allowed values are: 0 = send immediately; 1 = queue it)
416
failed to get timeslot for fax card or DTTA card
460
failed to invoke custom server function
470
state table action MakeCall() failed
480
internal error (for example, function called with invalid parameter)
490
device error (Brooktrout fax API call failed)

In addition, many of the error codes corresponding to values of CA_errno may be returned in the variable device_rc if an invocation by the custom server of one of the CA_XXX family of functions fails for some reason. These error codes start at value 51 (50 is actually the first code but as this represents the 'no error' case it will never actually be seen). For an explanation of these error codes, see Blueworx Voice Response for AIX: Custom Servers, "Error Return Codes".

Edge

0
success
1
failure

Description

On return from BFAX_SEND_FAX for queued requests (callback_st not null) device_rc will be set to 0, and device_state set to 7 (QUEUED). If device_state is set to -1, fax queuing failed and device_rc should be checked for the failure reason.

BFAX_SEND_FAX also allows immediate faxing (no queuing). For immediate operation, callback_st must be set to null. The status of an immediate send fax operation is returned in device_rc and device_state. On return, for immediate SendFax request (callback_st = null), device_rc will be set to 0, and device_state set to 8 (SENT). If device_state = -1, immediate fax send failed: check device_rc for failure reason.

SendFax can be invoked again when control returns to the application state table. If device_state does not = 7 (QUEUED) or 8 (SENT), this does not prevent the application state table from retrying the SendFax operation.

If the filename parameter contains a listfile (.lst), each line in the listfile must have the following format:
  <One or two digit record number><comma></full-pathname/filename>
For example:
01,/myfax_directory/fax01.tif
02,/myfax_directory/fax02.tif
03,/myfax_directory/fax03.tif

Record numbers must start at 1; they must be sequential and unique — duplicate record numbers are not allowed.

Listfiles can be used on immediate or queued send-fax requests to send a list of faxes within the context of a single call. Verification (existence and accessibility check) of each file within the list is performed prior to processing any files in the list. If verification fails, listfile processing is terminated, device_rc will be set to the appropriate value see Return codes and device_state will be set to -1. If unrecoverable errors occur during transmission of a listfile, the fax operation will terminate, device_rc will be set to the appropriate error code, and device_state will be set to -1 (FAIL).

Prerequisite: An available Blueworx Voice Response channel and enough file system space to create fax-record-file(s) for requested fax operation.

Queued faxes are processed in First-In-First-Out (FIFO) order.

The status of a queued send-fax operation is made available to the application via the application callback state table. After each BFAX_SEND_FAX attempt, the specified callback state table indicated in callback_st is invoked at the entry point labelled begin and passed a set of parameters as detailed in the section which deals specifically with the BFAX_CALL_BACK state table.
Note: The BFAX_CALL_BACK state table must return control using the ExitStateTable action after processing BFAX_SEND_FAX status information. The expected return edge from the BFAX_CALL_BACK state table is '0'.