[asterisk-users] digium fax: failed to queue document

sean darcy seandarcy2 at gmail.com
Mon Sep 28 11:30:24 CDT 2009


sean darcy wrote:
> Martin wrote:
>> u don't change the ${uniquefile} for the second System/Originate
>>
>> try to add a string to the ${uniquefile} ...
>>
>> eg
>>
>> ${uniquefile}0
>>
>> Martin
> But I generate another unique file in [fax-tx] just before I try to send 
> the confirm.
> 
> Here's the first call:
> 
>      -- Executing [send at outbound-fax:2] System("Console/dsp", "env echo 
> -e "Channel:DAHDI/g0/abbbcccdddd\\nContext:fax-tx\\nExtension: 
> s\\nPriority: 1\\n" >/var/spool/asterisk/outgoing/call-1254021344.0") in 
> new stack
> 
> Here's the second:
> 
>      -- Executing [h at fax-tx:9] System("DAHDI/1-1", "env echo -e 
> "Channel:DAHDI/g0/abbbcccdddd\\nContext:fax-confirm-tx\\nExtension: 
> s\\nPriority: 1\\n" >/var/spool/asterisk/outgoing/call-1254021349.10") 
> in new stack
> 
> As you can see, I also tried adding the 0 string :)
> 
> Also here's tiffinfo for the file that's not queued:
> 
> [Sep 26 23:16:38] ERROR[18841]: res_fax_digium.c:1761 dgm_fax_start: fax 
> handle: 0 failed to queue document 
> '/var/spool/asterisk/fax-tx-status-20090926_2316.tif'
> 
> tiffinfo /var/spool/asterisk/fax-tx-status-20090926_2316.tif
> TIFF Directory at offset 0x822 (2082)
>    Image Width: 600 Image Length: 200
>    Bits/Sample: 1
>    Compression Scheme: CCITT Group 3
>    Photometric Interpretation: min-is-black
>    FillOrder: msb-to-lsb
>    Orientation: row 0 top, col 0 lhs
>    Samples/Pixel: 1
>    Rows/Strip: 109
>    Planar Configuration: single image plane
>    DocumentName: Standard Input
>    ImageDescription: converted PNM file
> 
> sean
> 
> 
>> On Sat, Sep 26, 2009 at 8:05 PM, sean darcy <seandarcy2 at gmail.com> wrote:
>>> In my quest to actually send a fax, I'm now stuck trying to send the
>>> confirm.
>>>
>>> First I send the fax:
>>>
>>>     -- Executing [send at outbound-fax:2] System("Console/dsp", "env echo
>>> -e "Channel:DAHDI/g0/12036378447\\nContext:fax-tx\\nExtension:
>>> s\\nPriority: 1\\n" >/var/spool/asterisk/outgoing/call-1254012878.0") in
>>> new stack
>>>     -- Auto fallthrough, channel 'Console/dsp' status is 'UNKNOWN'
>>>  << Hangup on console >>
>>>     -- Attempting call on DAHDI/g0/12036378447 for s at fax-tx:1 (Retry 1)
>>>     -- Requested transfer capability: 0x00 - SPEECH
>>>        > Channel DAHDI/1-1 was answered.
>>>     -- Executing [s at fax-tx:1] SendFAX("DAHDI/1-1",
>>> "/var/spool/asterisk/fax/20090922_1301.tif") in new stack
>>>     -- Channel 'DAHDI/1-1' sending fax
>>> '/var/spool/asterisk/fax/20090922_1301.tif'
>>>     -- Channel 'DAHDI/1-1' fax session '0' started
>>> .........
>>>
>>> And that works.
>>>
>>> Then I try to send the confirm:
>>>
>>>    'h' =>            1. Set(RID=${FAXOPT(remotestationid)})
>>> [pbx_config]
>>>                     2.
>>> Set(DateTime=${STRFTIME(${EPOCH},,%Y%m%d)}_${STRFTIME(${EPOCH},,%H%M)})
>>> [pbx_config]
>>>                     3.
>>> Set(GLOBAL(StatusFile)=/var/spool/asterisk/fax-tx-status-${DateTime})
>>> [pbx_config]
>>>                     4. System(env echo -e "${FAXOPT(pages)} Page Fax
>>> sent to ${EXTEN}. Remote ID: ${RID}" > ${StatusFile}-l1) [pbx_config]
>>>                     5. System(env echo -e "Status: ${FAXOPT(status)}
>>> ${FAXOPT(statusstr)}" > ${StatusFile}-l2) [pbx_config]
>>>                     6. System(convert -background white -fill black
>>> -pointsize 18 text:${StatusFile}-l1 text:${StatusFile}-l2 -crop
>>> 600x100+1+1  -append ${StatusFile}.tif) [pbx_config]
>>>                     7. Set(GLOBAL(StatusFile)=${StatusFile})
>>> [pbx_config]
>>>                     8.
>>> Set(UniqueFile=/var/spool/asterisk/outgoing/call-${UNIQUEID}) [pbx_config]
>>>                     9. System(env echo -e
>>> "Channel:DAHDI/g0/abbbcccdddd\\nContext:fax-confirm-tx\\nExtension:
>>> s\\nPriority: 1\\n" >${UniqueFile}) [pbx_config]
>>>
>>> But that fails:
>>>
>>>     -- Executing [h at fax-tx:1] Set("DAHDI/1-1", "RID=bbb-ccc-dddd") in
>>> new stack
>>>     -- Executing [h at fax-tx:2] Set("DAHDI/1-1",
>>> "DateTime=20090926_2055") in new stack
>>>     -- Executing [h at fax-tx:3] Set("DAHDI/1-1",
>>> "GLOBAL(StatusFile)=/var/spool/asterisk/fax-tx-status-20090926_2055") in
>>> new stack
>>>   == Setting global variable 'StatusFile' to
>>> '/var/spool/asterisk/fax-tx-status-20090926_2055'
>>>     -- Executing [h at fax-tx:4] System("DAHDI/1-1", "env echo -e "1 Page
>>> Fax sent to h. Remote ID: bbb-ccc-dddd" >
>>> /var/spool/asterisk/fax-tx-status-20090926_2055-l1") in new stack
>>>     -- Executing [h at fax-tx:5] System("DAHDI/1-1", "env echo -e "Status:
>>> SUCCESS FAX_SUCCESS" >
>>> /var/spool/asterisk/fax-tx-status-20090926_2055-l2") in new stack
>>>     -- Executing [h at fax-tx:6] System("DAHDI/1-1", "convert -background
>>> white -fill black -pointsize 18
>>> text:/var/spool/asterisk/fax-tx-status-20090926_2055-l1
>>> text:/var/spool/asterisk/fax-tx-status-20090926_2055-l2 -crop
>>> 600x100+1+1  -append
>>> /var/spool/asterisk/fax-tx-status-20090926_2055.tif") in new stack
>>>     -- Executing [h at fax-tx:7] Set("DAHDI/1-1",
>>> "GLOBAL(StatusFile)=/var/spool/asterisk/fax-tx-status-20090926_2055") in
>>> new stack
>>>   == Setting global variable 'StatusFile' to
>>> '/var/spool/asterisk/fax-tx-status-20090926_2055'
>>>     -- Executing [h at fax-tx:8] Set("DAHDI/1-1",
>>> "UniqueFile=/var/spool/asterisk/outgoing/call-1254012879.1") in new stack
>>>     -- Executing [h at fax-tx:9] System("DAHDI/1-1", "env echo -e
>>> "Channel:DAHDI/g0/abbbcccdddd\\nContext:fax-confirm-tx\\nExtension:
>>> s\\nPriority: 1\\n" >/var/spool/asterisk/outgoing/call-1254012879.1") in
>>> new stack
>>>     -- Attempting call on DAHDI/g0/abbbcccdddd for s at fax-confirm-tx:1
>>> (Retry 1)
>>>     -- Requested transfer capability: 0x00 - SPEECH
>>>     -- Hungup 'DAHDI/1-1'
>>> [Sep 26 20:55:17] NOTICE[14894]: pbx_spool.c:357 attempt_thread: Call
>>> completed to DAHDI/g0/abbbcccdddd
>>>        > Channel DAHDI/2-1 was answered.
>>>     -- Executing [s at fax-confirm-tx:1] SendFAX("DAHDI/2-1",
>>> "/var/spool/asterisk/fax-tx-status-20090926_2055.tif") in new stack
>>>     -- Channel 'DAHDI/2-1' sending fax
>>> '/var/spool/asterisk/fax-tx-status-20090926_2055.tif'
>>> [Sep 26 20:55:26] ERROR[14912]: res_fax_digium.c:1761 dgm_fax_start: fax
>>> handle: 0 failed to queue document
>>> '/var/spool/asterisk/fax-tx-status-20090926_2055.tif'
>>> [Sep 26 20:55:26] ERROR[14912]: res_fax.c:811 generic_fax_exec: channel
>>> 'DAHDI/2-1' fax session '1' failure, reason: 'failed to start fax session'
>>>
>>> The file does exist:
>>>
>>> file /var/spool/asterisk/fax-tx-status-20090926_2055.tif
>>> /var/spool/asterisk/fax-tx-status-20090926_2055.tif: TIFF image data,
>>> little-endian
>>>  ls -l /var/spool/asterisk/fax-tx-status-20090926_2055.tif
>>> -rw-r--r-- 1 root root 480892 2009-09-26 20:55
>>> /var/spool/asterisk/fax-tx-status-20090926_2055.tif
>>>
>>>
>>> Any help appreciated.
>>>
>>> sean
>>>
>>>

Well one of the problems it that SendFax doesn't like the tiff file(BTW, 
SendFax from app_fax.so gives you clue what the problem is). It requires 
a special sort of tiff file. I never found any way to generate a 
compliant file with imagemagick or netpbm from a simple text file.

But here's what does work:

text2ps  -p 16 -mt 112 -ml 80 input.txt | \
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg3 -sOutputFile=faxfile.tif 
-f -

This doesn't fix my problem, because I still can't get the dialplan to 
make a second call. But that's now another thread.

sean




More information about the asterisk-users mailing list