To send a fax using asterisks send_fax you obviously need the app_fax loaded. It can only be compiled into source if you have spandsp libraries available.
An easy way of sending faxes is to use .call files. These files are flat text YAML-like files which tells asterisk to execute a call. It can be used for many purposes, but is most commonly used for callbacks and faxes. In our case, the following example will do:
Channel: SIP/sip_out/87654321 CallerID: 12345678 Application: SendFAX Data: /tmp/faxtest.tiff SetVar: T38CALL=0
Name this file something.call and place it in our asterisk spool directory, defaults to /var/spool/asterisk/outgoing/
The script that generates the file must specify the destination number at the end of ‘Channel’, and wherever the .tiff fax is located. To convert from .pdf to .tiff, use you can use ghostscript (gs):
/usr/bin/gs -q -SDEVICE=tiffg4 -r203x98 -sPAPERSIZE=letter \ -sOutputFile=/somedir/send.tiff -dNOPAUSE -dBATCH -- /somedir/somepdf