Developing a Fax Application

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:

BfvLineDialString

These low level functions are

BfvLineCallProgressEnable

replaced with the high level

BfvDataCP

function BfvLineOriginateCall.

BfvLineCallProgressDisable

 

BfvFaxSetLocalID

These low level functions are

BfvFaxBeginSend

replaced with the high level

BfvFaxGetRemoteInfo

function BfvFaxSend.

BfvFaxWaitForTraining

 

BfvFaxSendPage

 

BfvFaxEndOfDocument

 

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.

November 2009

68

Page 68
Image 68
Dialogic 6.2 manual Finishes up when the infopkt stream is exhausted