[asterisk-users] Any 1.6 SendFAX example ?
Atis Lezdins
atis at iq-labs.net
Thu Nov 27 06:16:43 CST 2008
On Thu, Nov 27, 2008 at 1:03 PM, Olivier <oza-4h07 at myamail.com> wrote:
> Hi,
>
> Do you have any example showing how to use SendFAX ?
> I can see several examples of ReceiveFAX but not a single one showing
> SendFAX.
This is not from 1.6, but rather from callweaver attached to Asterisk 1.4.
When i'll finally switch to 1.6, i intend to just move those contexts
to Asterisk dialplan.
extensions.conf:
[fax_out]
exten => _X.,1,NoOp(--- sending fax to ${EXTEN} ---)
exten => _X.,n,SipDTMFMode(inband)
exten => _X.,n,TxFAX(${TIFF},caller,debug,ecm)
exten => _X.,n,Hangup()
exten => h,1,NoOp(--- done sending fax ---)
exten => h,n,NoOp(TX: REMOTESTATIONID is ${REMOTESTATIONID})
exten => h,n,NoOp(TX: FAXPAGES is ${FAXPAGES})
exten => h,n,NoOp(TX: FAXRESOLUTION is ${FAXRESOLUTION})
exten => h,n,NoOp(TX: FAXBITRATE is ${FAXBITRATE})
exten => h,n,NoOp(TX: PHASEESTATUS is ${PHASEESTATUS})
exten => h,n,NoOp(TX: PHASEESTRING is ${PHASEESTRING})
exten => h,n,NoOp(TX: DIALSTATUS is ${DIALSTATUS})
exten => h,n,System(${SCRIPT}/fax_out_end.php --status
${uniqueid_storage} --pages ${FAXPAGES} --resolution ${FAXRESOLUTION}
--bitrate ${FAXBITRATE} --phase
exten => failed,1,NoOp(--- failed sending fax ---)
Then, to send a fax, generate tiff file and call-file.
Snapshot of my PHP generating call-file from hylafax job:
$channel = 'SIP/'.$job['number'].'@asterisk-t38';
$destination =
array('context'=>'fax_out','extension'=>$job['number'],'priority'=>'1');
$vars = array(
'LOCALSTATIONID' => 'CallWeaver-T38-TxFax',
'T38CALL'=>'1',
'TIFF'=>$job['private']['tiff_file'],
);
$callerid = 'CallWeaver T38 TxFax';
$waittime = 180;
$deliver_time = NULL;
$filename = NULL;
$retries = array();
$callfile_dir = T38_CALLFILE_DIR.'/';
$result = ast_originate_callfile($channel,$destination,$vars,$callerid,$waittime,$deliver_time,$filename,$retries,$callfile_dir);
Of course you'll need ast_originate_callfile which writes data to file
and then moves to correct dir. I would publish that, but it's full of
my constants and realted to much other libs..
Basically, you dial destination number (SIP/123 at privider) and send
local side of channel to fax_out,${NUMBER},1 which does SendFax.
Regards,
Atis
--
Atis Lezdins,
VoIP Project Manager / Developer,
IQ Labs Inc,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835
More information about the asterisk-users
mailing list