Developing a Fax Application

BT_ZERO(args_fax);

args_fax.fname = "memo.txt"; args_fax.fmt = DATA_ASCII; BfvFaxSendFile(lp, &args_fax);

Sends the ASCII text file, memo.txt the only file on the second page, to the driver.

BfvFaxEndOfDocument(lp, &args_fax);

Indicates to the driver that the second page is the last page of the transmission.

BT_ZERO(args_admin);

BfvLineDetach (lp, &args_admin);

Frees all the memory for the attached line and closes the device.

Receiving a Fax Using Function Calls for Noninfopkt-Formatted Raw G3 Files

One way to receive a fax using function calls for noninfopkt-formatted raw G3 files is demonstrated below. Each function is presented in sequential order, and the action it performs is described beneath it.

This example receives fax data into a buffer only and does not include instructions for further processing the contents of the buffer.

BT_ZERO(args_admin); args_admin.unit = unit;

lp = BfvLineAttach(&args_admin);

Attaches to a free channel and gets a BTLINE pointer.

args_admin.config_file_name = "usrcnfig.cfg"; BfvLineReset(lp,&args_admin);

Resets the channel and sets the user-configured options in the user-defined configuration file usrcnfig.cfg.

BT_ZERO(args_tel); args_tel.timeout = 0L; BfvLineWaitForCall (lp, &args_tel);

Waits for the detection of an incoming call.

BfvLineAnswer (lp, &args_tel);

Answers the phone line by going off-hook.

November 2009

73

Page 73
Image 73
Dialogic 6.2 manual Attaches to a free channel and gets a Btline pointer