Dialogic 6.2 Manuale Utente

Pagina di 441
Developing a Fax Application
November 2009
75
Sending a Fax Using Calls for TIFF-F Files
One way to send a fax using function calls for TIFF-F files 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.
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_tiff);
 
args_tiff.fname = name;
 
args_tiff.fmode = "r";
 
tp = BfvTiffOpen(&args_tiff);
Opens the TIFF-F file 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.local_id = "Id_string";
 
BfvFaxSetLocalID(lp,&args_fax);
Sets the local id.
BT_ZERO(args_fax);
 
args_fax.s_tp = tp;
 
BfvFaxBeginSendTiff(lp,&args_fax);
Begins the Phase B handshaking procedure.
BfvFaxGetRemoteInfo(lp, &args_fax);
Waits for the called machine to send its ID and capabilities.
BfvFaxWaitForTraining(lp, &args_fax);
Waits for the completion of the Phase B handshaking procedure.