# nfxStopSession

Stops a current send or receive operation.

#### Prototype

DWORD nfxStopSession ( CTAHD ctahd)

Argument | Description
ctahd | Context handle returned by ctaCreateContext.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | A function argument is invalid.
CTAERR_FUNCTION_NOT_ACTIVE | The specified context has no active fax function.
CTAERR_INVALID_CTAHD | The specified context handle is invalid.

#### Events

Event | Description
NFXEVN_SESSION_DONE | The fax session completed with the terminating reason code of CTA_REASON_STOPPED.

#### Details

After the application invokes nfxStopSession, NaturalFax immediately terminates the current send or receive operation. Cancellation is complete when the NFXEVN_SESSION_DONE event arrives.

Use this function when the application encounters an unexpected error. The fax session terminates abruptly, and is not completed with a T.30 DCN message. Use this function also when the telephone call is terminated by the remote end and the application is not using Natural Call Control or NMS ISDN for Natural Call Control (layer 4) functions for call control.

For example, when low layer ISDN protocols are used by the application, NaturalFax is not notified when the call is released. Therefore, the application must use nfxStopSession to terminate an active fax session. For more information, refer to Terminating and shutting down.

For more information on monitoring fax session status, refer to Monitoring fax session status.

#### See also

nfxAnswerFaxPoll, nfxReceiveFax, nfxSendFax