Developing a Fax Application

BT_ZERO(args_fax);

args_fax.fmt = FMT_MMR_ALIGN_MSB; BfvFaxSetReceiveFmt(lp,&args_fax);

Sets the format used to pass the received fax data from the channel to the computer. In this example, MMR data format – byte aligned, most significant bit first – is specified. See the fmt parameter description for detailed information on all of the data format types that are available through BfvFaxSetReceiveFmt.

BT_ZERO(args_fax); args_fax.r_ips = ips; args_fax.local_id = local_id; BfvFaxReceive (lp, &args_fax);

Receives fax pages and puts them into the infopkt stream ips.

BT_ZERO(args_infopkt); args_infopkt.ips = ips; BfvInfopktClose (&args_infopkt);

Closes the infopkt stream file after the file is received.

BT_ZERO(args_admin);

BfvLineDetach (lp, &args_admin);

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

Receiving a Noninfopkt-Formatted Fax and Storing It in MR Format

A typical way to receive a fax that is made up of noninfopkts and store it in MR data format is demonstrated below. Each function is presented in sequential order, and the action it performs is described beneath it.

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

79

Page 79
Image 79
Dialogic 6.2 manual Argsfax.fmt = Fmtmmralignmsb BfvFaxSetReceiveFmtlp,&argsfax