Clean up orphan FS files

(cannot be run directly from a command-line)

The CLEARACTIVE program is provided for other Copia programs to call to clear up any FS files left active when a CopiaFacts node terminates abnormally. It is called (or its functionality is performed by other means):

before a node is started up in the COPIAFACTS program,

in most situations of the faxing engine terminating abnormally, and

by OMACHECK when the failure of a node is detected.

The processing done by CLEARACTIVE first involves a scan of all the .FS marker files in the ACTIVE folder, to find those which 'belong' to the node. For each, the corresponding real FS file is found if present in any of the TOSEND folders. Any FS with a $fax_status1 value of 3 (indicating that a fax, voice or e-mail outbound operation was in progress) has the status set back to 2 (indicating 'ready') and an $attempt_record appended with failure code 66. If there are already three code 66 attempts in the file, it is moved to FAIL, also with a failure code of 66. Because the CopiaFacts node will not be running at the time, no postprocessing is done for such failures. This situation would only arise if a node was repeatedly started and failed while processing the same FS file.

The CLEARACTIVE processing also clears from the ACTIVE folder any files named with the dialed phone number (which block other nodes from calling the same number) which belong to the node being dealt with.