beautypg.com

Dialogic 6.2 User Manual

Page 65

background image

Developing a Fax Application

November 2009

65

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_infopkt);

args_infopkt.fname = name;

args_infopkt.fmode = "r";

ips = BfvInfopktOpen(&args_infopkt);

Opens the infopkt-formatted file called name for reading and

transmission.

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.

BT_ZERO(args_fax);

args_fax.s_ips = ips;

args_fax.local_id = local_id;

BfvFaxSend(lp,&args_fax);

Transmits documents based on an infopkt stream.

BT_ZERO(args_infopkt);

args_infopkt.ips = ips;

BfvInfopktClose (&args_infopkt);

Closes the infopkt stream file after the file is sent.

BT_ZERO(args_admin);

BfvLineDetach (lp, &args_admin);

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

Receiving a Fax Using High-Level Function Calls

A typical way to

receive a fax using the high-level fax function calls 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 line pointer.