beautypg.com

Dialogic 6.2 User Manual

Page 81

background image

Developing a Fax Application

November 2009

81

BfvFaxEndReception(lp, &args_fax);

Call this function when there are no more pages to receive.

BT_ZERO(args_admin);

BfvLineDetach (lp, &args_admin);

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

Sending a Noninfopkt-Formatted Fax Stored in MMR Format

One way to send 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 sends a one-page fax whose page and strip data are

stored in noninfopkt-formatted files. The page consists of a Group 3

document (mmrdoc.g3) that is stored on disk in MMR format.

The application controls the format of images sent to the channel;

this format is independent of the format of data transmitted by the

channel.

BT_ZERO(args_admin);

args_admin.unit = unit;

lp = BfvLineAttach(&args_admin);

Attaches to a free channel and gets a line pointer.

args_admin.config_file_name = "usrcnfig.cfg";

BfvLineReset(lp,&args_admin);

Resets the channel and sets the user-configured options selected in

the user-defined configuration file named usrcnfig.cfg.

BT_ZERO(args_tel);

args_tel.phonenum = "w7814499009";

args_tel.call_protocol_code = CALL_PROTOCOL_FAX;

args_tel.func = userfunc;

args_tel.arg = userarg;

BfvLineOriginateCall(lp,&args_tel);

Dials the phone number, monitors call progress, and calls the user

function to optionally decide when to terminate call progress.

BT_ZERO(args_t30);

args_t30.bit_rate = BITRATE_14400;

args_t30.scan_time = SCANTIME_0;

BfvFaxT30Params(lp,&args_t30);

Configures the channel's maximum transmission rate. This function

is optional.

BT_ZERO(args_page);

args_page.top_margin = 0;

args_page.bottom_margin = 0;