V1.0: Class 1 fax — real-world 4-page send to external number confirmed

Core features:
- Class 1 T.30 protocol: full send/receive implementation
- HDLC: DLE-stuffing, FCS strip, USR5637 bit-reversal handling
- T.4 MH encoder/decoder (1728px A4 standard)
- Document pipeline: PDF (Ghostscript), PNG, TIFF input
- Width clamping: US Letter 1734px → 1728px fax standard
- Cover page: CJK rasterization (TW/CN/JP/EN), TIFF + HTML output
- OCR verification: Tesseract 5 with eng+chi_tra, CJK space-tolerant
- API server (axum): health, send, jobs, cover, retry, cancel
- Background worker: auto-poll queue, speed fallback, retry policy
- Modem detection, pool management

Real-world test results (2026-07-23):
- V90 → 25153038: 4 pages, V.17 12000 bps, 2:33 ✅
- USR5637 → 25153038: 4 pages, V.17 12000 bps, 2:26 ✅
- Both faxes confirmed received on remote machine

Tested: loopback (100% pixel match), multi-page, all input formats,
cover pages, OCR verify, API endpoints, worker processing.
13 unit tests pass, 0 new clippy warnings.
This commit is contained in:
Warren
2026-07-24 18:47:15 +08:00
parent d1e92b32fb
commit 55bca92691
155 changed files with 25024 additions and 916 deletions
+76
View File
@@ -0,0 +1,76 @@
#!/usr/bin/env python3
from PIL import Image, ImageDraw, ImageFont
import sys
def create_test_image(text, output_path, language='english'):
W, H = 1728, 2291
img = Image.new('L', (W, H), 255)
draw = ImageDraw.Draw(img)
font_path = '/System/Library/Fonts/Helvetica.ttc'
try:
font = ImageFont.truetype(font_path, 44)
except:
font = ImageFont.load_default()
lines = text.split('\n')
y = 100
for line in lines:
draw.text((100, y), line, fill=0, font=font)
y += 60
img.save(output_path, dpi=(204, 196))
print(f"Test image created: {output_path}")
if __name__ == '__main__':
if len(sys.argv) < 3:
print("Usage: python create_test_image.py <output_path> <language>")
sys.exit(1)
output_path = sys.argv[1]
language = sys.argv[2]
test_texts = {
'english': """FAX COVER PAGE
TO: John Smith
FROM: Jane Doe
DATE: 2024-01-15
SUBJECT: Meeting Notes
PAGES: 5
Dear Mr. Smith,
Please review the attached meeting notes before our discussion tomorrow.
Best regards,
Jane Doe""",
'chinese': """傳真封面頁
收件人:張三
發件人:李四
日期:2024-01-15
主題:業務合作提案
頁數:5
請參閱附件內容,謝謝。
李四""",
'mixed': """FAX COVER PAGE
TO: John Smith (張三)
FROM: Jane Doe (李四)
DATE: 2024-01-15
SUBJECT: Business Proposal (業務提案)
PAGES: 5
This fax contains business documents.
請參閱附件內容。
Best regards,
Jane Doe""",
}
text = test_texts.get(language, test_texts['english'])
create_test_image(text, output_path, language)