[Freeswitch-users] using spandsp fax tone detection from originate command

Michael Collins msc at freeswitch.org
Mon Sep 24 20:51:22 MSD 2012


Maybe you could clean things up a bit and use an extension that sets some
of these variables:
http://wiki.freeswitch.org/wiki/Mod_spandsp#Execute_based_on_fax_session_outcome

Maybe do something like:

originate {ignore_early_media='true'}sofia/gateway/mygateway/18005551234handle_fax

Then create that extension:
<extension name="Handle faxes">
  <condition field="destination_number" expression="^handle_fax$">
    <action application="answer"/>
    <action application="execute_on_fax_detect=txfax /tmp/myfax.tif"/>
    <action application="execute_on_fax_success=perl fax_sent.pl"/>
    <action application="execute_on_fax_failure=perl fax_failed.pl"/>
    <action application="playback" data="silence_stream://20000"/>
    <action application="hangup"/>
  </condition>
</extension>

Of course, do your own thing with the execute_on_fax_xxx variables.
Standard disclaimer applies - test it and tinker before telling me it
doesn't work. :)

-MC

On Fri, Sep 21, 2012 at 12:31 PM, Adam Johnston
<ajohnston at blimessaging.com>wrote:

> I had actually added some sleep commands in some of my other command
> combinations but I kept getting the same result. However, once I increased
> the timeout to spandsp_start_fax_detect and increased the sleep time I
> started getting some successful faxes out.
>
> If no fax tone is detected I would like to set fax_result_code to a custom
> error code that I could then map in my controller application. Is there
> some way to evaluate the result of a tone detect? I've been trying the
> below inline dialplan but it's giving my false negatives so I'm back on the
> wiki looking for a solution.
>
> 'spandsp_start_fax_detect:txfax /tmp/myfax.tif 10
> ced,sleep:10000,set:fax_result_code:951' inline
>
> Many thanks,
>
> Adam Johnston
>
>
> On Fri, Sep 21, 2012 at 2:07 PM, Michael Collins <msc at freeswitch.org>wrote:
>
>> Hi Adam,
>>
>> The key piece of information is this:
>>
>> [NOTICE] switch_core_state_machine.c:226 sofia/external/18005551234 has
>> executed the last dialplan instruction, hanging up.
>>
>> You've enabled "fax detection" on the call but you haven't told the call
>> to actually do anything. From what you're doing it seems like you're
>> wanting to detect a fax and then run the txfax application. But what
>> happens if a fax is not detected? Also, what happens to the call in the
>> interim, i.e. between the time you enable fax detect and the time it
>> actually detects a fax tone? The call needs to do "something" while waiting
>> for a fax tone. You may be better off sending this call to an extension and
>> then having several dialplan actions, like "answer",
>> "spandsp_start_fax_detect", and then a "sleep" or "playback" app, or
>> something for the channel to do while it's waiting for fax tone.
>>
>> Question: what do you want the call to do if no fax is detected?
>>
>> -MC
>>
>> On Fri, Sep 21, 2012 at 10:26 AM, Adam Johnston <
>> ajohnston at blimessaging.com> wrote:
>>
>>> Hi all,
>>>
>>> I've been trying to use the spandsp_start_fax_detect application (with
>>> txfax as the callback) from the originate command but I keep getting a
>>> hangup before it completes.
>>>
>>> So far I've tried calling the app directly:
>>> originate {ignore_early_media='true'}sofia/gateway/mygateway/18005551234&spandsp_start_fax_detect('txfax /tmp/myfax.tif 3 ced')
>>>
>>> Inline dialplan:
>>> originate {ignore_early_media='true'}sofia/gateway/mygateway/18005551234'spandsp_start_fax_detect:txfax /tmp/myfax.tif 3 ced' inline
>>>
>>> ..plus some other permutations but all end with the same result:
>>>
>>> [NOTICE] mod_spandsp.c:107 Enabling fax detection 'txfax'
>>> '/tmp/myfax.tif'
>>> [DEBUG] switch_core_media_bug.c:456 Attaching BUG to sofia/external/
>>> 18005551234
>>> [NOTICE] switch_core_state_machine.c:226 sofia/external/18005551234 has
>>> executed the last dialplan instruction, hanging up.
>>>
>>> Am I misunderstanding how spandsp_start_fax_detect works?
>>>
>>> Adam Johnston
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>>
>> --
>> Michael S Collins
>> Twitter: @mercutioviz
>> http://www.FreeSWITCH.org
>> http://www.ClueCon.com
>> http://www.OSTAG.org
>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>


-- 
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120924/d2c010ee/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list