# Completion events

The NFXEVN_SESSION_DONE event is sent as the last event for all asynchronous NaturalFax functions, regardless of the results or function requested. Always wait for this event before attempting the next function on the current context.

Event | Hex | Description
--- | --- | ---
NFXEVN_SESSION_DONE | 0x05200B | The current fax session has completed.

## NFXEVN_SESSION_DONE values

The following values can appear in the value field of the NFXEVN_SESSION_DONE event:

Error or reason | Hex | Description
--- | --- | ---
CTAERR_BAD_ARGUMENT | 0x7 | Invalid modem rate specified for the modem type. Specify a valid modem type/modem rate combination.
CTAERR_FILE_EXISTS | 0x24 | An attempt was made to create a file that already exists. Remove or rename the existing file, or specify a different file name.
CTAERR_FILE_NOT_FOUND | 0x21 | The specified file does not exist. Create the file or specify a different file name.
CTAERR_FILE_OPEN_FAILED | 0x25 | File open failed due to a system error. Verify that the file exists.
CTAERR_FILE_READ_FAILED | 0x27 | The file is not opened or is locked, or the expected amount of data could not be read. Make sure that the file is of the expected type. Verify that an incorrect handle was not used to close another file.
CTAERR_FILE_WRITE_FAILED | 0x28 | The file is not open or is locked, or the expected amount of data could not be written. Verify that an incorrect handle was not used to close another file.
CTAERR_FUNCTION_ACTIVE | 0xF | A function is already running on the context. Be sure your application waits for a DONE event from other fax or voice operations before initiating a new fax operation.
CTAERR_FUNCTION_NOT_ACTIVE | 0xE | An attempt was made to stop or modify a function that was not running.
CTAERR_FUNCTION_NOT_AVAIL | 0xD | A NaturalFax DSP file was not downloaded to the board.
CTAERR_INVALID_CTAHD | 0x5 | An invalid context handle was passed as an argument to a function or the context was destroyed by another thread.
CTAERR_OUT_OF_MEMORY | 0x6 | Unable to allocate memory for queue, driver or context, for play or record buffers, or for temporary storage. When this error occurs on a DONE event, it may mean that there was insufficient memory on the board.
CTAERR_OUT_OF_RESOURCES | 0x8 | A NaturalFax DSP function could not be started. Check to see that you are using the proper board configuration for your application. Check to see that you have not exceeded the maximum number of fax operations for your hardware configuration.
CTA_REASON_FINISHED | 0x1001 | The fax function terminated normally.
CTA_REASON_RELEASED | 0x1007 | The call was disconnected by the remote fax machine. Check that events are being handled in a timely fashion. Check your host processor CPU loading. The application will also receive ADIEVN_CALL_DISCONNECTED before NFXEVN_SESSION_DONE.
CTA_REASON_STOPPED | 0x1002 | The fax function was stopped by calling nfxStopSession.
NFXERR_BAD_FILE_FORMAT | 0x050207 | The specified file is not in TIFF-F or TIFF-S format.
NFXERR_BAD_PAGE_SIZE | 0x05020B | Unsupported page size.
NFXERR_BUFFER_UNDERRUN | 0x050211 | On fax transmit, buffers of image data have not been provided. Check your host computer loading to be sure events and disk I/O are being processed in a timely fashion.
NFXERR_CARRIER_LOST | 0x05021D | The received signal has fallen below the level specified by NFX_RECEIVE_PARMS.threshold, and the fax session has been terminated.
NFXERR_CONNECT_FAILED | 0x050201 | The called fax machine was not detected. Check that the number you are dialing is connected to a fax machine.
NFXERR_CONVERSION_REQUIRED | 0x05020C | Cannot transmit a file because there is a mismatch between the stored file format and the receiving fax terminal's capabilities and on-the-fly conversion has been disabled (otfmode in the receive or transmit parameters is set to NFX_OTF_NEVER).
NFXERR_FAX_SERVICE | 0x050219 | A fatal error occurred in the FAX service.
NFXERR_FXM_SERVICE | 0x05021A | A fatal error occurred in the FXM service.
NFXERR_INCOMPATIBLE_RECEIVER | 0x050216 | The application has disabled on-the-fly conversion and the receiver can not handle the specified image format.
NFXERR_INTERNAL_ERROR | 0x58000-0x5FFFF | An unexpected internal error has occurred.
NFXERR_NEGOTIATION_FAILED | 0x050202 | Failed T.30 fax negotiation at the beginning of a session or between documents. When transmitting, this error indicates that training failed (usually due to bad phone line quality) or that the transmitter and receiver capabilities do not match. When receiving, this error indicates that training failed.
NFXERR_NO_MODEMS | 0x050213 | The required DSP files are not configured or loaded to the board. The FXM service failed to start.
NFXERR_NO_PPM | 0x050214 | The receiver has not received a correct post-page message.
NFXERR_NO_PPM_RESPONSE | 0x050215 | The receiver has not returned a correct response to the post-page message.
NFXERR_NO_REMOTE | 0x05021C | The called fax terminal did not send a DIS signal.
NFXERR_OPEN_QUEUE_FAILED | 0x05020A | Could not open the specified document queue. Check that you have a valid transmit queue.
NFXERR_PROTOCOL_ERROR | 0x050217 | A T.30 protocol error occurred.
NFXERR_QUEUE_EMPTY | 0x050206 | The specified document queue is empty.
NFXERR_QUEUE_TOO_LATE | 0x050208 | Attempted to enqueue a file in an active transmit queue too late in the fax session.
NFXERR_RATE_TOO_LOW | 0x050210 | The receiving or transmitting fax terminal is attempting to receive or transmit at a rate lower than the minrate parameter.
NFXERR_REMOTE_DCN | 0x05021B | The remote terminal has sent an unexpected disconnect (DCN) command frame.
NFXERR_RETRAIN_NEGATIVE | 0x05021E | The page was received with errors, and NaturalFax has requested that the remote transmitter retransmit the last page.
NFXERR_SESSION_FAILED | 0x050209 | The fax session failed due to an unexpected event. May indicate a T.30 timeout or failure to receive a post-page message. Check your host processor CPU and I/O loading.
NFXERR_T5_TIMEOUT | 0x05021F | The receiver is not ready to receive after T5 (60 +/- 5 seconds).