On Mon, Oct 12, 2009 at 4:01 AM, homqua <ngay01042005@gmail.com> wrote:

Hi,
I have implemented the solution for tone detection in wiki, and also answer
the channel before detecting the tone:
<condition field="destination_number" expression="^(055138419992)$">
   <action application="answer"/>
   <action application="tone_detect" data="fax 1100 r +15000 transfer fax
XML default"/>


<extension name="fax">
     <condition field="destination_number" expression="^fax$">
       <action application="answer" />
       <action application="sleep" data="1000"/>
       <action application="rxfax"
data="/usr/local/freeswitch/storage/fax/${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}.tiff"/>
   <action application="set" data="fax_mode=recv"/>
       <action application="hangup"/>
     </condition>
   </extension>


But FS cannot recognize the tone, and therefore cannot move to fax
extension.  Below are the error in FS:

2009-10-12 10:57:16.702287 [NOTICE] switch_channel.c:602 New Channel
sofia/external/anonymous@anonymous.invalid
[c431f0a3-9231-4724-ba39-9e4ef7edfca2]
2009-10-12 10:57:16.703413 [INFO] mod_dialplan_xml.c:315 Processing
Anonymous->055138419992 in context public
2009-10-12 10:57:16.719288 [NOTICE] switch_ivr.c:1349 Transfer
sofia/external/anonymous@anonymous.invalid to XML[055138419992@default]
2009-10-12 10:57:16.719288 [INFO] mod_dialplan_xml.c:315 Processing
Anonymous->055138419992 in context default
2009-10-12 10:57:16.722289 [NOTICE] mod_dptools.c:649 Channel
[sofia/external/anonymous@anonymous.invalid] has been answered
2009-10-12 10:57:16.722289 [NOTICE] mod_dptools.c:1324 Enabling tone
detection 'fax' '1100'
2009-10-12 10:57:16.723302 [NOTICE] switch_core_state_machine.c:179 Hangup
sofia/external/anonymous@anonymous.invalid [CS_EXECUTE] [NORMAL_CLEARING]
2009-10-12 10:57:16.740285 [NOTICE] switch_core_session.c:1086 Session 1
(sofia/external/anonymous@anonymous.invalid) Ended
2009-10-12 10:57:16.740285 [NOTICE] switch_core_session.c:1088 Close Channel
sofia/external/anonymous@anonymous.invalid [CS_DESTROY]

And the trace for SIP messages:  http://pastebin.com/m4e47e7d9

If anyone has any idea, tell me please.
Thanks.

I think the trouble here is that you don't have anything else in the dialplan after the tone_detect. The tone_detect app is non-block, which means that it doesn't sit there and wait for a tone. If you want the dialplan to sit and wait then do a sleep app after your tone_detect. The other question I would have is this: what happens if the incoming call is not a fax? What do you want to do then?

-MC