right  Talk To Us!

How do I enable fax tracing to a file?

To enable fax tracing to a file in your fax application, do the following:-

  1. Add the following headers to your application.

    #include "bfile.h"
    #include "bfopen.h"

  2. Add the following code after opening the fax session.

    // NOTE : You must set logFileName
    char *logFileName;
    SMFAX_TRACE_PARMS faxTraceParms;
    BFILE * logFile = 0;
    long int logLevel = TRACE_ALL;
    int rc = 0;

    ACU_INIT_SM_STRUCT(&faxTraceParm);

    if(logLevel)
    {
    rc = bfile(&logF);
    if(0 == rc)
    {
    // assuming faxSession is the pointer to your fax session.
    faxTraceParms.fax_session = &faxSession;
    faxTraceParms.log_file = logFile;
    faxTraceParms.trace_level = logLevel;

    rc = bfopen(logFile, logFileName, "wtc");|
    // if there is an error opening the log file, destroy it.
    if(rc != 0)
    {

    printf( ?Could not open trace file\n? );
    if(logFile)
    {

    bfile_dtor(logFile);
    logFile = 0;
    }
    }
    }
    }

  3. Add the following code before fax negotiation.

    if(logFile)
    rc = smfax_trace_on(&faxTraceParms);

  4. Add the following code after closing the fax session.
    if(logFile)
    rc = bfile_dtor(logFile);