[asterisk-users] 1.6.0.5: I need a really simple analog SendFax dialplan

sean darcy seandarcy2 at gmail.com
Thu Sep 24 14:54:05 CDT 2009


sean darcy wrote:
> Martin wrote:
>> if you're trying to send the same fax to both parties, then do
>>
>> exten => s,1,System()
>> exten => s,2,Sendfax()
>>
>> step1 will spool the call to dial a number and send a fax
>> step2 will transmit the fax to the incoming call
>>
>> Martin
>>
>> On Wed, Sep 23, 2009 at 7:45 PM, sean darcy <seandarcy2 at gmail.com> wrote:
>>> Martin wrote:
>>>> well maybe it doesn't work as it should ... anyways like the other
>>>> poster said that's not the way you use it ...
>>>>
>>>> either call the sendfax app directly or use "Originate" / call file spooling...
>>>>
>>>> BTW there should be an Originate app executable from dialplan ...
>>>> But since there's none you can do
>>>>
>>>> exten => _X.,n,System(echo -e "Channel: SIP/number at gateway\\nContext:
>>>> send\\nExtension: s\\nPriority: 1\\n" >
>>>> /var/spool/asterisk/outgoing/call-${UNIQUEID})
>>>>
>>>> and at send,s,1 call sendfax
>>>>
>>>> Martin
>>>>
>>>> On Wed, Sep 23, 2009 at 1:44 AM, sean darcy <seandarcy2 at gmail.com> wrote:
>>>>> Martin wrote:
>>>>>> from RTFM
>>>>>>
>>>>>> G(context^exten^pri) - If the call is answered, transfer the calling party to
>>>>>>            the specified priority and the called party to the
>>>>>> specified priority+1.
>>>>>>            Optionally, an extension, or extension and context may be specified.
>>>>>>            Otherwise, the current extension is used. You cannot use
>>>>>> any additional
>>>>>>            action post answer options in conjunction with this option.
>>>>>>
>>>>>>
>>>>>> your priority+1 is Hangup ...
>>>>>>
>>>>>> is that it ?
>>>>>>
>>>>>> Martin
>>>>>>
>>>>>> On Tue, Sep 22, 2009 at 7:32 PM, sean darcy <seandarcy2 at gmail.com> wrote:
>>>>>>> Using Digium fax I've tried a simple dialplan:
>>>>>>>
>>>>>>> '8447' => 1. Answer()                       [pbx_config]
>>>>>>>           2. Set(CALLERID(num)=xxxyyyzzzz)              [pbx_config]
>>>>>>>           3. Dial(DAHDI/g0/1bbbcccdddd,,G(send))        [pbx_config]
>>>>>>> [send]    4. SendFax(/var/spool/asterisk/fax/20090922_1301.tif) [pbx_config]
>>>>>>>           5. HangUp()
>>>>>>>
>>>>>>> But I doesn't work. It executes hangup:
>>>>>>>
>>>>>>> "DAHDI/g0/1bbbcccdddd,,G(send)") in new stack
>>>>>>>    -- Requested transfer capability: 0x00 - SPEECH
>>>>>>>    -- Called g0/1bbbcccdddd
>>>>>>>    -- DAHDI/1-1 is proceeding passing it to SIP/173-b55f7448
>>>>>>>    -- DAHDI/1-1 is ringing
>>>>>>>    -- DAHDI/1-1 is making progress passing it to SIP/173-b55f7448
>>>>>>>    -- DAHDI/1-1 is making progress passing it to SIP/173-b55f7448
>>>>>>>    -- DAHDI/1-1 answered SIP/173-b55f7448
>>>>>>>    -- Executing [8447 at outbound-fax:4] SendFAX("SIP/173-b55f7448",
>>>>>>> "/var/spool/asterisk/fax/20090922_1301.tif") in new stack
>>>>>>>    -- Channel 'SIP/173-b55f7448' sending fax
>>>>>>> '/var/spool/asterisk/fax/20090922_1301.tif'
>>>>>>>    -- Channel 'SIP/173-b55f7448' fax session '16' started
>>>>>>>    -- Executing [8447 at outbound-fax:5] Hangup("DAHDI/1-1", "") in new stack
>>>>>>>  == Spawn extension (outbound-fax, 8447, 5) exited non-zero on 'DAHDI/1-1'
>>>>>>>    -- Hungup 'DAHDI/1-1'
>>>>>>>    -- Channel 'SIP/173-b55f7448' fax session '16', [ 000.003512 ],
>>>>>>> STAT_EVT_STRT_TX       st: IDLE         rt: IDLENSTX
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> So why does it hangup before completing the fax?
>>>>>>>
>>>>>>> Does anyone have a SendFax dialplan that works for an analog channel?
>>>>>>>
>>>>>>> Thanks for any help.
>>>>>>>
>>>>>>> sean
>>>>>>>
>>>>>>>
>>>>> Well, I had RTFM :) And I've tried this, without success:
>>>>>
>>>>>  '8447' => 1. Answer()                       [pbx_config]
>>>>>            2. Set(CALLERID(num)=xxxyyyzzzz)              [pbx_config]
>>>>>            3. Dial(DAHDI/g0/1bbbcccdddd,,G(send))        [pbx_config]
>>>>>  [send]    4. SendFax(/var/spool/asterisk/fax/20090922_1301.tif)
>>>>> [pbx_config]
>>>>>            5. Wait(999999999999)                  [pbx_config]
>>>>>            6. HangUp()                            [pbx_config]
>>>>>
>>>>> The dialplan didn't wait. Also tried without the HangUp(), but the
>>>>> dialplan just fell through. What should priority 5 (priority + 1) be?
>>>>>
>>>>> Does anyone use SendFax for analog faxing?
>>>>>
>>>>> sean
>>>>>
>>> OK, I set up context [send-test]
>>> dialplan show send-test
>>> [ Context 'send-test' created by 'pbx_config' ]
>>>   's' =>            1.
>>> SendFax(/var/spool/asterisk/fax/20090922_1301.tif) [pbx_config]
>>> newharborpbx*CLI>
>>> -= 1 extension (1 priority) in 1 context. =-
>>>
>>> Then I tried:
>>>
>>>                3. Dial(DAHDI/g0/abbbcccdddd,,G(send))   [pbx_config]
>>> [send]         4. GoTo(really-send)                     [pbx_config]
>>> [wait]         5. Wait(999)                             [pbx_config]
>>>                6. HangUp()                              [pbx_config]
>>> [really-send]  7. System(env echo -e
>>> "Channel:${CHANNEL}\\nContext:send-test\\nExtension: s\\nPriority: 1\\n"
>>>  >/var/spool/asterisk/outgoing/call-${UNIQUEID}) [pbx_config]
>>>                8. Wait(99)                              [pbx_config]
>>>
>>>
>>>
>>>     -- Executing [8447 at outbound-fax:3] Dial("Console/dsp",
>>> "DAHDI/g0/abbbcccdddd,,G(send)") in new stack
>>>     -- Requested transfer capability: 0x00 - SPEECH
>>>     -- Called g0/abbbcccdddd
>>>     -- DAHDI/1-1 is proceeding passing it to Console/dsp
>>>     -- DAHDI/1-1 is ringing
>>>     -- DAHDI/1-1 is making progress passing it to Console/dsp
>>>     -- DAHDI/1-1 is making progress passing it to Console/dsp
>>>     -- DAHDI/1-1 answered Console/dsp
>>>     -- Executing [8447 at outbound-fax:4] Goto("Console/dsp",
>>> "really-send") in new stack
>>>     -- Goto (outbound-fax,8447,7)
>>>     -- Executing [8447 at outbound-fax:7] System("Console/dsp", "env echo
>>> -e  "Channel:Console/dsp\\nContext:send-test\\nExtension: s\\nPriority:
>>> 1\\n" >/var/spool/asterisk/outgoing/call-1253749009.17") in new stack
>>>     -- Executing [8447 at outbound-fax:5] Wait("DAHDI/1-1", "999") in new
>>> stack
>>>     -- Executing [8447 at outbound-fax:8] Wait("Console/dsp", "99") in new
>>> stack
>>>     -- Attempting call on Console/dsp for s at send-test:1 (Retry 1)
>>> [Sep 23 19:36:58] WARNING[29797]: chan_oss.c:846 oss_request:
>>> oss_request ty <Console> data 0x0xb79576f8 <dsp>
>>> [Sep 23 19:36:58] NOTICE[29797]: chan_oss.c:857 oss_request: Already
>>> have a call (chan 0x847b550) on the OSS channel
>>> [Sep 23 19:36:58] NOTICE[29797]: channel.c:3755 __ast_request_and_dial:
>>> Unable to request channel Console/dsp
>>> [Sep 23 19:36:58] NOTICE[29797]: pbx_spool.c:347 attempt_thread: Call
>>> failed to go through, reason (5) Remote end is Busy
>>>
>>>
>>> So then I tried faxing on the "called" channel:
>>>
>>>                 3. Dial(DAHDI/g0/12036378447,,G(wait)) [pbx_config]
>>>      [wait]         4. Wait(999)                [pbx_config]
>>>                     5. GoTo(really-send)        [pbx_config]
>>>                     6. HangUp()                 [pbx_config]
>>>      [really-send]  7. System(env echo -e
>>> "Channel:${CHANNEL}\\nContext:send-test\\nExtension: s\\nPriority: 1\\n"
>>>  >/var/spool/asterisk/outgoing/call-${UNIQUEID}) [pbx_config]
>>>                     8. Wait(99)                  [pbx_config]
>>>
>>>
>>> But:
>>>
>>>     -- Executing [8447 at outbound-fax:7] System("DAHDI/1-1", "env echo -e
>>>  "Channel:DAHDI/1-1\\nContext:send-test\\nExtension: s\\nPriority:
>>> 1\\n" >/var/spool/asterisk/outgoing/call-1253747786.15") in new stack
>>>     -- Executing [8447 at outbound-fax:8] Wait("DAHDI/1-1", "99") in new stack
>>>     -- Attempting call on DAHDI/1-1 for s at send-test:1 (Retry 1)
>>> [Sep 23 19:16:37] NOTICE[29615]: channel.c:3755 __ast_request_and_dial:
>>> Unable to request channel DAHDI/1-1
>>> [Sep 23 19:16:37] NOTICE[29615]: pbx_spool.c:347 attempt_thread: Call
>>> failed to go through, reason (0) Call Failure (not BUSY, and not
>>> NO_ANSWER, maybe Circuit busy or down?)
>>> [Sep 23 19:16:37] ERROR[29302]: pbx.c:8350 device_state_cb: Received
>>> invalid event that had no device IE
>>> [Sep 23 19:16:37] ERROR[29302]: app_queue.c:856 device_state_cb:
>>> Received invalid event that had no device IE
>>>
>>>
>>> This can't be this hard to send an analog fax. What am I missing?
>>>
>>> sean
>>>
>>>
>>>
> 
> I'm explaining this poorly.
> 
> I want to create an outgoing dahdi channel and send a fax. I'm not 
> sending the fax to an incoming call. So I have to tell SendFax() where 
> to go.
> 
> I've used ReceiveFax() on incoming sip and dahdi channels. That works.
> 
> For sending a fax, I thought you would create an outgoing dahdi channnel 
> (which is what Dial() is for, right?) and then execute SendFax() in that 
> channel (somehow).
> 
> Isn't this a common use case?
> 
> sean
> 

Ok. I've got it.

                1. Answer()                       [pbx_config]
                2. System(env echo -e 
"Channel:DAHDI/g0/abbbcccdddd\\nContext:send-test\\nExtension: 
s\\nPriority: 1\\n" >/var/spool/asterisk/outgoing/call-${UNIQUEID}) 
[pbx_config]
                3. HangUp()              [pbx_config]


The real trick here is that Originate needs the channel specified 
_exactly_ as it would be in the Dial() command, which, of course, is why 
there's no need for a dial command.

TaDa.

Thanks to one and all.

sean




More information about the asterisk-users mailing list