To do a lengthy operation after receiving a fax, we strongly recommend creating a separate worker-box FS file to perform the operation. This is because the calling party will have already dropped the call before the post-receive operation is started, allowing a further call to be offered, but the CopiaFacts channel thread will still be busy on the post-receive operation.
![]() | CopiaFacts now includes a comprehensive set of scripts to handle post-receive and post-transmit notifications. For most applications you should use the standard scripts in preference to this example. |
This is especially important for systems which have a small number of inbound lines, as well as for systems of any size which have a high volume of inbound calls.
Initiating the post-receive operation
The post-receive operation is initiated in the normal way, by means of a $post_receive command in the MBX file, of type infobox or infoboxall. Instead of starting an infobox sequence to perform the lengthy operation, it will instead transfer to a simple infobox which creates a worker-box FS file. The MBX file should therefore contain for example:
$post_receive PRWORKER infobox
Use the keyword infoboxall to call the post-receive operation for failed receive operations as well as successful receive operations.
The post-receive infobox
The post-receive infobox may need to transfer variables pertaining to the received fax into the worker-box FS file. These variables are of three types:
•user variables set by $set_var statements in the post-receive infobox
•system variables such as DNIS and ANI which refer to the received call
•PR_... variables which refer to the received fax.
The first two types are copied by specifying the $var_def_copy command with no parameters. The third type is copied by specifying the same command with parameter PR.
The post-receive infobox should therefore normally contain just the following commands (FS commands in red):
; PRWORKER.IIF post-receive using worker box
$type FSFILE
$var_def_copy ; copy system variables
$var_def_copy PR ; copy PR_... variables
$worker_box PRLENGTHY ; post-receive taking time to process
$fax_user @FFUSER\FAX.USR
$next_box s:IIF_PROC_COMPLETE
Note that omitting the $fax_user command from the FS file will cause an FS command to be automatically generated referencing the USR file which controlled the inbound call.
The worker-box infobox
In the worker-box infobox you need to perform the operation which might have taken too long to complete if performed at post-receive time. The variables you have specified to be copied will be defined on FS-file $var_def commands and will be available for use. For example you might wish to convert the received TIF file to a PDF file, as follows:
; PRLENGTHY.IIF worker box to convert file
$type decision
$set_var RES "$fn:convertfile(@PR_FAXPATH,@PR_FAXPDF)"
$if @RES < 0
$next_box PRERROR
$else
$next_box s:KILL_MAINT_OP
$endif
Note that for simple fax-to-email applications it is not necessary to convert to PDF explicitly, because this can be achieved by specifying a pdf content-type on $email_attach.