beautypg.com

Dialogic 6.2 User Manual

Page 70

background image

Developing a Fax Application

November 2009

70

BT_ZERO(args_admin);

BfvLineDetach (lp, &args_admin);

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

You can replace some low-level functions with a high-level function,

for example:

See the applications in the sample application directory for more

detailed information.

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

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 two-page fax whose page and strip data are

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

Group 3 letterhead (ltrhd.g3), a body in ASCII (main.txt), and a

signature file in Group 3 (sig.G3). The second page is an ASCII file

(memo.txt).

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, calls the user

function to optionally decide when to terminate call progress.

BfvFaxBeginReceive

BfvFaxGetRemoteInfo

BfvFaxSetLocalId

BfvFaxWaitForTraining

BfvFaxReceivePages

These low level functions are

replaced with the high level function

BfvFaxReceive.