Maybe you could clean things up a bit and use an extension that sets some of these variables:<br><a href="http://wiki.freeswitch.org/wiki/Mod_spandsp#Execute_based_on_fax_session_outcome">http://wiki.freeswitch.org/wiki/Mod_spandsp#Execute_based_on_fax_session_outcome</a><br>
<br>Maybe do something like:<br><br><font face="courier new, monospace">originate {ignore_early_media=&#39;true&#39;}sofia/gateway/mygateway/<a href="tel:18005551234" value="+18005551234" target="_blank">18005551234</a></font><font face="courier new,monospace"> handle_fax</font> <br>
<br>Then create that extension:<br><span style="font-family:courier new,monospace">&lt;extension name=&quot;Handle faxes&quot;&gt;<br>  &lt;condition field=&quot;destination_number&quot; expression=&quot;^handle_fax$&quot;&gt;<br>
    &lt;action application=&quot;answer&quot;/&gt;<br>    &lt;action application=&quot;execute_on_fax_detect=txfa</span><span style="font-family:courier new,monospace">x /tmp/myfax.tif&quot;/&gt;<br>    &lt;action application=&quot;execute_on_fax_success=perl <a href="http://fax_sent.pl">fax_sent.pl</a>&quot;/&gt;<br>
    &lt;action application=&quot;execute_on_fax_failure=perl <a href="http://fax_failed.pl">fax_failed.pl</a>&quot;/&gt;<br>    &lt;action application=&quot;playback&quot; data=&quot;silence_stream://20000&quot;/&gt;<br>    &lt;action application=&quot;hangup&quot;/&gt;<br>
  &lt;/condition&gt;<br>&lt;/extension&gt;<br></span><br>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&#39;t work. :)<br><br>
-MC<br><br><div class="gmail_quote">On Fri, Sep 21, 2012 at 12:31 PM, Adam Johnston <span dir="ltr">&lt;<a href="mailto:ajohnston@blimessaging.com" target="_blank">ajohnston@blimessaging.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>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.</div>


<div><br></div><div>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&#39;ve been trying the below inline dialplan but it&#39;s giving my false negatives so I&#39;m back on the wiki looking for a solution.</div>

<div><br></div><div><span style="font-family:&#39;courier new&#39;,monospace">&#39;spandsp_start_fax_detect:</span><span style="font-family:&#39;courier new&#39;,monospace">txfax /tmp/myfax.tif 10 ced,sleep:10000,set:fax_result_code:951&#39; inline</span></div>

<div><br></div><div>Many thanks,</div><div><br></div>Adam Johnston<br clear="all"><div><br></div><br><div class="gmail_quote">On Fri, Sep 21, 2012 at 2:07 PM, Michael Collins <span dir="ltr">&lt;<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Adam,<br><br>The key piece of information is this:<div><br><font face="courier new, monospace">[NOTICE] switch_core_state_machine.c:226 sofia/external/<a href="tel:18005551234" value="+18005551234" target="_blank">18005551234</a> has executed the last dialplan instruction, hanging up.<br>



</font><br></div>You&#39;ve enabled &quot;fax detection&quot; on the call but you haven&#39;t told the call to actually do anything. From what you&#39;re doing it seems like you&#39;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 &quot;something&quot; while waiting for a fax tone. You may be better off sending this call to an extension and then having several dialplan actions, like &quot;answer&quot;, &quot;spandsp_start_fax_detect&quot;, and then a &quot;sleep&quot; or &quot;playback&quot; app, or something for the channel to do while it&#39;s waiting for fax tone.<br>



<br>Question: what do you want the call to do if no fax is detected?<br><br>-MC<br><br><div class="gmail_quote"><div><div>On Fri, Sep 21, 2012 at 10:26 AM, Adam Johnston <span dir="ltr">&lt;<a href="mailto:ajohnston@blimessaging.com" target="_blank">ajohnston@blimessaging.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi all,<div><br></div><div>I&#39;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.</div>



<div><br></div><div>
So far I&#39;ve tried calling the app directly:</div><div><font face="courier new, monospace">originate {ignore_early_media=&#39;true&#39;}sofia/gateway/mygateway/<a href="tel:18005551234" value="+18005551234" target="_blank">18005551234</a> &amp;spandsp_start_fax_detect(&#39;txfax /tmp/myfax.tif 3 ced&#39;)</font></div>




<div><br></div><div>Inline dialplan:</div><div><font face="courier new, monospace">originate {ignore_early_media=&#39;true&#39;}sofia/gateway/mygateway/<a href="tel:18005551234" value="+18005551234" target="_blank">18005551234</a> &#39;spandsp_start_fax_detect:txfax /tmp/myfax.tif 3 ced&#39; inline</font>
</div><div><br></div><div>..plus some other permutations but all end with the same result:</div><div><br></div><div><div><font face="courier new, monospace">[NOTICE] mod_spandsp.c:107 Enabling fax detection &#39;txfax&#39; &#39;/tmp/myfax.tif&#39;</font></div>




<div><font face="courier new, monospace">[DEBUG] switch_core_media_bug.c:456 Attaching BUG to sofia/external/<a href="tel:18005551234" value="+18005551234" target="_blank">18005551234</a></font></div><div><font face="courier new, monospace">[NOTICE] switch_core_state_machine.c:226 sofia/external/<a href="tel:18005551234" value="+18005551234" target="_blank">18005551234</a> has executed the last dialplan instruction, hanging up.</font></div>




</div><div><br></div><div>Am I misunderstanding how spandsp_start_fax_detect works?</div><span><font color="#888888"><div><br></div><div>Adam Johnston<br>
</div>
</font></span><br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org" target="_blank">http://www.FreeSWITCH.org</a><br>
<a href="http://www.ClueCon.com" target="_blank">http://www.ClueCon.com</a><br>
<a href="http://www.OSTAG.org" target="_blank">http://www.OSTAG.org</a><br><br><br>
</font></span><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org" target="_blank">http://www.FreeSWITCH.org</a><br><a href="http://www.ClueCon.com" target="_blank">http://www.ClueCon.com</a><br>
<a href="http://www.OSTAG.org" target="_blank">http://www.OSTAG.org</a><br><br><br>