Working example of fax to e-mail as JPG attachment?

Hello, does anyone have a working example of SIP fax-to-email where an incoming DID answers, receives, and emails the accepted fax to a certain address?
Thank you

DIDs are, by definition, incoming; that’s what the I stands for.

JPEG is a bad format for faxes. TIFF or PDF with a group 4 fax encoded payload would be the sensible choices. Both also have the advantages that they are multi-page formats.

There should be plenty of examples of using fax with Asterisk, although knowledge is probably dying out as fax is now relegated to certain niche occupations (I’m not sure if my GP still uses it). ghostscript can be used to convert PDF to JPEG. TIFF can be converted to PDF and then to JPEG, or to PPM and JPEG.

JPEG is likely to produce larger files than G4 Fax encoding, and will not reproduce lines accurately. Fax is designed for images consisting of lines.

you could do something like this

[FAX]
exten => DID1,1,Set(Email=did1@domain)
exten => DID2,1,Set(Email=did2@domain)
exten => DID3,1,Set(Email=did3@domain)
exten => _X!,2,ReceiveFAX(${EXTEN}-${UNIQUEID}.tiff)

exten => h,1,System(SendFaxScript.sh ${EXTEN}-${UNIQUEID}.tiff ${Email})