(Page 7 of 13 in this chapter)
2.6 Transmitting and Receiving Faxes
- An active fax session is the transmitting or receiving of document queues. A fax session can include the polling of a remote fax terminal or responding to a poll request from a remote fax terminal.
Note: Keep in mind that you must continue processing events during an active fax session. Make sure that file I/O intensive operations, such as TIFF-F format verification, do not interfere with the handling of events and cause the fax session to time out. Events must be processed within three seconds.
2.6.1 Transmitting Faxes
- Use nfxSendFax to transmit all the documents in a specified send queue. You can track which documents are successfully sent by monitoring events during transmission.
- Usually NaturalFax will end a fax session by transmitting a DCN (disconnect) frame and sending an NFXEVN_SESSION_DONE event to the application. The transmitting fax terminal must use an ADI service function call to release the call after the DONE event is received.
- It is also possible to transmit a procedure interrupt request (PRI) frame to the receiving fax terminal after completing a send operation. PRI requests that the receiving fax terminal permit an operator action such as picking up the handset for voice. See nfxSendFax details in Chapter 4 for more details on PRI requests.
2.6.2 Receiving Faxes
- An application must have a receive queue prepared in order to call nfxReceiveFax and receive a queue of documents. For each fax document received, NaturalFax will store a separate file using the list of files specified by the NaturalFax receive queue for that CTA context. If the sending fax terminal indicates that it is starting a new document and NaturalFax has already received into all available documents in the receive queue, the nfxReceiveFax operation ends with an NFXEVN_SESSION_DONE event that contains a reason of NFXERR_NO_MORE_DOCUMENTS.
- Figure 4 depicts the functions involved in a typical fax transmit or receive application. Note that the NaturalFax functions for transmitting and receiving a fax take place when a call is in the connected state. The queue may also be destroyed after the call is disconnected.

Figure 4. Functions for a Typical Fax Application
- Figure 5 depicts a typical fax and voice application. In this application, the document queue is created when the call is in the connected state.

Figure 5. Functions for a Typical Fax and Voice Application
2.6.3 Polling the Called Fax Terminal
- The fax polling operation allows the called fax terminal to send a queue of documents to the calling fax terminal. A caller may send any number of documents in a single queue and then poll the remote fax terminal. All documents in the send queue are transmitted before the called fax terminal can be polled.
- To request polling, call nfxSendFax with a non-NULL receive_queue_handle argument. Since the calling fax terminal will be receiving faxes, it must have a receive queue ready to accept the received document files.
- The receive_queue_handle argument controls polling. A call to nfxSendFax with a NULL send_queue_handle and a non-NULL receive_queue_handle will initiate a fax session that polls the called fax terminal without transmitting any documents first.
- Figure 6 shows an example of receiving a polled fax after transmitting.

Figure 6. Polling the Remote Receiver
2.6.4 Answering a Poll Request
- To enable polling from the receiving fax terminal, make sure that polling is enabled in NFX_RECEIVE_PARMS (pollingenabled = NFX_YES). The application is then notified of a poll request when it receives an NFXEVN_POLLED event. Even with polling enabled, the application must decide if it will answer a poll request and prepare a send queue or use an already prepared send queue of documents. When responding to a poll request, the application uses nfxAnswerFaxPoll to transmit its send queue, rather than nfxSendFax.
- If polling is not enabled, a polled event is not generated (even if a poll request is made by the remote transmitter) and the fax session terminates.
- nfxAnswerFaxPoll must be called within three seconds of the receipt of NFXEVN_POLLED event. If the application does not respond to the poll within three seconds, it receives NFXEVN_SESSION_DONE event. Alternately, nfxStopSession may be called to refuse the poll request from the remote fax terminal.
- Figure 7 shows NaturalFax transmitting a document by having polling enabled.

Figure 7. Polling the Remote Transmitter
(Page 7 of 13 in this chapter)
tech_support@nmss.com
Copyright © 1997, Natural MicroSystems, Inc. All rights
reserved.