<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Well, the problem with the dialplan is that you could have a single
entry per application.<br>
However, if your mailbox is capable of receiving both the voice and fax
messages, then the decision which one to take should be taken inside
your application.<br>
<br>
In other words, I do have the following in my dialplan:<br>
<br>
<tt> <extension name="main_entry"><br>
<condition field="destination_number"
expression="^(7[0-9][0-9][0-9][0-9])$"><br>
<action application="lua"
data="/home/freeswitch/scripts/app/main.lua"/><br>
</condition><br>
</extension><br>
</tt><br>
All calls to the #s 70000-7999 are directed to main.lua scrtipt. The
call is answered prompt then, is being played, "Please leave a voice
message or fax".<br>
Now, I need a way to catch a fax tone, if exists, and route my code
flow to the appropriate function.<br>
Note, that the sender may hit 'Send' upon listening the prompt, in
other words, the fax negotiation will not start immediately.<br>
Does it all make sense?<br>
<br>
Cheers,<br>
Peter<br>
<br>
<br>
Michael Collins wrote:
<blockquote
cite="mid:87f2f3b90910141132p672fff11n91bee07964d382f0@mail.gmail.com"
type="cite"><br>
<br>
<div class="gmail_quote">On Wed, Oct 14, 2009 at 11:11 AM, Peter
Volchek <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:pvolchek@voicemobility.com">pvolchek@voicemobility.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
Could anyone help me how to setup the event handler within lua script?<br>
My dialplan is simply configured to execute an application for the DID<br>
range.<br>
All code processing is being happened within lua code.<br>
Now, consider the following scenario.<br>
<br>
- The call comes in<br>
- My script starts<br>
- The prompt(greeting) is being played "No one is available at a moment,<br>
please leave a message or start sending your fax now"<br>
<br>
Are there any ways, to find out at this point, whether fax negotiation<br>
has started?<br>
The following pseudo code would explain my concern:<br>
<br>
if ( getEvent("Detected-Tone") == "fax" )<br>
doReceiveFax()<br>
else<br>
doReceiveVoice()<br>
<br>
<br>
Thanks,<br>
Peter<br>
<br>
</blockquote>
<div>You can use the tone_detect app per the wiki (<a
moz-do-not-send="true"
href="http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_tone_detect">http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_tone_detect</a>)
to detect the tone and act accordingly. You just need to decide what to
do while waiting to detect the tone. Personally, I don't like doing too
much call control inside a script, but YMMV.<br>
<br>
Not having tried it myself I would suggest trying something simple,
like using the tone_detect app to set a chan var and then have your
script keep checking that chan var until your timeout has expired or it
sees the fax tone.<br>
<br>
-MC<br>
</div>
</div>
<br>
<pre wrap="">
</pre>
</blockquote>
</body>
</html>