# Monitoring fax session status

This topic provides information on

- Tracing NaturalFax applications.

- Error handling during a fax session.

An application can actively monitor the progress of a fax session by explicitly querying the status, or passively by monitoring the NaturalFax events on a specified context.

When an application receives an error as part of an event, it can continue sending or receiving the remaining documents in the queue, or abort the fax session with nfxStopSession.

Use nfxGetSessionStatus to obtain a snapshot of the status of the current fax session. This function fills in an NFX_FAX_STATUS structure.

To retrieve information about a specific document, call nfxGetDocStatus. This function fills in an NFX_DOC_STATUS structure.

For more information, refer to:

- Alphabetical error summary

- Overview of events

- Overview of modem metrics

## Tracing NaturalFax applications

You can activate tracing for NaturalFax using Natural Access tracing functions. To use Natural Access tracing:

- ctdaemon must be running.

- ctdaemon must launch a trace thread. Refer to the Natural Access Developer's Reference Manual for more information on ctdaemon.

- The application must enable tracing in the call to ctaInitialize.

If the application enables tracing in ctaInitialize and ctdaemon is not running, ctaInitialize fails. The application must unset the trace mask in CTA_INIT_PARMS to disable tracing, and invoke ctaInitialize again.

- The application must initiate tracing by calling ctaSetTraceLevel with a specific context, the NFX service name, and a mask indicating what to trace.

- The NFX service must be specified in cta.cfg.

The NFX service logs internal trace information to ctdaemon according to the trace mask setting. The following NaturalFax trace masks are available:

Trace mask | Value | Description
--- | --- | ---
NFX_TRACE_T30 | 0x000100 | Logs information relating to T.30 protocol.
NFX_TRACE_CMDEVT | 0x000C00 | Logs all fax commands and events.
NFX_TRACE_ALL | 0x000F00 | Logs all available fax information.

Refer to the Natural Access Developer's Reference Manual for information about Natural Access trace masks.

The following code sample demonstrates setting the trace level:

ctaSetTraceLevel( ctahd, "NFX", NFX_TRACE_T30 | CTA_TRACEMASK_ALL_EVENTS );

## Error handling during a fax session

The application monitors all events during an active fax session (while sending or receiving a fax). Events provide information about error conditions, enabling the application to respond appropriately.

For information on NaturalFax errors returned as part of a NaturalFax DONE event, refer to the NaturalFax events. For information on Natural Access errors returned as part of a NaturalFax DONE event, refer to the Natural Access Developer's Reference Manual.

ADIEVN_BOARD_ERROR can be returned during an active fax session when an unexpected error occurs on your board. Contact NMS Communications with the specific error information. This should be considered a fatal error on this channel.