beautypg.com

Dialogic 6.2 User Manual

Page 68

background image

Developing a Fax Application

November 2009

68

for (;;)

{

BT_ZERO(args_fax);

args_fax.s_ips = ips;

if ((ret = BfvFaxNextPage(lp, &args_fax)) <= 0 )

break;

BfvFaxSendPage(lp, &args_fax);

}

Loops through the infopkt stream, getting the next page and

transmitting it to the driver.

BfvFaxEndOfDocument(lp, &args_fax);

Finishes up when the infopkt stream is exhausted.

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.

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

for example:

Receiving a Fax Using Low-Level Infopkt Function Calls

One way

to receive a fax using the low-level infopkt 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 BTLINE pointer.

BfvLineDialString

BfvLineCallProgressEnable

BfvDataCP

BfvLineCallProgressDisable

These low level functions are

replaced with the high level

function BfvLineOriginateCall.

BfvFaxSetLocalID

BfvFaxBeginSend

BfvFaxGetRemoteInfo

BfvFaxWaitForTraining

BfvFaxSendPage

BfvFaxEndOfDocument

These low level functions are

replaced with the high level

function BfvFaxSend.